diff --git a/conf/test_full.config b/conf/test_full.config index 0fe2b4f2..249417f7 100644 --- a/conf/test_full.config +++ b/conf/test_full.config @@ -14,28 +14,43 @@ params { config_profile_name = 'Full test profile' config_profile_description = 'Full test dataset to check pipeline function' - // Input data for full size test - input = params.pipelines_testdata_base_path + 'raredisease/testdata/samplesheet_full.csv' - intervals_wgs = params.pipelines_testdata_base_path + 'raredisease/reference/test_full/genome.interval_list' - intervals_y = params.pipelines_testdata_base_path + 'raredisease/reference/test_full/genomeY.interval_list' - target_bed = params.pipelines_testdata_base_path + 'raredisease/reference/test_full/target.bed' - variant_catalog = params.pipelines_testdata_base_path + 'raredisease/reference/test_full/variant_catalog_hg38.json' - // Genome references - genome = 'GRCh38' + // reference params + igenomes_ignore = true + mito_name = 'MT' - // Skip annotation - skip_mt_annotation = true - skip_snv_annotation = true - skip_sv_annotation = true -} + // analysis params + skip_germlinecnvcaller = true + skip_peddy = true -process { - withName: 'MARKDUPLICATES' { - memory = { check_max( 90.GB * task.attempt, 'memory' ) } - } - withName: 'DEEPVARIANT' { - cpus = 24 - memory = { check_max( 90.GB * task.attempt, 'memory' ) } - } + // Input data + input = params.pipelines_testdata_base_path + 'raredisease/testdata/samplesheet_trio.csv' + + // Genome references + fasta = params.pipelines_testdata_base_path + 'raredisease/reference/reference.fasta' + fai = params.pipelines_testdata_base_path + 'raredisease/reference/reference.fasta.fai' + genome = 'GRCh37' + gnomad_af = params.pipelines_testdata_base_path + 'raredisease/reference/gnomad_reformated.tab.gz' + intervals_wgs = params.pipelines_testdata_base_path + 'raredisease/reference/target_wgs.interval_list' + intervals_y = params.pipelines_testdata_base_path + 'raredisease/reference/targetY.interval_list' + known_dbsnp = params.pipelines_testdata_base_path + 'raredisease/reference/dbsnp_-138-.vcf.gz' + ml_model = 'https://s3.amazonaws.com/sentieon-release/other/SentieonDNAscopeModel1.1.model' + mobile_element_references = params.pipelines_testdata_base_path + 'raredisease/reference/mobile_element_references.tsv' + mobile_element_svdb_annotations = params.pipelines_testdata_base_path + 'raredisease/reference/svdb_querydb_files.csv' + reduced_penetrance = params.pipelines_testdata_base_path + 'raredisease/reference/reduced_penetrance.tsv' + score_config_mt = params.pipelines_testdata_base_path + 'raredisease/reference/rank_model_snv.ini' + score_config_snv = params.pipelines_testdata_base_path + 'raredisease/reference/rank_model_snv.ini' + score_config_sv = params.pipelines_testdata_base_path + 'raredisease/reference/rank_model_sv.ini' + svdb_query_dbs = params.pipelines_testdata_base_path + 'raredisease/reference/svdb_querydb_files.csv' + target_bed = params.pipelines_testdata_base_path + 'raredisease/reference/target.bed' + variant_catalog = params.pipelines_testdata_base_path + 'raredisease/reference/variant_catalog.json' + vcfanno_lua = params.pipelines_testdata_base_path + 'raredisease/reference/vcfanno_functions.lua' + vcfanno_resources = params.pipelines_testdata_base_path + 'raredisease/reference/vcfanno_resources.txt' + vcfanno_toml = params.pipelines_testdata_base_path + 'raredisease/reference/vcfanno_config.toml' + variant_consequences_snv = params.pipelines_testdata_base_path + 'raredisease/reference/variant_consequences_v2.txt' + variant_consequences_sv = params.pipelines_testdata_base_path + 'raredisease/reference/variant_consequences_v2.txt' + vep_cache = params.pipelines_testdata_base_path + 'raredisease/reference/vep_cache_and_plugins.tar.gz' + vep_filters = params.pipelines_testdata_base_path + 'raredisease/reference/hgnc.txt' + vep_cache_version = 107 + vep_plugin_files = params.pipelines_testdata_base_path + 'raredisease/reference/vep_files.csv' } diff --git a/lib/CustomFunctions.groovy b/lib/CustomFunctions.groovy deleted file mode 100644 index 00680f09..00000000 --- a/lib/CustomFunctions.groovy +++ /dev/null @@ -1,43 +0,0 @@ -import nextflow.Nextflow - -class CustomFunctions { - - // Helper function to check if a value is neither 0, "0", nor "" - private static boolean isNonZeroNonEmpty(value) { - return (value instanceof String && value != "" && value != "0") || - (value instanceof Number && value != 0) - } - - // Function to get a list of metadata (e.g. case id) for the case [ meta ] - public static LinkedHashMap createCaseChannel(List rows) { - def case_info = [:] - def probands = [] as Set - def upd_children = [] as Set - def father = "" - def mother = "" - - rows.each { item -> - if (item?.phenotype == 2) { - probands << item.sample - } - if (isNonZeroNonEmpty(item?.paternal) && isNonZeroNonEmpty(item?.maternal)) { - upd_children << item.sample - } - if (isNonZeroNonEmpty(item?.paternal)) { - father = item.paternal - } - if (isNonZeroNonEmpty(item?.maternal)) { - mother = item.maternal - } - } - - case_info.father = father - case_info.mother = mother - case_info.probands = probands.toList() - case_info.upd_children = upd_children.toList() - case_info.id = rows[0].case_id - - return case_info - } - -} diff --git a/main.nf b/main.nf index f8066532..ddc1a354 100644 --- a/main.nf +++ b/main.nf @@ -34,6 +34,8 @@ workflow NFCORE_RAREDISEASE { take: samplesheet // channel: samplesheet read in from --input + samples + case_info main: @@ -41,7 +43,9 @@ workflow NFCORE_RAREDISEASE { // WORKFLOW: Run pipeline // RAREDISEASE ( - samplesheet + samplesheet, + samples, + case_info ) emit: multiqc_report = RAREDISEASE.out.multiqc_report // channel: /path/to/multiqc_report.html @@ -71,7 +75,9 @@ workflow { // WORKFLOW: Run main workflow // NFCORE_RAREDISEASE ( - PIPELINE_INITIALISATION.out.samplesheet + PIPELINE_INITIALISATION.out.samplesheet, + PIPELINE_INITIALISATION.out.samples, + PIPELINE_INITIALISATION.out.case_info ) // // SUBWORKFLOW: Run completion tasks diff --git a/modules/local/add_most_severe_consequence.nf b/modules/local/add_most_severe_consequence/main.nf similarity index 100% rename from modules/local/add_most_severe_consequence.nf rename to modules/local/add_most_severe_consequence/main.nf diff --git a/modules/local/add_most_severe_pli.nf b/modules/local/add_most_severe_pli/main.nf similarity index 100% rename from modules/local/add_most_severe_pli.nf rename to modules/local/add_most_severe_pli/main.nf diff --git a/modules/local/add_varcallername_to_bed.nf b/modules/local/add_varcallername_to_bed/main.nf similarity index 100% rename from modules/local/add_varcallername_to_bed.nf rename to modules/local/add_varcallername_to_bed/main.nf diff --git a/modules/local/calculate_seed_fraction.nf b/modules/local/calculate_seed_fraction/main.nf similarity index 100% rename from modules/local/calculate_seed_fraction.nf rename to modules/local/calculate_seed_fraction/main.nf diff --git a/modules/local/create_bed_from_fai.nf b/modules/local/create_bed_from_fai/main.nf similarity index 100% rename from modules/local/create_bed_from_fai.nf rename to modules/local/create_bed_from_fai/main.nf diff --git a/modules/local/create_hgncids_file.nf b/modules/local/create_hgncids_file/main.nf similarity index 100% rename from modules/local/create_hgncids_file.nf rename to modules/local/create_hgncids_file/main.nf diff --git a/modules/local/create_pedigree_file.nf b/modules/local/create_pedigree_file/main.nf similarity index 100% rename from modules/local/create_pedigree_file.nf rename to modules/local/create_pedigree_file/main.nf diff --git a/modules/local/get_chrom_sizes.nf b/modules/local/get_chrom_sizes/main.nf similarity index 100% rename from modules/local/get_chrom_sizes.nf rename to modules/local/get_chrom_sizes/main.nf diff --git a/modules/local/mt_deletion_script.nf b/modules/local/mt_deletion_script/main.nf similarity index 100% rename from modules/local/mt_deletion_script.nf rename to modules/local/mt_deletion_script/main.nf diff --git a/modules/local/rename_align_files.nf b/modules/local/rename_align_files/main.nf similarity index 100% rename from modules/local/rename_align_files.nf rename to modules/local/rename_align_files/main.nf diff --git a/modules/local/replace_spaces_in_vcfinfo.nf b/modules/local/replace_spaces_in_vcfinfo/main.nf similarity index 100% rename from modules/local/replace_spaces_in_vcfinfo.nf rename to modules/local/replace_spaces_in_vcfinfo/main.nf diff --git a/modules/local/sentieon/tnscope.nf b/modules/local/sentieon/tnscope.nf deleted file mode 100644 index c4857dc6..00000000 --- a/modules/local/sentieon/tnscope.nf +++ /dev/null @@ -1,52 +0,0 @@ -process SENTIEON_TNSCOPE { - tag "$meta.id" - label 'process_high' - label 'sentieon' - - input: - tuple val(meta), path(bam), path(bai) - tuple val(meta2), path(fasta) - tuple val(meta3), path(fai) - - output: - tuple val(meta), path("*vcf.gz") , emit: vcf - tuple val(meta), path("*vcf.gz.tbi"), emit: vcf_index - path "versions.yml" , emit: versions - - when: - task.ext.when == null || task.ext.when - - script: - def interval = task.ext.args ?: '' - def call_settings = task.ext.args2 ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - - """ - sentieon driver \\ - -t $task.cpus \\ - -r $fasta \\ - -i $bam \\ - $interval \\ - --algo TNscope \\ - --tumor_sample ${meta.id} \\ - $call_settings \\ - ${prefix}.vcf.gz - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - sentieon: \$(echo \$(sentieon driver --version 2>&1) | sed -e "s/sentieon-genomics-//g") - END_VERSIONS - """ - - stub: - def prefix = task.ext.prefix ?: "${meta.id}" - """ - touch ${prefix}.vcf.gz - touch ${prefix}.vcf.gz.tbi - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - sentieon: \$(echo \$(sentieon driver --version 2>&1) | sed -e "s/sentieon-genomics-//g" ) - END_VERSIONS - """ -} diff --git a/subworkflows/local/align.nf b/subworkflows/local/align.nf index 496648f4..dc337821 100644 --- a/subworkflows/local/align.nf +++ b/subworkflows/local/align.nf @@ -3,12 +3,12 @@ // include { FASTP } from '../../modules/nf-core/fastp/main' -include { ALIGN_BWA_BWAMEM2_BWAMEME } from './alignment/align_bwa_bwamem2_bwameme' -include { ALIGN_SENTIEON } from './alignment/align_sentieon' +include { ALIGN_BWA_BWAMEM2_BWAMEME } from './align_bwa_bwamem2_bwameme' +include { ALIGN_SENTIEON } from './align_sentieon' include { SAMTOOLS_VIEW } from '../../modules/nf-core/samtools/view/main' -include { ALIGN_MT } from './alignment/align_MT' -include { ALIGN_MT as ALIGN_MT_SHIFT } from './alignment/align_MT' -include { CONVERT_MT_BAM_TO_FASTQ } from './mitochondria/convert_mt_bam_to_fastq' +include { ALIGN_MT } from './align_MT' +include { ALIGN_MT as ALIGN_MT_SHIFT } from './align_MT' +include { CONVERT_MT_BAM_TO_FASTQ } from './convert_mt_bam_to_fastq' workflow ALIGN { take: diff --git a/subworkflows/local/alignment/align_MT.nf b/subworkflows/local/align_MT/main.nf similarity index 100% rename from subworkflows/local/alignment/align_MT.nf rename to subworkflows/local/align_MT/main.nf diff --git a/subworkflows/local/alignment/align_bwa_bwamem2_bwameme.nf b/subworkflows/local/align_bwa_bwamem2_bwameme/main.nf similarity index 100% rename from subworkflows/local/alignment/align_bwa_bwamem2_bwameme.nf rename to subworkflows/local/align_bwa_bwamem2_bwameme/main.nf diff --git a/subworkflows/local/alignment/align_sentieon.nf b/subworkflows/local/align_sentieon/main.nf similarity index 100% rename from subworkflows/local/alignment/align_sentieon.nf rename to subworkflows/local/align_sentieon/main.nf diff --git a/subworkflows/local/annotation/annotate_cadd.nf b/subworkflows/local/annotate_cadd/main.nf similarity index 100% rename from subworkflows/local/annotation/annotate_cadd.nf rename to subworkflows/local/annotate_cadd/main.nf diff --git a/subworkflows/local/annotate_genome_snvs.nf b/subworkflows/local/annotate_genome_snvs.nf index 396e2614..c581d63c 100644 --- a/subworkflows/local/annotate_genome_snvs.nf +++ b/subworkflows/local/annotate_genome_snvs.nf @@ -18,8 +18,8 @@ include { TABIX_TABIX as TABIX_VEP } from '../../modules/nf-core/ta include { TABIX_TABIX as TABIX_BCFTOOLS_CONCAT } from '../../modules/nf-core/tabix/tabix/main' include { TABIX_TABIX as TABIX_BCFTOOLS_VIEW } from '../../modules/nf-core/tabix/tabix/main' include { GATK4_SELECTVARIANTS } from '../../modules/nf-core/gatk4/selectvariants/main' -include { ANNOTATE_CADD } from './annotation/annotate_cadd' -include { ANNOTATE_RHOCALLVIZ } from './annotation/annotate_rhocallviz' +include { ANNOTATE_CADD } from './annotate_cadd' +include { ANNOTATE_RHOCALLVIZ } from './annotate_rhocallviz' workflow ANNOTATE_GENOME_SNVS { diff --git a/subworkflows/local/annotate_mt_snvs.nf b/subworkflows/local/annotate_mt_snvs.nf index d2a82879..1879d9dd 100644 --- a/subworkflows/local/annotate_mt_snvs.nf +++ b/subworkflows/local/annotate_mt_snvs.nf @@ -8,7 +8,7 @@ include { TABIX_BGZIPTABIX as ZIP_TABIX_HMTNOTE_MT } from '../../modules/n include { ENSEMBLVEP_VEP as ENSEMBLVEP_MT } from '../../modules/nf-core/ensemblvep/vep/main' include { HAPLOGREP2_CLASSIFY as HAPLOGREP2_CLASSIFY_MT } from '../../modules/nf-core/haplogrep2/classify/main' include { VCFANNO as VCFANNO_MT } from '../../modules/nf-core/vcfanno/main' -include { ANNOTATE_CADD } from './annotation/annotate_cadd' +include { ANNOTATE_CADD } from './annotate_cadd' include { TABIX_BGZIPTABIX as ZIP_TABIX_VCFANNO_MT } from '../../modules/nf-core/tabix/bgziptabix/main' include { HMTNOTE_ANNOTATE } from '../../modules/nf-core/hmtnote/annotate/main' diff --git a/subworkflows/local/annotation/annotate_rhocallviz.nf b/subworkflows/local/annotate_rhocallviz/main.nf similarity index 100% rename from subworkflows/local/annotation/annotate_rhocallviz.nf rename to subworkflows/local/annotate_rhocallviz/main.nf diff --git a/subworkflows/local/call_snv.nf b/subworkflows/local/call_snv.nf index 3e541d42..36be79e9 100644 --- a/subworkflows/local/call_snv.nf +++ b/subworkflows/local/call_snv.nf @@ -2,11 +2,11 @@ // call Single-nucleotide Varinats // -include { CALL_SNV_DEEPVARIANT } from './variant_calling/call_snv_deepvariant' -include { CALL_SNV_SENTIEON } from './variant_calling/call_snv_sentieon' -include { CALL_SNV_MT } from './variant_calling/call_snv_MT' -include { CALL_SNV_MT as CALL_SNV_MT_SHIFT } from './variant_calling/call_snv_MT' -include { POSTPROCESS_MT_CALLS } from './variant_calling/postprocess_MT_calls' +include { CALL_SNV_DEEPVARIANT } from './call_snv_deepvariant' +include { CALL_SNV_SENTIEON } from './call_snv_sentieon' +include { CALL_SNV_MT } from './call_snv_MT' +include { CALL_SNV_MT as CALL_SNV_MT_SHIFT } from './call_snv_MT' +include { POSTPROCESS_MT_CALLS } from './postprocess_MT_calls' include { GATK4_SELECTVARIANTS } from '../../modules/nf-core/gatk4/selectvariants/main' workflow CALL_SNV { diff --git a/subworkflows/local/variant_calling/call_snv_MT.nf b/subworkflows/local/call_snv_MT/main.nf similarity index 100% rename from subworkflows/local/variant_calling/call_snv_MT.nf rename to subworkflows/local/call_snv_MT/main.nf diff --git a/subworkflows/local/variant_calling/call_snv_deepvariant.nf b/subworkflows/local/call_snv_deepvariant/main.nf similarity index 100% rename from subworkflows/local/variant_calling/call_snv_deepvariant.nf rename to subworkflows/local/call_snv_deepvariant/main.nf diff --git a/subworkflows/local/variant_calling/call_snv_sentieon.nf b/subworkflows/local/call_snv_sentieon/main.nf similarity index 100% rename from subworkflows/local/variant_calling/call_snv_sentieon.nf rename to subworkflows/local/call_snv_sentieon/main.nf diff --git a/subworkflows/local/call_structural_variants.nf b/subworkflows/local/call_structural_variants.nf index 960e2ca4..db8c0443 100644 --- a/subworkflows/local/call_structural_variants.nf +++ b/subworkflows/local/call_structural_variants.nf @@ -2,12 +2,12 @@ // A nested subworkflow to call structural variants. // -include { CALL_SV_MANTA } from './variant_calling/call_sv_manta' -include { CALL_SV_MT } from './variant_calling/call_sv_MT' -include { CALL_SV_TIDDIT } from './variant_calling/call_sv_tiddit' +include { CALL_SV_MANTA } from './call_sv_manta' +include { CALL_SV_MT } from './call_sv_MT' +include { CALL_SV_TIDDIT } from './call_sv_tiddit' include { SVDB_MERGE } from '../../modules/nf-core/svdb/merge/main' -include { CALL_SV_GERMLINECNVCALLER } from './variant_calling/call_sv_germlinecnvcaller' -include { CALL_SV_CNVNATOR } from './variant_calling/call_sv_cnvnator' +include { CALL_SV_GERMLINECNVCALLER } from './call_sv_germlinecnvcaller' +include { CALL_SV_CNVNATOR } from './call_sv_cnvnator' include { TABIX_TABIX } from '../../modules/nf-core/tabix/tabix/main' workflow CALL_STRUCTURAL_VARIANTS { diff --git a/subworkflows/local/variant_calling/call_sv_MT.nf b/subworkflows/local/call_sv_MT/main.nf similarity index 100% rename from subworkflows/local/variant_calling/call_sv_MT.nf rename to subworkflows/local/call_sv_MT/main.nf diff --git a/subworkflows/local/variant_calling/call_sv_cnvnator.nf b/subworkflows/local/call_sv_cnvnator/main.nf similarity index 100% rename from subworkflows/local/variant_calling/call_sv_cnvnator.nf rename to subworkflows/local/call_sv_cnvnator/main.nf diff --git a/subworkflows/local/variant_calling/call_sv_germlinecnvcaller.nf b/subworkflows/local/call_sv_germlinecnvcaller/main.nf similarity index 100% rename from subworkflows/local/variant_calling/call_sv_germlinecnvcaller.nf rename to subworkflows/local/call_sv_germlinecnvcaller/main.nf diff --git a/subworkflows/local/variant_calling/call_sv_manta.nf b/subworkflows/local/call_sv_manta/main.nf similarity index 100% rename from subworkflows/local/variant_calling/call_sv_manta.nf rename to subworkflows/local/call_sv_manta/main.nf diff --git a/subworkflows/local/variant_calling/call_sv_tiddit.nf b/subworkflows/local/call_sv_tiddit/main.nf similarity index 100% rename from subworkflows/local/variant_calling/call_sv_tiddit.nf rename to subworkflows/local/call_sv_tiddit/main.nf diff --git a/subworkflows/local/mitochondria/convert_mt_bam_to_fastq.nf b/subworkflows/local/convert_mt_bam_to_fastq/main.nf similarity index 100% rename from subworkflows/local/mitochondria/convert_mt_bam_to_fastq.nf rename to subworkflows/local/convert_mt_bam_to_fastq/main.nf diff --git a/subworkflows/local/variant_calling/postprocess_MT_calls.nf b/subworkflows/local/postprocess_MT_calls/main.nf similarity index 100% rename from subworkflows/local/variant_calling/postprocess_MT_calls.nf rename to subworkflows/local/postprocess_MT_calls/main.nf diff --git a/subworkflows/local/utils_nfcore_raredisease_pipeline/main.nf b/subworkflows/local/utils_nfcore_raredisease_pipeline/main.nf index 24e7ed73..ec092c2f 100644 --- a/subworkflows/local/utils_nfcore_raredisease_pipeline/main.nf +++ b/subworkflows/local/utils_nfcore_raredisease_pipeline/main.nf @@ -102,8 +102,19 @@ workflow PIPELINE_INITIALISATION { } .set { ch_samplesheet } + ch_samples = ch_samplesheet.map { meta, fastqs -> + new_id = meta.sample + new_meta = meta - meta.subMap('lane', 'read_group') + [id:new_id] + return new_meta + }.unique() + + ch_case_info = ch_samples.toList().map { createCaseChannel(it) } + + emit: samplesheet = ch_samplesheet + samples = ch_samples + case_info = ch_case_info versions = ch_versions } @@ -160,6 +171,44 @@ workflow PIPELINE_COMPLETION { FUNCTIONS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + +def boolean isNonZeroNonEmpty(value) { + return (value instanceof String && value != "" && value != "0") || + (value instanceof Number && value != 0) + } + + // Function to get a list of metadata (e.g. case id) for the case [ meta ] +def createCaseChannel(List rows) { + def case_info = [:] + def probands = [] as Set + def upd_children = [] as Set + def father = "" + def mother = "" + + rows.each { item -> + if (item?.phenotype == 2) { + probands << item.sample + } + if (isNonZeroNonEmpty(item?.paternal) && isNonZeroNonEmpty(item?.maternal)) { + upd_children << item.sample + } + if (isNonZeroNonEmpty(item?.paternal)) { + father = item.paternal + } + if (isNonZeroNonEmpty(item?.maternal)) { + mother = item.maternal + } + } + + case_info.father = father + case_info.mother = mother + case_info.probands = probands.toList() + case_info.upd_children = upd_children.toList() + case_info.id = rows[0].case_id + + return case_info +} + // // Check and validate pipeline parameters // diff --git a/workflows/raredisease.nf b/workflows/raredisease.nf index b606e17d..5a99a704 100644 --- a/workflows/raredisease.nf +++ b/workflows/raredisease.nf @@ -175,19 +175,14 @@ workflow RAREDISEASE { take: ch_samplesheet // channel: samplesheet read in from --input + ch_samples + ch_case_info + main: ch_versions = Channel.empty() ch_multiqc_files = Channel.empty() - ch_samples = ch_samplesheet.map { meta, fastqs -> - new_id = meta.sample - new_meta = meta - meta.subMap('lane', 'read_group') + [id:new_id] - return new_meta - }.unique() - - ch_case_info = ch_samples.toList().map { CustomFunctions.createCaseChannel(it) } - // // Initialize file channels for PREPARE_REFERENCES subworkflow //