Skip to content

Commit

Permalink
Adjust Neo to fit with alignment subworkflow
Browse files Browse the repository at this point in the history
* add source selection for RNA BAM (samplesheet, alignment subworkflow)
* use appropriate function call to determine present of RNA
* relocate isofox_read_length assignment (wgts and targeted workflows)
  • Loading branch information
scwatts committed Mar 16, 2024
1 parent dcf2261 commit 60f77d8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
28 changes: 20 additions & 8 deletions subworkflows/local/neo_prediction/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ workflow NEO_PREDICTION{
take:
// Sample data
ch_inputs // channel: [mandatory] [ meta ]
ch_tumor_rna_bam // channel: [mandatory] [ meta, bam, bai ]
ch_isofox // channel: [mandatory] [ meta, isofox_dir ]
ch_purple // channel: [mandatory] [ meta, purple_dir ]
ch_sage_somatic_append // channel: [mandatory] [ meta, sage_append_vcf ]
Expand Down Expand Up @@ -60,7 +61,7 @@ workflow NEO_PREDICTION{
ch_finder_inputs_sorted = ch_finder_inputs_selected
.branch { meta, purple_dir, linx_annotation_dir ->

def has_normal_dna = Utils.hasNormalDnaBam(meta)
def has_normal_dna = Utils.hasNormalDna(meta)

def has_runnable_inputs = purple_dir && linx_annotation_dir && has_normal_dna

Expand Down Expand Up @@ -103,13 +104,24 @@ workflow NEO_PREDICTION{
//
// Annotate the fusion-derived neoepitope using Isofox where RNA data is available

// Sort inputs
// Select input sources and sort
// channel: runnable: [ meta, neo_finder_dir, tumor_bam_rna, tumor_bai_rna ]
// channel: skip: [ meta ]
ch_isofox_inputs_sorted = ch_finder_out
.branch { meta, neo_finder_dir ->
runnable: Utils.hasTumorRnaBam(meta)
return [meta, neo_finder_dir, Utils.getTumorRnaBam(meta), Utils.getTumorRnaBai(meta)]
ch_isofox_inputs_sorted = WorkflowOncoanalyser.groupByMeta(
ch_finder_out,
ch_tumor_rna_bam,
)
.map { meta, neo_finder_dir, tumor_bam, tumor_bai ->
return [
meta,
neo_finder_dir,
Utils.selectCurrentOrExisting(tumor_bam, meta, Constants.INPUT.BAM_RNA_TUMOR),
Utils.selectCurrentOrExisting(tumor_bai, meta, Constants.INPUT.BAI_RNA_TUMOR),
]
}
.branch { meta, neo_finder_dir, tumor_bam, tumor_bai ->
runnable: Utils.hasTumorRna(meta)
return [meta, neo_finder_dir, tumor_bam, tumor_bai]
skip: true
return meta
}
Expand All @@ -125,7 +137,7 @@ workflow NEO_PREDICTION{
sample_id: Utils.getTumorDnaSampleName(meta),
]

return [meta_isofox, neo_finder_dir, Utils.getTumorRnaBam(meta), Utils.getTumorRnaBai(meta)]
return [meta_isofox, neo_finder_dir, tumor_bam_rna, tumor_bai_rna]
}

// Run process
Expand Down Expand Up @@ -171,7 +183,7 @@ workflow NEO_PREDICTION{
cancer_type: meta[Constants.InfoField.CANCER_TYPE],
]

if (Utils.hasTumorRnaBam(meta)) {
if (Utils.hasTumorRna(meta)) {
meta_scorer.sample_rna_id = Utils.getTumorRnaSampleName(meta)
}

Expand Down
5 changes: 3 additions & 2 deletions workflows/targeted.nf
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true
// Check mandatory parameters
if (params.input) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' }

// Create Path objects for some input files
// Initial some subworkflow input parameters
linx_gene_id_file = params.linx_gene_id_file ? file(params.linx_gene_id_file) : []
// Used in Isofox subworkflow only
isofox_read_length = params.isofox_read_length !== null ? params.isofox_read_length : Constants.DEFAULT_ISOFOX_READ_LENGTH_TARGETED

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -190,7 +192,6 @@ workflow TARGETED {

isofox_counts = params.isofox_counts ? file(params.isofox_counts) : panel_data.isofox_counts
isofox_gc_ratios = params.isofox_gc_ratios ? file(params.isofox_gc_ratios) : panel_data.isofox_gc_ratios
isofox_read_length = params.isofox_read_length !== null ? params.isofox_read_length : Constants.DEFAULT_ISOFOX_READ_LENGTH_TARGETED

isofox_gene_ids = params.isofox_gene_ids ? file(params.isofox_gene_ids) : panel_data.isofox_gene_ids
isofox_tpm_norm = params.isofox_tpm_norm ? file(params.isofox_tpm_norm) : panel_data.isofox_tpm_norm
Expand Down
8 changes: 5 additions & 3 deletions workflows/wgts.nf
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true
// Check mandatory parameters
if (params.input) { ch_input = file(params.input) } else { exit 1, 'Input samplesheet not specified!' }

// Create Path objects for some input files
// Initial some subworkflow input parameters
linx_gene_id_file = params.linx_gene_id_file ? file(params.linx_gene_id_file) : []
// Used in Isofox and Neo subworkflows
isofox_read_length = params.isofox_read_length !== null ? params.isofox_read_length : Constants.DEFAULT_ISOFOX_READ_LENGTH_WTS

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -193,7 +195,6 @@ workflow WGTS {

isofox_counts = params.isofox_counts ? file(params.isofox_counts) : hmf_data.isofox_counts
isofox_gc_ratios = params.isofox_gc_ratios ? file(params.isofox_gc_ratios) : hmf_data.isofox_gc_ratios
isofox_read_length = params.isofox_read_length !== null ? params.isofox_read_length : Constants.DEFAULT_ISOFOX_READ_LENGTH_WTS

ISOFOX_QUANTIFICATION(
ch_inputs,
Expand Down Expand Up @@ -725,6 +726,7 @@ workflow WGTS {

NEO_PREDICTION(
ch_inputs,
ch_align_rna_tumor_out,
ch_isofox_out,
ch_purple_out,
ch_sage_somatic_append_out,
Expand All @@ -736,7 +738,7 @@ workflow WGTS {
hmf_data.ensembl_data_resources,
hmf_data.neo_resources,
hmf_data.cohort_tpm_medians,
params.isofox_read_length,
isofox_read_length,
)

ch_versions = ch_versions.mix(NEO_PREDICTION.out.versions)
Expand Down

0 comments on commit 60f77d8

Please sign in to comment.