RNA-seq analysis pipeline for detection gene-fusions

public public 1yr ago Version: 2.3.4 0 bookmarks
Loading...

Introduction

nf-core/rnafusion is a bioinformatics best-practice analysis pipeline for RNA sequencing analysis pipeline with curated list of tools for detecting and visualizing fusion genes.

The pipeline is built using Nextflow , a workflow tool to run tasks across multiple compute infrastructures in a very portable manner. It uses Docker/Singularity containers making installation trivial and results highly reproducible. The Nextflow DSL2 implementation of this pipeline uses one container per process which makes it much easier to maintain and update software dependencies. Where possible, these processes have been submitted to and installed from nf-core/modules in order to make them available to all nf-core pipelines, and to everyone within the Nextflow community!

IMPORTANT: conda is not supported currently. Run with singularity or docker.

GRCh38 is the only supported reference

Tool Version
Arriba 2.3.0
FusionCatcher 1.33
Pizzly 0.37.3
Squid 1.5
STAR-Fusion 1.10.1
StringTie 2.2.1

Single-end reads are to be use as last-resort. Paired-end reads are recommended. FusionCatcher cannot be used with single-end reads shorter than 130 bp.

On release, automated continuous integration tests run the pipeline on a full-sized dataset on the AWS cloud infrastructure. This ensures that the pipeline runs on AWS, has sensible resource allocation defaults set to run on real-world datasets, and permits the persistent storage of results to benchmark between pipeline releases and other analysis sources.The results obtained from the full-sized test can be viewed on the nf-core website .

In rnafusion the full-sized test includes reference building and fusion detection. The test dataset is taken from here .

Pipeline summary

nf-core/rnafusion metro map

Build references

--build_references triggers a parallel workflow to build all references

  1. Download ensembl fasta and gtf files

  2. Create STAR index

  3. Download arriba references

  4. Download fusioncatcher references

  5. Download pizzly references (kallisto index)

  6. Download and build STAR-fusion references

  7. Download fusion-report DBs

