Skip to content

Commit

Permalink
Merge pull request #119 from mskcc/bugfix/metafusion_tmpdir
Browse files Browse the repository at this point in the history
Bugfix/metafusion script error exiting behavior
  • Loading branch information
anoronh4 authored Aug 6, 2024
2 parents e544fa2 + c61e57a commit bf5e80d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### `Fixed`

- [#118](https://github.com/mskcc/forte/pull/119) - change script error behavior in METAFUSION_RUN process

### `Dependencies`

### `Deprecated`
Expand Down
14 changes: 9 additions & 5 deletions bin/Metafusion_forte.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash

set -eo pipefail

#STEPS

# __author__ = "Alexandria Dymun"
Expand All @@ -7,7 +10,6 @@
# __version__ = "0.0.1"
# __status__ = "Dev"


output_ANC_RT_SG=1
RT_call_filter=1
blck_filter=1
Expand Down Expand Up @@ -60,15 +62,17 @@ if [[ ! $cff || ! $gene_info || ! $gene_bed ]]; then
usage
fi

env | grep -i tmp

mkdir $outdir
mkdir -p $outdir

#Check CFF file format:
#Remove entries with nonconformming chromosome name

all_gene_bed_chrs=`awk -F '\t' '{print $1}' $gene_bed | sort | uniq | sed 's/chr//g '`
awk -F " " -v arr="${all_gene_bed_chrs[*]}" 'BEGIN{OFS = "\t"; split(arr,arr1); for(i in arr1) dict[arr1[i]]=""} $1 in dict && $4 in dict' $cff > $outdir/$(basename $cff).cleaned_chr
grep -v -f $outdir/$(basename $cff).cleaned_chr $cff > problematic_chromosomes.cff
head $outdir/$(basename $cff).cleaned_chr
grep -v -f $outdir/$(basename $cff).cleaned_chr $cff > problematic_chromosomes.cff || test $? = 1
cff=$outdir/$(basename $cff).cleaned_chr

#Rename cff
Expand Down Expand Up @@ -116,10 +120,10 @@ fi
#ReadThrough Callerfilter
if [ $RT_call_filter -eq 1 ]; then
echo ReadThrough, callerfilter $num_tools
cat $cluster | grep ReadThrough > $outdir/$(basename $cluster).ReadThrough
cat $cluster | grep ReadThrough > $outdir/$(basename $cluster).ReadThrough || test $? = 1
callerfilter_num.py --cluster $cluster --num_tools $num_tools > $outdir/$(basename $cluster).callerfilter.$num_tools
callerfilter_excluded=$(comm -13 <(cut -f 22 $outdir/$(basename $cluster).callerfilter.$num_tools | sort | uniq) <(cut -f 22 $cluster | sort | uniq))
grep -v ReadThrough $outdir/$(basename $cluster).callerfilter.$num_tools > $outdir/$(basename $cluster).RT_filter.callerfilter.$num_tools
grep -v ReadThrough $outdir/$(basename $cluster).callerfilter.$num_tools > $outdir/$(basename $cluster).RT_filter.callerfilter.$num_tools || test $? = 1
cluster_RT_call=$outdir/$(basename $cluster).RT_filter.callerfilter.$num_tools
fi
# Blocklist Filter
Expand Down
1 change: 1 addition & 0 deletions modules/local/metafusion/run/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ process METAFUSION_RUN {
args = task.ext.args ?: ""
def sample = "${meta.sample}"
"""
export TMPDIR=\$TMPDIR
Metafusion_forte.sh \\
--cff $cff \\
--outdir . \\
Expand Down

0 comments on commit bf5e80d

Please sign in to comment.