Skip to content

Commit

Permalink
Merge branch 'feature/make_cff' into enhancement/metafusion_refs
Browse files Browse the repository at this point in the history
  • Loading branch information
anoronh4 committed Aug 4, 2023
2 parents de72cc2 + d845e07 commit c2c8b70
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 74 deletions.
14 changes: 9 additions & 5 deletions bin/Metafusion_forte.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,13 @@ mkdir $outdir
#Check CFF file format:
#Remove entries with nonconformming chromosome name
#Remove "." from strand field and replace with "NA"
cat $cff | awk '$1 ~ /[0-9XY]/ && $4 ~ /[0-9XY]/ ' | awk 'BEGIN{FS=OFS="\t"} $3 !~ /^[-+]$/{$3="NA"} 1' | awk 'BEGIN{FS=OFS="\t"} $6 !~ /^[-+]$/{$6="NA"} 1' > $outdir/$(basename $cff).reformat
cff=$outdir/$(basename $cff).reformat
#cat $cff | awk '$1 ~ /[0-9XY]/ && $4 ~ /[0-9XY]/ ' | awk 'BEGIN{FS=OFS="\t"} $3 !~ /^[-+]$/{$3="NA"} 1' | awk 'BEGIN{FS=OFS="\t"} $6 !~ /^[-+]$/{$6="NA"} 1' > $outdir/$(basename $cff).reformat
#cff=$outdir/$(basename $cff).reformat

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
cff=$outdir/$(basename $cff).cleaned_chr

#Rename cff
echo Rename cff
Expand All @@ -77,9 +81,9 @@ cff=$outdir/$(basename $cff).renamed

### remove any chromosomes that do not exist in genebed
all_gene_bed_chrs=`awk -F '\t' '{print $1}' $gene_bed | sort | uniq `
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
cff=$outdir/$(basename $cff).cleaned_chr
#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
#cff=$outdir/$(basename $cff).cleaned_chr

#Annotate cff
if [ $genome_fasta ]; then
Expand Down
4 changes: 4 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ process {
]
}

withName: METAFUSION {
ext.args = "--numtools ${params.fusion_tool_cutoff}"
}

withName: AGFUSION_BATCH {
ext.args = "-a cff_ext --noncanonical --middlestar"
publishDir = [
Expand Down
59 changes: 0 additions & 59 deletions main_test.nf

This file was deleted.

6 changes: 3 additions & 3 deletions modules/local/convert_to_cff/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ process TO_CFF {
tag "$meta.id"
label "process_single"

/// must be using singularity 3.7+
// must be using singularity 3.7+
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'ghcr.io/rocker-org/devcontainer/tidyverse:4' :
'ghcr.io/rocker-org/devcontainer/tidyverse:4' }"
Expand All @@ -11,8 +11,8 @@ process TO_CFF {
tuple val(meta), val(caller), path(fusions)

output:
tuple val(meta), path("*.cff") , emit: cff
path "versions.yml" , emit: versions
tuple val(meta), path("*.cff"), emit: cff
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand Down
12 changes: 9 additions & 3 deletions modules/local/metafusion/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ process METAFUSION {
path info
path fasta
path blocklist
val numtools

output:
tuple val(meta), path("*final*cluster") , emit: cluster
tuple val(meta), path("*.filtered.cff") , emit: filtered
tuple val(meta), path("*reformat*") , emit: all
tuple val(meta), path("cis-sage.cluster") , emit: cis
tuple val(meta), path("problematic_chromosomes.cff"), emit: problem_chrom
path "versions.yml" , emit: versions
Expand All @@ -26,9 +24,17 @@ process METAFUSION {
task.ext.when == null || task.ext.when

script:
args = task.ext.args ?: ""
def sample = "${meta.sample}"
"""
Metafusion_forte.sh --cff $cff --outdir . --gene_bed $genebed --gene_info $info --genome_fasta $fasta --recurrent_bedpe $blocklist --num_tools=$numtools
Metafusion_forte.sh \\
--cff $cff \\
--outdir . \\
--gene_bed $genebed \\
--gene_info $info \\
--genome_fasta $fasta \\
--recurrent_bedpe $blocklist \\
${args}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ params {
cosmic_usr = null
fusion_report_cutoff = 1
skip_fusion_report = false
numtools = 1
fusion_tool_cutoff = 1

// QC
// rseqc_modules can include ['bam_stat','inner_distance','infer_experiment','junction_annotation','junction_saturation','read_distribution','read_duplication','tin']
Expand Down
4 changes: 1 addition & 3 deletions subworkflows/local/fusion.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ workflow FUSION {
gene_bed = params.metafusion_gene_bed
gene_info = params.metafusion_gene_info
blocklist = params.metafusion_blocklist
numtools = params.numtools

STAR_FOR_ARRIBA(
reads,
Expand Down Expand Up @@ -104,8 +103,7 @@ workflow FUSION {
gene_bed,
gene_info,
fasta,
blocklist,
numtools
blocklist
)

ADD_FLAG(
Expand Down

0 comments on commit c2c8b70

Please sign in to comment.