Main workflow

  1. Input samplesheet check

  2. Concatenate fastq files per sample

  3. Read QC ( FastQC )

  4. Arriba subworkflow

  5. Pizzly subworkflow

  6. Squid subworkflow

  7. STAR-fusion subworkflow

  8. Fusioncatcher subworkflow

  9. Fusion-report subworkflow

  10. FusionInspector subworkflow

  11. Stringtie subworkflow

  12. Present QC for raw reads ( MultiQC )

  13. QC for mapped reads ( QualiMap: BAM QC )

  14. Index mapped reads ( samtools index )

  15. Collect metrics ( picard CollectRnaSeqMetrics and ( picard MarkDuplicates )

Usage

Note If you are new to Nextflow and nf-core, please refer to this page on how to set-up Nextflow. Make sure to test your setup with -profile test before running the workflow on actual data.

nextflow run nf-core/rnafusion --input samplesheet.csv --outdir <OUTDIR> --genome GRCh38 --all -profile <docker/singularity/podman/shifter/charliecloud/institute>
nextflow run nf-core/rnafusion --input samplesheet.csv --outdir <OUTDIR> --genome GRCh37 -profile <docker/singularity/podman/shifter/charliecloud/conda/institute>

Note that paths need to be absolute and that runs with conda are not supported.

nextflow run nf-core/rnafusion \
 -profile <docker/singularity/.../institute> \
 --input samplesheet.csv \
 --outdir <OUTDIR>

Warning: Please provide pipeline parameters via the CLI or Nextflow -params-file option. Custom config files including those provided by the -c Nextflow option can be used to provide any configuration except for parameters ; see docs .

For more details and further functionality, please refer to the usage documentation and the parameter documentation .

Pipeline output

To see the results of an example test run with a full size dataset refer to the results tab on the nf-core website pipeline page. For more details about the output files and reports, please refer to the output documentation .

Credits

nf-core/rnafusion was written by Martin Proks ( @matq007 ), Maxime Garcia ( @maxulysse ) and Annick Renevey ( @rannick )

We thank the following people for their help in the development of this pipeline:

Contributions and Support

If you would like to contribute to this pipeline, please see the contributing guidelines .

For further information or help, don't hesitate to get in touch on the Slack #rnafusion channel (you can join with this invite ).

Citations

If you use nf-core/rnafusion for your analysis, please cite it using the following doi: 10.5281/zenodo.3946477

An extensive list of references for the tools used by the pipeline can be found in the CITATIONS.md file.

You can cite the nf-core publication as follows:

The nf-core framework for community-curated bioinformatics pipelines.

Philip Ewels, Alexander Peltzer, Sven Fillinger, Harshil Patel, Johannes Alneberg, Andreas Wilm, Maxime Ulysse Garcia, Paolo Di Tommaso & Sven Nahnsen.

Nat Biotechnol. 2020 Feb 13. doi: 10.1038/s41587-020-0439-x .

Code Snippets

15
16
17
18
19
20
21
22
23
24
25
26
"""
wget https://github.com/suhrig/arriba/releases/download/v2.3.0/arriba_v2.3.0.tar.gz -O arriba_v2.3.0.tar.gz
tar -xzvf arriba_v2.3.0.tar.gz
rm arriba_v2.3.0.tar.gz
mv arriba_v2.3.0/database/* .
rm -r arriba_v2.3.0

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    wget: \$(echo wget -V 2>&1 | grep "GNU Wget" | cut -d" " -f3 > versions.yml)
END_VERSIONS
"""
29
30
31
32
33
34
35
36
37
38
39
40
"""
touch blacklist_hg38_GRCh38_v2.3.0.tsv.gz
touch protein_domains_hg38_GRCh38_v2.3.0.gff3
touch cytobands_hg38_GRCh38_v2.3.0.tsv
touch known_fusions_hg38_GRCh38_v2.3.0.tsv.gz
touch protein_domains_hg38_GRCh38_v2.3.0.gff3

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    wget: \$(echo wget -V 2>&1 | grep "GNU Wget" | cut -d" " -f3 > versions.yml)
END_VERSIONS
"""
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
draw_fusions.R \\
    --fusions=$fusions \\
    --alignments=$bam \\
    --output=${prefix}.pdf \\
    --annotation=${gtf} \\
    $cytobands \\
    $protein_domains \\
    $args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    arriba: \$(arriba -h | grep 'Version:' 2>&1 |  sed 's/Version:\s//')
END_VERSIONS
"""
46
47
48
49
50
51
52
"""
touch ${prefix}.pdf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    arriba: \$(arriba -h | grep 'Version:' 2>&1 |  sed 's/Version:\s//')
END_VERSIONS
"""
18
19
20
21
22
23
24
25
"""
convert2bed -i gtf < $gtf > ${prefix}.bed

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    convert2bed: \$(convert2bed --version | grep vers | sed 's/^.*.version:  //')
END_VERSIONS
"""
29
30
31
32
33
34
35
"""
touch ${prefix}.bed
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    convert2bed: \$(convert2bed --version | grep vers | sed 's/^.*.version:  //')
END_VERSIONS
"""
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
wget ftp://ftp.ensembl.org/pub/release-${ensembl_version}/fasta/homo_sapiens/dna/Homo_sapiens.${params.genome}.dna.chromosome.{1..22}.fa.gz
wget ftp://ftp.ensembl.org/pub/release-${ensembl_version}/fasta/homo_sapiens/dna/Homo_sapiens.${params.genome}.dna.chromosome.{MT,X,Y}.fa.gz

wget ftp://ftp.ensembl.org/pub/release-${ensembl_version}/gtf/homo_sapiens/Homo_sapiens.${params.genome}.${ensembl_version}.gtf.gz
wget ftp://ftp.ensembl.org/pub/release-${ensembl_version}/gtf/homo_sapiens/Homo_sapiens.${params.genome}.${ensembl_version}.chr.gtf.gz
wget ftp://ftp.ensembl.org/pub/release-${ensembl_version}/fasta/homo_sapiens/cdna/Homo_sapiens.${params.genome}.cdna.all.fa.gz -O Homo_sapiens.${params.genome}.${ensembl_version}.cdna.all.fa.gz

gunzip -c Homo_sapiens.${params.genome}.dna.chromosome.* > Homo_sapiens.${params.genome}.${ensembl_version}.all.fa
gunzip Homo_sapiens.${params.genome}.${ensembl_version}.gtf.gz
gunzip Homo_sapiens.${params.genome}.${ensembl_version}.chr.gtf.gz



cat <<-END_VERSIONS > versions.yml
"${task.process}":
    wget: \$(echo wget -V 2>&1 | grep "GNU Wget" | cut -d" " -f3 > versions.yml)
END_VERSIONS
"""
NextFlow From line 21 of ensembl/main.nf
42
43
44
45
46
47
48
49
50
51
52
"""
touch "Homo_sapiens.${params.genome}.${ensembl_version}.all.fa"
touch "Homo_sapiens.${params.genome}.${ensembl_version}.gtf"
touch "Homo_sapiens.${params.genome}.${ensembl_version}.chr.gtf"
touch "Homo_sapiens.${params.genome}.${ensembl_version}.cdna.all.fa.gz"

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    wget: \$(echo wget -V 2>&1 | grep "GNU Wget" | cut -d" " -f3 > versions.yml)
END_VERSIONS
"""
NextFlow From line 42 of ensembl/main.nf
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""
fusioncatcher.py \\
    -d $reference \\
    -i $reads \\
    -p $task.cpus \\
    -o . \\
    --skip-blat \\
    $single_end \\
    $args

mv final-list_candidate-fusion-genes.txt ${prefix}.fusioncatcher.fusion-genes.txt
mv summary_candidate_fusions.txt ${prefix}.fusioncatcher.summary.txt
mv fusioncatcher.log ${prefix}.fusioncatcher.log

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fusioncatcher: \$(echo \$(fusioncatcher --version 2>&1)| sed 's/fusioncatcher.py //')
END_VERSIONS
"""
NextFlow From line 26 of detect/main.nf
49
50
51
52
53
54
55
56
57
"""
touch ${prefix}.fusioncatcher.fusion-genes.txt
touch ${prefix}.fusioncatcher.summary.txt
touch ${prefix}.fusioncatcher.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fusioncatcher: \$(echo \$(fusioncatcher --version 2>&1)| sed 's/fusioncatcher.py //')
END_VERSIONS
"""
NextFlow From line 49 of detect/main.nf
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
if wget --spider "$url" 2>/dev/null; then
    wget $args $url
    wget $args http://sourceforge.net/projects/fusioncatcher/files/data/human_${human_version}.tar.gz.ab
    wget $args http://sourceforge.net/projects/fusioncatcher/files/data/human_${human_version}.tar.gz.ac
    wget $args http://sourceforge.net/projects/fusioncatcher/files/data/human_${human_version}.tar.gz.ad
    cat human_${human_version}.tar.gz.* | tar xz
    rm human_${human_version}.tar*
else
    fusioncatcher-build \\
        -g homo_sapiens \\
        -o human_${human_version} \\
        $args2
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fusioncatcher: \$(echo \$(fusioncatcher --version 2>&1))
END_VERSIONS
"""
44
45
46
47
48
49
50
"""
mkdir human_${human_version}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fusioncatcher: \$(echo \$(fusioncatcher --version 2>&1))
END_VERSIONS
"""
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
FusionInspector \\
    --fusions $fusion_list \\
    --genome_lib ${reference} \\
    $fasta \\
    --CPU ${task.cpus} \\
    -O . \\
    --out_prefix $prefix \\
    --vis $args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    STAR-Fusion: \$(STAR-Fusion --version 2>&1 | grep -i 'version' | sed 's/STAR-Fusion version: //')
END_VERSIONS
"""
41
42
43
44
45
46
47
48
49
"""
touch FusionInspector.log
touch FusionInspector.fusions.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    STAR-Fusion: \$(STAR-Fusion --version 2>&1 | grep -i 'version' | sed 's/STAR-Fusion version: //')
END_VERSIONS
"""
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
fusion_report run $meta.id . $fusionreport_ref $tools --allow-multiple-gene-symbols $args $args2

mv fusion_list.tsv ${prefix}.fusionreport.tsv
mv fusion_list_filtered.tsv ${prefix}.fusionreport_filtered.tsv
[ ! -f fusions.csv ] || mv fusions.csv ${prefix}.fusions.csv
[ ! -f fusions.json ] || mv fusions.json ${prefix}.fusions.json

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fusion_report: \$(fusion_report --version | sed 's/fusion-report //')
    fusion_report DB retrieval: \$(cat $fusionreport_ref/DB-timestamp.txt)
END_VERSIONS
"""
NextFlow From line 35 of detect/main.nf
52
53
54
55
56
57
58
59
60
61
62
63
64
"""
touch ${prefix}.fusionreport_filtered.tsv
touch ${prefix}.fusionreport.tsv
touch index.html
touch AAA_BBB.html
touch ${prefix}.fusions.csv
touch ${prefix}.fusions.json

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fusion_report: \$(fusion_report --version | sed 's/fusion-report //')
END_VERSIONS
"""
NextFlow From line 52 of detect/main.nf
19
20
21
22
23
24
25
26
"""
fusion_report download --cosmic_usr "$username" --cosmic_passwd "$passwd" $args ./

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fusion_report: \$(fusion_report --version | sed 's/fusion-report //')
END_VERSIONS
"""
29
30
31
32
33
34
35
36
37
38
"""
touch cosmic.db
touch fusiongdb2.db
touch fusiongdb.db
touch mitelman.db
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fusion_report: \$(fusion_report --version | sed 's/fusion-report //')
END_VERSIONS
"""
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
kallisto quant \
    -t $task.cpus \
    -i $index \
    --fusion \
    -o . \
    $reads
mv fusion.txt ${prefix}.kallisto_quant.fusions.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    kallisto: \$(echo \$(kallisto 2>&1) | sed 's/^kallisto //; s/Usage.*\$//')
END_VERSIONS
"""
39
40
41
42
43
44
45
"""
touch ${prefix}.kallisto_quant.fusions.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    kallisto: \$(echo \$(kallisto 2>&1) | sed 's/^kallisto //; s/Usage.*\$//')
END_VERSIONS
"""
NextFlow From line 39 of quant/main.nf
22
23
24
25
26
27
28
29
"""
megafusion.py --fusioninspector $tsv --fusionreport $report --sample ${prefix} --out ${prefix}.vcf

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
33
34
35
36
37
38
39
40
"""
touch ${prefix}.vcf

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
"""
picard \\
    -Xmx${avail_mem}g \\
    CollectRnaSeqMetrics \\
    --TMP_DIR ./tmp \\
    ${strandedness} \\
    ${rrna} \\
    --REF_FLAT ${refflat} \\
    --INPUT ${bam} \\
    --OUTPUT ${prefix}_rna_metrics.txt \\

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    picard: \$(picard CollectRnaMetrics --version 2>&1 | grep -o 'Version.*' | cut -f2- -d:)
END_VERSIONS
"""
61
62
63
64
65
66
67
"""
touch ${prefix}_rna_metrics.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    picard: \$(picard CollectRnaMetrics --version 2>&1 | grep -o 'Version.*' | cut -f2- -d:)
END_VERSIONS
"""
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
pizzly \\
    $args \\
    --gtf $gtf \\
    --fasta $transcript \\
    --output ${prefix}.pizzly $txt

pizzly_flatten_json.py ${prefix}.pizzly.json ${prefix}.pizzly.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    pizzly: \$(pizzly --version | grep pizzly | sed -e "s/pizzly version: //g")
END_VERSIONS
"""
40
41
42
43
44
45
46
47
"""
touch ${prefix}.pizzly.txt
touch ${prefix}.pizzly.unfiltered.json
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    pizzly: \$(pizzly --version | grep pizzly | sed -e "s/pizzly version: //g")
END_VERSIONS
"""
31
32
33
34
35
36
37
38
39
"""
reformat.sh $in1 $out1 $args
reformat.sh $in2 $out2 $args2

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    reformat.sh: \$(echo \$(reformat.sh --version 2>&1)| sed -e "s/BBMap version //g" )
END_VERSIONS
"""
45
46
47
48
49
50
51
52
"""
touch $out1
touch $out2
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    reformat.sh: \$(echo \$(reformat.sh --version 2>&1)| sed -e "s/BBMap version //g" )
END_VERSIONS
"""
25
26
27
28
29
30
31
"""
get_rrna_transcripts.py $gtf ${prefix}_rrna_intervals.gtf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
35
36
37
38
39
40
41
"""
touch ${prefix}_rrna_intervals.gtf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
22
23
24
25
26
27
28
29
30
31
"""
check_samplesheet.py \\
    $samplesheet \\
    samplesheet.valid.csv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
23
24
25
26
27
28
29
30
"""
AnnotateSQUIDOutput.py $gtf $txt ${prefix}.squid.fusions.annotated.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    squid: \$(echo \$(squid --version 2>&1) | sed 's/v//')
END_VERSIONS
"""
34
35
36
37
38
39
40
"""
touch ${prefix}.squid.fusions.annotated.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    squid: \$(echo \$(squid --version 2>&1) | sed 's/v//')
END_VERSIONS
"""
22
23
24
25
26
27
28
29
"""
squid -b $bam -c $chimeric_bam -o ${prefix}.squid.fusions

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    squid: \$(echo \$(squid --version 2>&1) | sed 's/v//')
END_VERSIONS
"""
33
34
35
36
37
38
39
"""
touch ${prefix}.squid.fusions_sv.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    squid: \$(echo \$(squid --version 2>&1) | sed 's/v//')
END_VERSIONS
"""
NextFlow From line 33 of detect/main.nf
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
export TMPDIR=/tmp
wget http://ftp.ebi.ac.uk/pub/databases/Pfam/releases/Pfam34.0/Pfam-A.hmm.gz --no-check-certificate
wget https://github.com/FusionAnnotator/CTAT_HumanFusionLib/releases/download/v0.3.0/fusion_lib.Mar2021.dat.gz -O CTAT_HumanFusionLib_Mar2021.dat.gz --no-check-certificate
wget https://data.broadinstitute.org/Trinity/CTAT_RESOURCE_LIB/AnnotFilterRule.pm -O AnnotFilterRule.pm --no-check-certificate
wget https://www.dfam.org/releases/Dfam_3.4/infrastructure/dfamscan/homo_sapiens_dfam.hmm --no-check-certificate
wget https://www.dfam.org/releases/Dfam_3.4/infrastructure/dfamscan/homo_sapiens_dfam.hmm.h3f --no-check-certificate
wget https://www.dfam.org/releases/Dfam_3.4/infrastructure/dfamscan/homo_sapiens_dfam.hmm.h3i --no-check-certificate
wget https://www.dfam.org/releases/Dfam_3.4/infrastructure/dfamscan/homo_sapiens_dfam.hmm.h3m --no-check-certificate
wget https://www.dfam.org/releases/Dfam_3.4/infrastructure/dfamscan/homo_sapiens_dfam.hmm.h3p --no-check-certificate
gunzip Pfam-A.hmm.gz && hmmpress Pfam-A.hmm
$binPath \\
    --genome_fa $fasta \\
    --gtf $gtf \\
    --annot_filter_rule AnnotFilterRule.pm \\
    --fusion_annot_lib CTAT_HumanFusionLib_Mar2021.dat.gz \\
    --pfam_db Pfam-A.hmm \\
    --dfam_db homo_sapiens_dfam.hmm \\
    --max_readlength $params.read_length \\
    --CPU $task.cpus

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    STAR-Fusion: \$(STAR-Fusion --version 2>&1 | grep -i 'version' | sed 's/STAR-Fusion version: //')
END_VERSIONS
"""
NextFlow From line 16 of build/main.nf
44
45
46
47
48
49
50
51
52
"""
mkdir ctat_genome_lib_build_dir
touch ref_annot.cdna.fa

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    STAR-Fusion: \$(STAR-Fusion --version 2>&1 | grep -i 'version' | sed 's/STAR-Fusion version: //')
END_VERSIONS
"""
NextFlow From line 44 of build/main.nf
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
STAR-Fusion \\
    --genome_lib_dir $reference \\
    $fasta \\
    -J $junction \\
    --CPU $task.cpus \\
    --examine_coding_effect \\
    --output_dir . \\
    $args

mv star-fusion.fusion_predictions.tsv ${prefix}.starfusion.fusion_predictions.tsv
mv star-fusion.fusion_predictions.abridged.tsv ${prefix}.starfusion.abridged.tsv
mv star-fusion.fusion_predictions.abridged.coding_effect.tsv ${prefix}.starfusion.abridged.coding_effect.tsv

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    STAR-Fusion: \$(STAR-Fusion --version 2>&1 | grep -i 'version' | sed 's/STAR-Fusion version: //')
END_VERSIONS
"""
NextFlow From line 22 of detect/main.nf
44
45
46
47
48
49
50
51
52
"""
touch ${prefix}.starfusion.fusion_predictions.tsv
touch ${prefix}.starfusion.abridged.tsv
touch ${prefix}.starfusion.abridged.coding_effect.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    STAR-Fusion: \$(STAR-Fusion --version 2>&1 | grep -i 'version' | sed 's/STAR-Fusion version: //')
END_VERSIONS
"""
NextFlow From line 44 of detect/main.nf
13
14
15
16
17
18
19
20
21
"""
wget https://data.broadinstitute.org/Trinity/CTAT_RESOURCE_LIB/__genome_libs_StarFv1.10/GRCh38_gencode_v37_CTAT_lib_Mar012021.plug-n-play.tar.gz --no-check-certificate

tar xvf GRCh38_gencode_v37_CTAT_lib_Mar012021.plug-n-play.tar.gz

rm GRCh38_gencode_v37_CTAT_lib_Mar012021.plug-n-play.tar.gz

mv */ctat_genome_lib_build_dir .
"""
24
25
26
27
28
29
30
31
"""
mkdir ctat_genome_lib_build_dir
touch ref_annot.cdna.fa
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    STAR-Fusion: \$(STAR-Fusion --version 2>&1 | grep -i 'version' | sed 's/STAR-Fusion version: //')
END_VERSIONS
"""
18
19
20
21
22
23
24
25
26
"""
gtfToGenePred -genePredExt -geneNameAsName2 ${gtf} ${genepred}
paste ${genepred} ${genepred} | cut -f12,16-25 > ${refflat}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    gtfToGenePred: 377
END_VERSIONS
"""
30
31
32
33
34
35
36
"""
touch ${refflat}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    gtfToGenePred: 377
END_VERSIONS
"""
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
arriba \\
    -x $bam \\
    -a $fasta \\
    -g $gtf \\
    -o ${prefix}.fusions.tsv \\
    -O ${prefix}.fusions.discarded.tsv \\
    $blacklist \\
    $known_fusions \\
    $structural_variants \\
    $tags \\
    $protein_domains \\
    $args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    arriba: \$(arriba -h | grep 'Version:' 2>&1 |  sed 's/Version:\s//')
END_VERSIONS
"""
59
60
61
62
63
64
65
"""
echo stub > ${prefix}.fusions.tsv
echo stub > ${prefix}.fusions.discarded.tsv

echo "${task.process}:" > versions.yml
echo ' arriba: 2.2.1' >> versions.yml
"""
NextFlow From line 59 of arriba/main.nf
38
39
40
41
42
43
44
45
46
47
48
49
"""
$command1 \\
    $args \\
    ${file_list.join(' ')} \\
    $command2 \\
    > ${prefix}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
END_VERSIONS
"""
NextFlow From line 38 of cat/main.nf
54
55
56
57
58
59
60
61
"""
touch $prefix

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
END_VERSIONS
"""
NextFlow From line 54 of cat/main.nf
26
27
28
29
30
31
32
33
"""
cat ${readList.join(' ')} > ${prefix}.merged.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    cat: \$(echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//')
END_VERSIONS
"""
NextFlow From line 26 of fastq/main.nf
40
41
42
43
44
45
46
47
48
"""
cat ${read1.join(' ')} > ${prefix}_1.merged.fastq.gz
cat ${read2.join(' ')} > ${prefix}_2.merged.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    cat: \$(echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//')
END_VERSIONS
"""
NextFlow From line 40 of fastq/main.nf
57
58
59
60
61
62
63
64
"""
touch ${prefix}.merged.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    cat: \$(echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//')
END_VERSIONS
"""
NextFlow From line 57 of fastq/main.nf
68
69
70
71
72
73
74
75
76
"""
touch ${prefix}_1.merged.fastq.gz
touch ${prefix}_2.merged.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    cat: \$(echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//')
END_VERSIONS
"""
NextFlow From line 68 of fastq/main.nf
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""
[ ! -f  ${prefix}.fastq.gz ] && ln -sf $reads ${prefix}.fastq.gz

fastp \\
    --stdout \\
    --in1 ${prefix}.fastq.gz \\
    --thread $task.cpus \\
    --json ${prefix}.fastp.json \\
    --html ${prefix}.fastp.html \\
    $adapter_list \\
    $fail_fastq \\
    $args \\
    2> ${prefix}.fastp.log \\
| gzip -c > ${prefix}.fastp.fastq.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastp: \$(fastp --version 2>&1 | sed -e "s/fastp //g")
END_VERSIONS
"""
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""
[ ! -f  ${prefix}.fastq.gz ] && ln -sf $reads ${prefix}.fastq.gz

fastp \\
    --in1 ${prefix}.fastq.gz \\
    --out1  ${prefix}.fastp.fastq.gz \\
    --thread $task.cpus \\
    --json ${prefix}.fastp.json \\
    --html ${prefix}.fastp.html \\
    $adapter_list \\
    $fail_fastq \\
    $args \\
    2> ${prefix}.fastp.log

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastp: \$(fastp --version 2>&1 | sed -e "s/fastp //g")
END_VERSIONS
"""
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
"""
[ ! -f  ${prefix}_1.fastq.gz ] && ln -sf ${reads[0]} ${prefix}_1.fastq.gz
[ ! -f  ${prefix}_2.fastq.gz ] && ln -sf ${reads[1]} ${prefix}_2.fastq.gz
fastp \\
    --in1 ${prefix}_1.fastq.gz \\
    --in2 ${prefix}_2.fastq.gz \\
    --out1 ${prefix}_1.fastp.fastq.gz \\
    --out2 ${prefix}_2.fastp.fastq.gz \\
    --json ${prefix}.fastp.json \\
    --html ${prefix}.fastp.html \\
    $adapter_list \\
    $fail_fastq \\
    $merge_fastq \\
    --thread $task.cpus \\
    --detect_adapter_for_pe \\
    $args \\
    2> ${prefix}.fastp.log

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastp: \$(fastp --version 2>&1 | sed -e "s/fastp //g")
END_VERSIONS
"""
28
29
30
31
32
33
34
35
36
37
38
"""
printf "%s %s\\n" $rename_to | while read old_name new_name; do
    [ -f "\${new_name}" ] || ln -s \$old_name \$new_name
done
fastqc $args --threads $task.cpus $renamed_files

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastqc: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
42
43
44
45
46
47
48
49
50
"""
touch ${prefix}.html
touch ${prefix}.zip

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    fastqc: \$( fastqc --version | sed -e "s/FastQC v//g" )
END_VERSIONS
"""
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
gatk --java-options "-Xmx${avail_mem}g" BedToIntervalList \\
    --INPUT $bed \\
    --OUTPUT ${prefix}.interval_list \\
    --SEQUENCE_DICTIONARY $dict \\
    --TMP_DIR . \\
    $args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
47
48
49
50
51
52
53
54
"""
touch ${prefix}.interval_list

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
29
30
31
32
33
34
35
36
37
38
39
40
"""
gatk --java-options "-Xmx${avail_mem}g" CreateSequenceDictionary \\
    --REFERENCE $fasta \\
    --URI $fasta \\
    --TMP_DIR . \\
    $args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
43
44
45
46
47
48
49
50
"""
touch ${fasta.baseName}.dict

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
22
23
24
25
26
27
28
29
30
31
32
33
"""
kallisto \\
    index \\
    $args \\
    -i kallisto \\
    $fasta

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    kallisto: \$(echo \$(kallisto 2>&1) | sed 's/^kallisto //; s/Usage.*\$//')
END_VERSIONS
"""
36
37
38
39
40
41
42
43
"""
touch kallisto

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    kallisto: \$(echo \$(kallisto 2>&1) | sed 's/^kallisto //; s/Usage.*\$//')
END_VERSIONS
"""
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
multiqc \\
    --force \\
    $args \\
    $config \\
    $extra_config \\
    .

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    multiqc: \$( multiqc --version | sed -e "s/multiqc, version //g" )
END_VERSIONS
"""
43
44
45
46
47
48
49
50
51
52
"""
touch multiqc_data
touch multiqc_plots
touch multiqc_report.html

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    multiqc: \$( multiqc --version | sed -e "s/multiqc, version //g" )
END_VERSIONS
"""
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
picard \\
    -Xmx${avail_mem}g \\
    MarkDuplicates \\
    $args \\
    --INPUT $bam \\
    --OUTPUT ${prefix}.bam \\
    --REFERENCE_SEQUENCE $fasta \\
    --METRICS_FILE ${prefix}.MarkDuplicates.metrics.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    picard: \$(echo \$(picard MarkDuplicates --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:)
END_VERSIONS
"""
51
52
53
54
55
56
57
58
59
60
"""
touch ${prefix}.bam
touch ${prefix}.bam.bai
touch ${prefix}.MarkDuplicates.metrics.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    picard: \$(echo \$(picard MarkDuplicates --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d:)
END_VERSIONS
"""
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""
unset DISPLAY
mkdir tmp
export _JAVA_OPTIONS=-Djava.io.tmpdir=./tmp
qualimap \\
    --java-mem-size=$memory \\
    rnaseq \\
    $args \\
    -bam $bam \\
    -gtf $gtf \\
    -p $strandedness \\
    $paired_end \\
    -outdir $prefix

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    qualimap: \$(echo \$(qualimap 2>&1) | sed 's/^.*QualiMap v.//; s/Built.*\$//')
END_VERSIONS
"""
55
56
57
58
59
60
61
62
"""
mkdir ${prefix}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    qualimap: \$(echo \$(qualimap 2>&1) | sed 's/^.*QualiMap v.//; s/Built.*\$//')
END_VERSIONS
"""
NextFlow From line 55 of rnaseq/main.nf
23
24
25
26
27
28
29
30
31
32
33
"""
samtools \\
    faidx \\
    $args \\
    $fasta

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
36
37
38
39
40
41
42
43
"""
touch ${fasta}.fai
cat <<-END_VERSIONS > versions.yml

"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
NextFlow From line 36 of faidx/main.nf
24
25
26
27
28
29
30
31
32
33
34
35
"""
samtools \\
    index \\
    -@ ${task.cpus-1} \\
    $args \\
    $input

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
38
39
40
41
42
43
44
45
46
47
"""
touch ${input}.bai
touch ${input}.crai
touch ${input}.csi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
NextFlow From line 38 of index/main.nf
25
26
27
28
29
30
31
"""
samtools sort $args -@ $task.cpus -o ${prefix}.bam -T $prefix $bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
35
36
37
38
39
40
41
42
"""
touch ${prefix}.bam

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
NextFlow From line 35 of sort/main.nf
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
samtools \\
    view \\
    --threads ${task.cpus-1} \\
    ${reference} \\
    ${readnames} \\
    $args \\
    -o ${prefix}.${file_type} \\
    $input \\
    $args2

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
57
58
59
60
61
62
63
64
65
"""
touch ${prefix}.bam
touch ${prefix}.cram

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
NextFlow From line 57 of view/main.nf
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
STAR \\
    --genomeDir $index \\
    --readFilesIn $reads  \\
    --runThreadN $task.cpus \\
    --outFileNamePrefix $prefix. \\
    $out_sam_type \\
    $ignore_gtf \\
    $seq_center \\
    $args

$mv_unsorted_bam

if [ -f ${prefix}.Unmapped.out.mate1 ]; then
    mv ${prefix}.Unmapped.out.mate1 ${prefix}.unmapped_1.fastq
    gzip ${prefix}.unmapped_1.fastq
fi
if [ -f ${prefix}.Unmapped.out.mate2 ]; then
    mv ${prefix}.Unmapped.out.mate2 ${prefix}.unmapped_2.fastq
    gzip ${prefix}.unmapped_2.fastq
fi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    star: \$(STAR --version | sed -e "s/STAR_//g")
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
    gawk: \$(echo \$(gawk --version 2>&1) | sed 's/^.*GNU Awk //; s/, .*\$//')
END_VERSIONS
"""
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
"""
touch ${prefix}Xd.out.bam
touch ${prefix}.Log.final.out
touch ${prefix}.Log.out
touch ${prefix}.Log.progress.out
touch ${prefix}.sortedByCoord.out.bam
touch ${prefix}.toTranscriptome.out.bam
touch ${prefix}.Aligned.unsort.out.bam
touch ${prefix}.unmapped_1.fastq.gz
touch ${prefix}.unmapped_2.fastq.gz
touch ${prefix}.tab
touch ${prefix}.Chimeric.out.junction
touch ${prefix}.out.sam

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    star: \$(STAR --version | sed -e "s/STAR_//g")
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
    gawk: \$(echo \$(gawk --version 2>&1) | sed 's/^.*GNU Awk //; s/, .*\$//')
END_VERSIONS
"""
NextFlow From line 76 of align/main.nf
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
mkdir star
STAR \\
    --runMode genomeGenerate \\
    --genomeDir star/ \\
    --genomeFastaFiles $fasta \\
    --sjdbGTFfile $gtf \\
    --runThreadN $task.cpus \\
    $memory \\
    $args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    star: \$(STAR --version | sed -e "s/STAR_//g")
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
    gawk: \$(echo \$(gawk --version 2>&1) | sed 's/^.*GNU Awk //; s/, .*\$//')
END_VERSIONS
"""
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"""
samtools faidx $fasta
NUM_BASES=`gawk '{sum = sum + \$2}END{if ((log(sum)/log(2))/2 - 1 > 14) {printf "%.0f", 14} else {printf "%.0f", (log(sum)/log(2))/2 - 1}}' ${fasta}.fai`

mkdir star
STAR \\
    --runMode genomeGenerate \\
    --genomeDir star/ \\
    --genomeFastaFiles $fasta \\
    --sjdbGTFfile $gtf \\
    --runThreadN $task.cpus \\
    --genomeSAindexNbases \$NUM_BASES \\
    $memory \\
    $args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    star: \$(STAR --version | sed -e "s/STAR_//g")
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
    gawk: \$(echo \$(gawk --version 2>&1) | sed 's/^.*GNU Awk //; s/, .*\$//')
END_VERSIONS
"""
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
"""
mkdir star
touch star/Genome
touch star/Log.out
touch star/SA
touch star/SAindex
touch star/chrLength.txt
touch star/chrName.txt
touch star/chrNameLength.txt
touch star/chrStart.txt
touch star/exonGeTrInfo.tab
touch star/exonInfo.tab
touch star/geneInfo.tab
touch star/genomeParameters.txt
touch star/sjdbInfo.txt
touch star/sjdbList.fromGTF.out.tab
touch star/sjdbList.out.tab
touch star/transcriptInfo.tab

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    star: \$(STAR --version | sed -e "s/STAR_//g")
    samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
    gawk: \$(echo \$(gawk --version 2>&1) | sed 's/^.*GNU Awk //; s/, .*\$//')
END_VERSIONS
"""
24
25
26
27
28
29
30
31
32
33
34
35
"""
stringtie \\
    --merge $stringtie_gtf \\
    $reference \\
    -o stringtie.merged.gtf \\
    $args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    stringtie: \$(stringtie --version 2>&1)
END_VERSIONS
"""
38
39
40
41
42
43
44
45
"""
touch stringtie.merged.gtf

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    stringtie: \$(stringtie --version 2>&1)
END_VERSIONS
"""
NextFlow From line 38 of merge/main.nf
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
stringtie \\
    $bam \\
    $strandedness \\
    $reference \\
    -o ${prefix}.transcripts.gtf \\
    -A ${prefix}.gene.abundance.txt \\
    $coverage \\
    $ballgown \\
    -p $task.cpus \\
    $args

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    stringtie: \$(stringtie --version 2>&1)
END_VERSIONS
"""
57
58
59
60
61
62
63
64
65
66
67
"""
touch ${prefix}.transcripts.gtf
touch ${prefix}.gene.abundance.txt
touch ${prefix}.coverage.gtf
touch ${prefix}.ballgown

cat <<-END_VERSIONS > versions.yml
"${task.process}":
    stringtie: \$(stringtie --version 2>&1)
END_VERSIONS
"""
ShowHide 70 more snippets with no or duplicated tags.

Login to post a comment if you would like to share your experience with this workflow.

Do you know this workflow well? If so, you can request seller status , and start supporting this workflow.

Free

Created: 1yr ago
Updated: 1yr ago
Maitainers: public
URL: https://nf-co.re/rnafusion
Name: rnafusion
Version: 2.3.4
Badge:
workflow icon

Insert copied code into your website to add a link to this workflow.

Downloaded: 0
Copyright: Public Domain
License: None
  • Future updates

Related Workflows

cellranger-snakemake-gke
snakemake workflow to run cellranger on a given bucket using gke.
A Snakemake workflow for running cellranger on a given bucket using Google Kubernetes Engine. The usage of this workflow ...