Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented TMB score calculation #1738

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions assets/tmb/mutect2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Describe the fields
## For definition, provide the expected key:values
## Note that several keys/values can be defined
##
###############################################

freq: "AF"
depth: "DP"
altDepth: "AD"
maxVaf: "1"
119 changes: 119 additions & 0 deletions assets/tmb/snpeff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
## Describe the fields
## For definition, provide the expected key:values
## Note that several keys/values can be defined

###############################################
## SnpEff Parsing

## Tags
tag: "ANN"
sep: "&"

## Annotation flags

isCoding:
1:
- chromosome_number_variation
- coding_sequence_variant
- conservative_inframe_deletion
- conservative_inframe_insertion
- disruptive_inframe_deletion
- disruptive_inframe_insertion
- exon_loss
- exon_loss_variant
- exon_variant
- frameshift_variant
- gene_variant
- initiator_codon_variant
- missense_variant
- rare_amino_acid_variant
- splice_acceptor_variant
- splice_donor_variant
- splice_region_variant
- start_lost
- start_retained
- stop_gained
- stop_lost
- stop_retained_variant
- synonymous_variant
- transcript_ablation
- transcript_amplification
- transcript_variant

isNonCoding:
1:
- 3_prime_UTR_truncation
- 3_prime_UTR_variant
- 5_prime_UTR_premature_start_codon_gain_variant
- 5_prime_UTR_truncation
- 5_prime_UTR_variant
- conserved_intergenic_variant
- conserved_intron_variant
- downstream_gene_variant
- feature_elongation
- feature_truncation
- intergenic_region
- intragenic_variant
- intron_variant
- mature_miRNA_variant
- miRNA
- NMD_transcript_variant
- non_coding_transcript_exon_variant
- non_coding_transcript_variant
- regulatory_region_ablation
- regulatory_region_amplification
- regulatory_region_variant
- TF_binding_site_variant
- TFBS_ablation
- TFBS_amplification
- upstream_gene_variant

isSplicing:
1:
- splice_donor_variant
- splice_acceptor_variant
- splice_region_variant

isSynonymous:
1:
- start_retained_variant
- stop_retained_variant
- synonymous_variant

isNonSynonymous:
1:
- frameshift_variant
- missense_variant
- rare_amino_acid_variant
- splice_acceptor_variant
- splice_donor_variant
- splice_region_variant
- start_lost
- stop_gained
- stop_lost

## Databases
cancerDb:
cosmic:
- cosmic_coding_ID
- cosmic_noncoding_ID

polymDb:
1k:
- kg_AMR_AF
- kg_AFR_AF
- kg_EAS_AF
- kg_EUR_AF
- kg_SAS_AF
- KG_AF_GLOBAL

gnomad:
- GnomAD
- gnomAD_genomes_AF
- AF

esp:
- ESP_AF_GLOBAL

dbsnp:
- dbSNPBuildID
10 changes: 10 additions & 0 deletions assets/tmb/strelka.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Describe the fields
## For definition, provide the expected key:values
## Note that several keys/values can be defined
##
###############################################

