Skip to content

Commit

Permalink
Merge pull request #642 from FriederikeHanssen/ref_files
Browse files Browse the repository at this point in the history
Small ref file issues for ASCAT, Controlfreec, & CNVKIT
  • Loading branch information
FriederikeHanssen authored Jul 18, 2022
2 parents c43ef33 + ac22900 commit 2614122
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 155 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#618](https://github.com/nf-core/sarek/pull/618) - Fix channel issue with `targets.bed` in prepare_intervals
- [#634](https://github.com/nf-core/sarek/pull/634) - Fix issue with samtools/mosdepth plots in multiqc_report
- [#641](https://github.com/nf-core/sarek/pull/641) - Fix issue with duplicate substring in tools and skip_tools
- [#642](https://github.com/nf-core/sarek/pull/642) - Only unzip ref files if tool is run, only publish ref files if `--save_reference` and simplify CNKit logic
- [#650](https://github.com/nf-core/sarek/pull/650) - Fix intervals checks

### Deprecated
Expand Down
75 changes: 32 additions & 43 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,36 @@ process {
]
}

withName: 'UNZIP_ALLELES|UNZIP_LOCI|UNZIP_GC|UNZIP_RT'{
ext.when = { params.tools && params.tools.split(',').contains('ascat')}
}

withName: 'UNTAR_CHR_DIR'{
ext.when = { params.tools && params.tools.split(',').contains('controlfreec')}
}

withName: 'CNVKIT_ANTITARGET' {
ext.when = { params.tools && params.tools.split(',').contains('cnvkit') }
publishDir = [
enabled: params.save_reference,
mode: params.publish_dir_mode,
path: { "${params.outdir}/reference" },
pattern: "*{bed}"
]
}

withName: 'CNVKIT_REFERENCE' {
ext.prefix = "cnvkit"
ext.when = { params.tools && params.tools.split(',').contains('cnvkit') }
publishDir = [
enabled: params.save_reference,
mode: params.publish_dir_mode,
path: { "${params.outdir}/reference" },
pattern: "*{cnn}"
]
}


// PREPARE INTERVALS

withName: 'CREATE_INTERVALS_BED' {
Expand Down Expand Up @@ -519,8 +549,8 @@ process {
// VARIANT CALLING
process{

// CNVKIT_GERMLINE
withName: 'CNVKIT_BATCH_GERMLINE' {
// CNVKIT
withName: 'CNVKIT_BATCH' {
ext.args = { params.wes ? "--method hybrid --diagram --scatter" : "--method wgs --diagram --scatter" }
ext.when = { params.tools && params.tools.split(',').contains('cnvkit') }
publishDir = [
Expand Down Expand Up @@ -817,36 +847,6 @@ process{
]
}

//CNVKIT
withName: 'CNVKIT_ANTITARGET' {
ext.when = { params.tools && params.tools.split(',').contains('cnvkit') }
publishDir = [
mode: params.publish_dir_mode,
path: { "${params.outdir}/reference" },
pattern: "*{bed}"
]
}

withName: 'CNVKIT_REFERENCE' {
ext.prefix = "cnvkit"
ext.when = { params.tools && params.tools.split(',').contains('cnvkit') }
publishDir = [
mode: params.publish_dir_mode,
path: { "${params.outdir}/reference" },
pattern: "*{cnn}"
]
}

withName: 'CNVKIT_BATCH_TUMORONLY' {
ext.args = { params.wes ? "--method hybrid --diagram --scatter" : "--method wgs --diagram --scatter" }
ext.when = { params.tools && params.tools.split(',').contains('cnvkit') }
publishDir = [
mode: params.publish_dir_mode,
path: { "${params.outdir}/variant_calling/${meta.id}/cnvkit" },
pattern: "*{bed,cnn,cnr,cns,pdf,png}"
]
}

//MANTA
withName: 'MERGE_MANTA_TUMOR' {
ext.prefix = {"${meta.id}.manta.tumor_sv"}
Expand Down Expand Up @@ -1044,17 +1044,6 @@ process{
}
}

//CNVKIT
withName: 'CNVKIT_BATCH_SOMATIC' {
ext.args = { params.wes ? "--method hybrid --diagram --scatter" : "--method wgs --diagram --scatter" }
ext.when = { params.tools && params.tools.split(',').contains('cnvkit') }
publishDir = [
mode: params.publish_dir_mode,
path: { "${params.outdir}/variant_calling/${meta.id}/cnvkit" },
pattern: "*{bed,cnn,cnr,cns,pdf,png}"
]
}

//FREEBAYES
if (params.tools && params.tools.split(',').contains('freebayes')) {
withName: 'NFCORE_SAREK:SAREK:PAIR_VARIANT_CALLING:RUN_FREEBAYES_SOMATIC:FREEBAYES' {
Expand Down
6 changes: 3 additions & 3 deletions subworkflows/local/germline_variant_calling.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// GERMLINE VARIANT CALLING
//

include { RUN_CNVKIT_GERMLINE } from '../nf-core/variantcalling/cnvkit/germline/main.nf'
include { RUN_CNVKIT } from '../nf-core/variantcalling/cnvkit/main.nf'
include { RUN_DEEPVARIANT } from '../nf-core/variantcalling/deepvariant/main.nf'
include { RUN_FREEBAYES } from '../nf-core/variantcalling/freebayes/main.nf'
include { RUN_HAPLOTYPECALLER } from '../nf-core/variantcalling/haplotypecaller/main.nf'
Expand Down Expand Up @@ -85,12 +85,12 @@ workflow GERMLINE_VARIANT_CALLING {
[meta, [], cram]
}

RUN_CNVKIT_GERMLINE(cram_recalibrated_cnvkit_germline,
RUN_CNVKIT(cram_recalibrated_cnvkit_germline,
fasta,
fasta_fai,
intervals_bed_combined,
[])
ch_versions = ch_versions.mix(RUN_CNVKIT_GERMLINE.out.versions)
ch_versions = ch_versions.mix(RUN_CNVKIT.out.versions)
}

// DEEPVARIANT
Expand Down
12 changes: 6 additions & 6 deletions subworkflows/local/pair_variant_calling.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ include { RUN_CONTROLFREEC_SOMATIC } from '../nf-core/variantca
include { RUN_FREEBAYES as RUN_FREEBAYES_SOMATIC } from '../nf-core/variantcalling/freebayes/main.nf'
include { RUN_MANTA_SOMATIC } from '../nf-core/variantcalling/manta/somatic/main.nf'
include { RUN_STRELKA_SOMATIC } from '../nf-core/variantcalling/strelka/somatic/main.nf'
include { RUN_CNVKIT_SOMATIC } from '../nf-core/variantcalling/cnvkit/somatic/main.nf'
include { RUN_CNVKIT } from '../nf-core/variantcalling/cnvkit/main.nf'
include { RUN_MPILEUP as RUN_MPILEUP_NORMAL } from '../nf-core/variantcalling/mpileup/main'
include { RUN_MPILEUP as RUN_MPILEUP_TUMOR } from '../nf-core/variantcalling/mpileup/main'
include { RUN_ASCAT_SOMATIC } from '../nf-core/variantcalling/ascat/main'
Expand Down Expand Up @@ -130,11 +130,11 @@ workflow PAIR_VARIANT_CALLING {
[meta, tumor_cram, normal_cram]
}

RUN_CNVKIT_SOMATIC( cram_pair_cnvkit_somatic,
fasta,
fasta_fai,
intervals_bed_combined,
[])
RUN_CNVKIT( cram_pair_cnvkit_somatic,
fasta,
fasta_fai,
intervals_bed_combined,
[])
}

if (tools.split(',').contains('freebayes')){
Expand Down
32 changes: 21 additions & 11 deletions subworkflows/local/prepare_genome.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

include { BWA_INDEX as BWAMEM1_INDEX } from '../../modules/nf-core/modules/bwa/index/main'
include { BWAMEM2_INDEX } from '../../modules/nf-core/modules/bwamem2/index/main'
include {CNVKIT_ANTITARGET } from '../../modules/nf-core/modules/cnvkit/antitarget/main'
include {CNVKIT_REFERENCE } from '../../modules/nf-core/modules/cnvkit/reference/main'
include { DRAGMAP_HASHTABLE } from '../../modules/nf-core/modules/dragmap/hashtable/main'
include { GATK4_CREATESEQUENCEDICTIONARY } from '../../modules/nf-core/modules/gatk4/createsequencedictionary/main'
include { MSISENSORPRO_SCAN } from '../../modules/nf-core/modules/msisensorpro/scan/main'
Expand All @@ -26,17 +28,18 @@ include { UNZIP as UNZIP_RT } from '../../modules/nf-core/m

workflow PREPARE_GENOME {
take:
ascat_alleles // channel: [optional] ascat allele files
ascat_loci // channel: [optional] ascat loci files
ascat_loci_gc // channel: [optional] ascat gc content file
ascat_loci_rt // channel: [optional] ascat replictiming file
chr_dir // channel: [optional] chromosome files
dbsnp // channel: [optional] dbsnp
fasta // channel: [mandatory] fasta
fasta_fai // channel: [optional] fasta_fai
germline_resource // channel: [optional] germline_resource
known_indels // channel: [optional] known_indels
pon // channel: [optional] pon
ascat_alleles // channel: [optional] ascat allele files
ascat_loci // channel: [optional] ascat loci files
ascat_loci_gc // channel: [optional] ascat gc content file
ascat_loci_rt // channel: [optional] ascat replictiming file
chr_dir // channel: [optional] chromosome files
dbsnp // channel: [optional] dbsnp
fasta // channel: [mandatory] fasta
fasta_fai // channel: [optional] fasta_fai
germline_resource // channel: [optional] germline_resource
intervals_bed_combined // channel: []
known_indels // channel: [optional] known_indels
pon // channel: [optional] pon


main:
Expand All @@ -60,6 +63,10 @@ workflow PREPARE_GENOME {
TABIX_KNOWN_INDELS( known_indels.flatten().map{ it -> [[id:it.baseName], it] } )
TABIX_PON(pon.flatten().map{ it -> [[id:it.baseName], it] })

// prepare a reference for tumor_only mode based on target_baits
CNVKIT_ANTITARGET(intervals_bed_combined.flatten().map{ it -> [[id:it[0].baseName], it] })
CNVKIT_REFERENCE(fasta, intervals_bed_combined, CNVKIT_ANTITARGET.out.bed.map{ meta, bed -> [bed]} )

// prepare ascat reference files
allele_files = ascat_alleles
if (params.ascat_alleles && params.ascat_alleles.endsWith('.zip')) {
Expand Down Expand Up @@ -99,6 +106,8 @@ workflow PREPARE_GENOME {
ch_versions = ch_versions.mix(SAMTOOLS_FAIDX.out.versions)
ch_versions = ch_versions.mix(BWAMEM1_INDEX.out.versions)
ch_versions = ch_versions.mix(BWAMEM2_INDEX.out.versions)
ch_versions = ch_versions.mix(CNVKIT_ANTITARGET.out.versions)
ch_versions = ch_versions.mix(CNVKIT_REFERENCE.out.versions)
ch_versions = ch_versions.mix(GATK4_CREATESEQUENCEDICTIONARY.out.versions)
ch_versions = ch_versions.mix(MSISENSORPRO_SCAN.out.versions)
ch_versions = ch_versions.mix(TABIX_DBSNP.out.versions)
Expand All @@ -118,6 +127,7 @@ workflow PREPARE_GENOME {
msisensorpro_scan = MSISENSORPRO_SCAN.out.list.map{ meta, list -> [list] } // path: genome_msi.list
pon_tbi = TABIX_PON.out.tbi.map{ meta, tbi -> [tbi] }.collect() // path: pon.vcf.gz.tbi
chr_files = chr_files
cnvkit_reference = CNVKIT_REFERENCE.out.cnn
allele_files = allele_files
loci_files = loci_files
gc_file = gc_file
Expand Down
15 changes: 8 additions & 7 deletions subworkflows/local/tumor_variant_calling.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include { GATK_TUMOR_ONLY_SOMATIC_VARIANT_CALLING } from '../../subworkflows/nf-
include { RUN_MANTA_TUMORONLY } from '../nf-core/variantcalling/manta/tumoronly/main.nf'
include { RUN_STRELKA_SINGLE } from '../nf-core/variantcalling/strelka/single/main.nf'
include { RUN_CONTROLFREEC_TUMORONLY } from '../nf-core/variantcalling/controlfreec/tumoronly/main.nf'
include { RUN_CNVKIT_TUMORONLY } from '../nf-core/variantcalling/cnvkit/tumoronly/main.nf'
include { RUN_CNVKIT } from '../nf-core/variantcalling/cnvkit/main.nf'
include { RUN_MPILEUP } from '../nf-core/variantcalling/mpileup/main'
include { RUN_TIDDIT } from '../nf-core/variantcalling/tiddit/main.nf'

Expand All @@ -18,6 +18,7 @@ workflow TUMOR_ONLY_VARIANT_CALLING {
cram_recalibrated // channel: [mandatory] cram
bwa // channel: [optional] bwa
chr_files
cnvkit_reference
dbsnp // channel: [mandatory] dbsnp
dbsnp_tbi // channel: [mandatory] dbsnp_tbi
dict // channel: [mandatory] dict
Expand Down Expand Up @@ -99,13 +100,13 @@ workflow TUMOR_ONLY_VARIANT_CALLING {
[meta, cram, []]
}

RUN_CNVKIT_TUMORONLY ( cram_recalibrated_cnvkit_tumoronly,
fasta,
fasta_fai,
intervals_bed_combined,
[] )
RUN_CNVKIT ( cram_recalibrated_cnvkit_tumoronly,
fasta,
fasta_fai,
[],
cnvkit_reference )

ch_versions = ch_versions.mix(RUN_CNVKIT_TUMORONLY.out.versions)
ch_versions = ch_versions.mix(RUN_CNVKIT.out.versions)
}

if (tools.split(',').contains('freebayes')){
Expand Down

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

28 changes: 0 additions & 28 deletions subworkflows/nf-core/variantcalling/cnvkit/somatic/main.nf

This file was deleted.

41 changes: 0 additions & 41 deletions subworkflows/nf-core/variantcalling/cnvkit/tumoronly/main.nf

This file was deleted.

Loading

0 comments on commit 2614122

Please sign in to comment.