Skip to content

Commit

Permalink
make ctatsplicing possible with arriba input
Browse files Browse the repository at this point in the history
  • Loading branch information
nvnieuwk committed Dec 17, 2024
1 parent af80d58 commit 0db19d9
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 32 deletions.
16 changes: 14 additions & 2 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,25 @@ process {
]
}

withName: 'CTATSPLICING_STARTOCANCERINTRONS' {
withName: '.*ARRIBA_WORKFLOW:.*:CTATSPLICING_STARTOCANCERINTRONS' {
ext.args = {[
bam ? "--vis" : "",
"--sample_name ${meta.id}",
].join(" ")}
publishDir = [
path: { "${params.outdir}/ctatsplicing" },
path: { "${params.outdir}/ctatsplicing/arriba" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: '.*STARFUSION_WORKFLOW:.*:CTATSPLICING_STARTOCANCERINTRONS' {
ext.args = {[
bam ? "--vis" : "",
"--sample_name ${meta.id}",
].join(" ")}
publishDir = [
path: { "${params.outdir}/ctatsplicing/starfusion" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
Expand Down
2 changes: 1 addition & 1 deletion nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
"ctatsplicing": {
"type": "boolean",
"fa_icon": "far fa-file-code",
"description": "Build or run arriba CTAT-SPLICING"
"description": "Run CTAT-splicing to detect abberant cancer splicing introns. Needs --arriba and/or --starfusion to run."
},
"ensembl_ref": {
"type": "string",
Expand Down
33 changes: 23 additions & 10 deletions subworkflows/local/arriba_workflow/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,32 @@ include { SAMTOOLS_SORT as SAMTOOLS_SORT_FOR_ARRIBA } from '../../../modules/n
include { SAMTOOLS_VIEW as SAMTOOLS_VIEW_FOR_ARRIBA } from '../../../modules/nf-core/samtools/view/main'
include { STAR_ALIGN as STAR_FOR_ARRIBA } from '../../../modules/nf-core/star/align/main'

include { CTATSPLICING_WORKFLOW } from '../ctatsplicing_workflow'

workflow ARRIBA_WORKFLOW {
take:
reads // channel [ meta, [ fastqs ] ]
ch_gtf // channel [ meta, path_gtf ]
ch_fasta // channel [ meta, path_fasta ]
ch_starindex_ref // channel [ meta, path_index ]
ch_arriba_ref_blacklist // channel [ meta, path_blacklist ]
ch_arriba_ref_known_fusions // channel [ meta, path_known_fusions ]
ch_arriba_ref_cytobands // channel [ meta, path_cytobands ]
ch_arriba_ref_protein_domains // channel [ meta, path_proteins ]
reads // channel [ meta, [ fastqs ] ]
ch_gtf // channel [ meta, path_gtf ]
ch_fasta // channel [ meta, path_fasta ]
ch_starindex_ref // channel [ meta, path_index ]
ch_arriba_ref_blacklist // channel [ meta, path_blacklist ]
ch_arriba_ref_known_fusions // channel [ meta, path_known_fusions ]
ch_arriba_ref_cytobands // channel [ meta, path_cytobands ]
ch_arriba_ref_protein_domains // channel [ meta, path_proteins ]
ch_starfusion_ref // channel [ meta, path_starfusion_ref ]
arriba // boolean
all // boolean
fusioninspector_only // boolean
star_ignore_sjdbgtf // boolean
ctatsplicing // boolean
seq_center // string
arriba_fusions // path
cram // array

main:
ch_versions = Channel.empty()
ch_cram_index = Channel.empty()
ch_dummy_file = file("$baseDir/assets/dummy_file_arriba.txt", checkIfExists: true)
ch_dummy_file = file("$projectDir/assets/dummy_file_arriba.txt", checkIfExists: true)

if (( arriba || all ) && !fusioninspector_only) {

Expand All @@ -37,9 +41,18 @@ workflow ARRIBA_WORKFLOW {
'',
seq_center
)

ch_versions = ch_versions.mix(STAR_FOR_ARRIBA.out.versions)

if ( ctatsplicing || all ) {
CTATSPLICING_WORKFLOW(
STAR_FOR_ARRIBA.out.spl_junc_tab,
STAR_FOR_ARRIBA.out.junction,
STAR_FOR_ARRIBA.out.bam_sorted_aligned,
ch_starfusion_ref
)
ch_versions = ch_versions.mix(CTATSPLICING_WORKFLOW.out.versions)
}

if ( arriba_fusions ) {

ch_arriba_fusions = reads.combine( Channel.value( file( arriba_fusions, checkIfExists: true ) ) )
Expand Down
22 changes: 12 additions & 10 deletions subworkflows/local/starfusion_workflow.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ include { SAMTOOLS_VIEW as SAMTOOLS_VIEW_FOR_STARFUSION } from '../../mod
include { STAR_ALIGN as STAR_FOR_STARFUSION } from '../../modules/nf-core/star/align/main'
include { STARFUSION } from '../../modules/local/starfusion/detect/main'

include { CTATSPLICING_WORKFLOW } from './ctatsplicing_workflow'

workflow STARFUSION_WORKFLOW {
take:
reads
Expand All @@ -17,13 +19,10 @@ workflow STARFUSION_WORKFLOW {
def ch_align = Channel.empty()
def ch_starfusion_fusions = Channel.empty()
def bam_sorted_indexed = Channel.empty()
def ch_bam_align_sorted = Channel.empty()
def ch_split_junctions = Channel.empty()
def ch_junctions = Channel.empty()

ch_dummy_file = file("$baseDir/assets/dummy_file_starfusion.txt", checkIfExists: true)

if ((params.starfusion || params.all || params.stringtie || params.ctatsplicing) && !params.fusioninspector_only) {
if ((params.starfusion || params.all || params.stringtie) && !params.fusioninspector_only) {
if (params.starfusion_fusions){
ch_starfusion_fusions = reads.combine(Channel.value(file(params.starfusion_fusions, checkIfExists:true)))
.map { meta, reads, fusions -> [ meta, fusions ] }
Expand All @@ -37,9 +36,15 @@ workflow STARFUSION_WORKFLOW {
bam_sorted_indexed = STAR_FOR_STARFUSION.out.bam_sorted.join(SAMTOOLS_INDEX_FOR_STARFUSION.out.bai)
reads_junction = reads.join(STAR_FOR_STARFUSION.out.junction )

ch_bam_align_sorted = STAR_FOR_STARFUSION.out.bam_sorted_aligned
ch_split_junctions = STAR_FOR_STARFUSION.out.spl_junc_tab
ch_junctions = STAR_FOR_STARFUSION.out.junction
if (params.ctatsplicing || params.all) {
CTATSPLICING_WORKFLOW(
STAR_FOR_STARFUSION.out.spl_junc_tab,
STAR_FOR_STARFUSION.out.junction,
STAR_FOR_STARFUSION.out.bam_sorted_aligned,
ch_starfusion_ref
)
ch_versions = ch_versions.mix(CTATSPLICING_WORKFLOW.out.versions)
}

if (params.cram.contains('starfusion')){
SAMTOOLS_VIEW_FOR_STARFUSION (bam_sorted_indexed, ch_fasta, [] )
Expand Down Expand Up @@ -70,9 +75,6 @@ workflow STARFUSION_WORKFLOW {
star_gene_count = ch_star_gene_count
ch_bam_sorted = ch_align.ifEmpty([[],[]])
ch_bam_sorted_indexed = bam_sorted_indexed.ifEmpty([[],[],[]])
bam_align_sorted = ch_bam_align_sorted
split_junctions = ch_split_junctions
junctions = ch_junctions
versions = ch_versions
}

11 changes: 2 additions & 9 deletions workflows/rnafusion.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
include { TRIM_WORKFLOW } from '../subworkflows/local/trim_workflow'
include { ARRIBA_WORKFLOW } from '../subworkflows/local/arriba_workflow'
include { QC_WORKFLOW } from '../subworkflows/local/qc_workflow'
include { CTATSPLICING_WORKFLOW } from '../subworkflows/local/ctatsplicing_workflow'
include { STARFUSION_WORKFLOW } from '../subworkflows/local/starfusion_workflow'
include { STRINGTIE_WORKFLOW } from '../subworkflows/local/stringtie_workflow/main'
include { FUSIONCATCHER_WORKFLOW } from '../subworkflows/local/fusioncatcher_workflow'
Expand Down Expand Up @@ -100,10 +99,12 @@ workflow RNAFUSION {
ch_arriba_ref_known_fusions,
ch_arriba_ref_cytobands,
ch_arriba_ref_protein_domains,
ch_starfusion_ref,
params.arriba, // boolean
params.all, // boolean
params.fusioninspector_only, // boolean
params.star_ignore_sjdbgtf, // boolean
params.ctatsplicing, // boolean
params.seq_center ?: '', // string
params.arriba_fusions, // path
params.cram // array
Expand Down Expand Up @@ -147,14 +148,6 @@ workflow RNAFUSION {
)
ch_versions = ch_versions.mix(FUSIONREPORT_WORKFLOW.out.versions)

//Run CTAT-splicing
CTATSPLICING_WORKFLOW(
STARFUSION_WORKFLOW.out.split_junctions,
STARFUSION_WORKFLOW.out.junctions,
STARFUSION_WORKFLOW.out.bam_align_sorted,
ch_starfusion_ref
)

//Run fusionInpector
FUSIONINSPECTOR_WORKFLOW (
ch_reads_all,
Expand Down

0 comments on commit 0db19d9

Please sign in to comment.