freq: "AF"
depth: "DP"
altDepth: "AD"
maxVaf: "1"
10 changes: 10 additions & 0 deletions conf/modules/msisensorpro.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ process {
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'MSISENSORPRO_MSITUMORONLY' {
ext.args = { params.wes ? '-c 20' : '-c 15' } // default values by MSIsensorpro
ext.prefix = { "${meta.id}.tumor_only" }
publishDir = [
mode: params.publish_dir_mode,
path: { "${params.outdir}/variant_calling/msisensorpro/${meta.id}/" },
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
}
52 changes: 52 additions & 0 deletions conf/modules/tmb.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Config file for defining DSL2 per module options and publishing paths
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Available keys to override module options:
ext.args = Additional arguments appended to command in module.
ext.args2 = Second set of arguments appended to command in module (multi-tool modules).
ext.args3 = Third set of arguments appended to command in module (multi-tool modules).
ext.prefix = File name prefix for output files.
ext.when = When to run the module.
----------------------------------------------------------------------------------------
*/

// TMB

process {

withName: 'BCFTOOLS_NORM' {
ext.args = { "-m- -c w" }
ext.prefix = { vcf.baseName - ".vcf" + ".norm" }
ext.when = { meta.dbconfig && meta.varconfig }
publishDir = [
mode: params.publish_dir_mode,
path: { "${params.outdir}/variant_calling/tmb/${meta.id}/" },
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}

withName: 'TMB' {
ext.args = { [
"--sample ${meta.patient}_${meta.sample}",
params.tmb_effgenomesize ? "--effGenomeSize ${params.tmb_effgenomesize}" : '',
'--vaf 0.05',
'--maf 1',
'--minDepth 100',
'--minAltDepth 2',
'--filterLowQual',
'--filterNonCoding',
'--filterSyn',
'--filterPolym',
'--polymDb 1k,gnomad,dbsnp'
].join(' ').trim()
}
ext.prefix = { vcf.baseName }
ext.when = { dbconfig && varconfig }
publishDir = [
mode: params.publish_dir_mode,
path: { "${params.outdir}/variant_calling/tmb/${meta.id}/" },
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
}
19 changes: 16 additions & 3 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nf
include { PREPARE_GENOME } from './subworkflows/local/prepare_genome'
include { PREPARE_INTERVALS } from './subworkflows/local/prepare_intervals'
include { PREPARE_REFERENCE_CNVKIT } from './subworkflows/local/prepare_reference_cnvkit'
include { MSISENSORPRO_SCAN } from './modules/nf-core/msisensorpro/scan/main'

// Initialize fasta file with meta map:
fasta = params.fasta ? Channel.fromPath(params.fasta).map{ it -> [ [id:it.baseName], it ] }.collect() : Channel.empty()
Expand All @@ -91,6 +92,7 @@ germline_resource = params.germline_resource ? Channel.fromPath(para
known_indels = params.known_indels ? Channel.fromPath(params.known_indels).collect() : Channel.value([])
known_snps = params.known_snps ? Channel.fromPath(params.known_snps).collect() : Channel.value([])
mappability = params.mappability ? Channel.fromPath(params.mappability).collect() : Channel.value([])
msisensorpro_baseline = params.msisensorpro_baseline ? Channel.fromPath(params.msisensorpro_baseline).collect() : Channel.empty()
pon = params.pon ? Channel.fromPath(params.pon).collect() : Channel.value([]) // PON is optional for Mutect2 (but highly recommended)
sentieon_dnascope_model = params.sentieon_dnascope_model ? Channel.fromPath(params.sentieon_dnascope_model).collect() : Channel.value([])

Expand Down Expand Up @@ -166,8 +168,18 @@ workflow NFCORE_SAREK {
aligner == "bwa-mem2" ? bwamem2 :
dragmap

// TODO: add a params for msisensorpro_scan
msisensorpro_scan = PREPARE_GENOME.out.msisensorpro_scan
// Reference msi list for MSIsensorpro
if (params.tools && params.tools.split(',').contains('msisensorpro')) {
if (params.msisensorpro_scan) {
msisensorpro_scan = Channel.fromPath(params.msisensorpro_scan).collect()
} else {
MSISENSORPRO_SCAN(fasta)
msisensorpro_scan = MSISENSORPRO_SCAN.out.list.map{ meta, list -> [list] }
versions = versions.mix(MSISENSORPRO_SCAN.out.versions)
}
} else {
msisensorpro_scan = Channel.empty()
}

// For ASCAT, extracted from zip or tar.gz files
allele_files = PREPARE_GENOME.out.allele_files
Expand All @@ -177,7 +189,7 @@ workflow NFCORE_SAREK {
rt_file = PREPARE_GENOME.out.rt_file

// Tabix indexed vcf files
bcftools_annotations_tbi = params.bcftools_annotations ? params.bcftools_annotations_tbi ? Channel.fromPath(params.bcftools_annotations_tbi).collect() : PREPARE_GENOME.out.bcftools_annotations_tbi : Channel.empty([])
bcftools_annotations_tbi = params.bcftools_annotations ? params.bcftools_annotations_tbi ? Channel.fromPath(params.bcftools_annotations_tbi).collect() : PREPARE_GENOME.out.bcftools_annotations_tbi : Channel.value([])
dbsnp_tbi = params.dbsnp ? params.dbsnp_tbi ? Channel.fromPath(params.dbsnp_tbi).collect() : PREPARE_GENOME.out.dbsnp_tbi : Channel.value([])
germline_resource_tbi = params.germline_resource ? params.germline_resource_tbi ? Channel.fromPath(params.germline_resource_tbi).collect() : PREPARE_GENOME.out.germline_resource_tbi : [] //do not change to Channel.value([]), the check for its existence then fails for Getpileupsumamries
known_indels_tbi = params.known_indels ? params.known_indels_tbi ? Channel.fromPath(params.known_indels_tbi).collect() : PREPARE_GENOME.out.known_indels_tbi : Channel.value([])
Expand Down Expand Up @@ -296,6 +308,7 @@ workflow NFCORE_SAREK {
loci_files,
mappability,
msisensorpro_scan,
msisensorpro_baseline,
ngscheckmate_bed,
pon,
pon_tbi,
Expand Down
5 changes: 5 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"git_sha": "a5ba4d59c2b248c0379b0f8aeb4e7e754566cd1f",
"installed_by": ["bam_ngscheckmate"]
},
"bcftools/norm": {
"branch": "master",
"git_sha": "33ef773a7ea36e88323902f63662aa53c9b88988",
"installed_by": ["modules"]
},
"bcftools/sort": {
"branch": "master",
"git_sha": "a5ba4d59c2b248c0379b0f8aeb4e7e754566cd1f",
Expand Down
7 changes: 7 additions & 0 deletions modules/local/tmb/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: tmb
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::tmb=1.3.0
41 changes: 41 additions & 0 deletions modules/local/tmb/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
process TMB {
tag "$meta.id"
label 'process_low'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/tmb:1.3.0--pyh5e36f6f_0':
'quay.io/biocontainers/tmb:1.3.0--pyh5e36f6f_0' }"

input:
tuple val(meta), path(vcf), path(dbconfig), path(varconfig)
path (intervals)

output:
tuple val(meta), path("*.log"), emit: log
path("*_export.vcf") , emit: vcf
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def intervals_bed = intervals ? "--bed ${intervals}" : ''
def target_region = args.contains("--effGenomeSize") ? '' : intervals_bed
"""
pyTMB.py -i ${vcf} \\
--dbConfig ${dbconfig} \\
--varConfig ${varconfig} \\
${target_region} \\
${args} \\
--export \\
> ${prefix}.tmb.log

cat <<-END_VERSIONS > versions.yml
"${task.process}":
tmb: \$(echo \$(pyTMB.py --version 2>&1) | sed 's/^.*pyTMB.py //; s/.*\$//' | sed 's|[()]||g')
END_VERSIONS
"""
}
2 changes: 0 additions & 2 deletions modules/nf-core/ascat/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions modules/nf-core/bcftools/norm/environment.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading