diff --git a/assets/nf-test_full.config b/assets/nf-test_full.config new file mode 100644 index 0000000..6744f97 --- /dev/null +++ b/assets/nf-test_full.config @@ -0,0 +1,38 @@ +config { + // location for all nf-test tests + testsDir = "." + + // nf-test directory including temporary files for each test + workDir = System.getenv("NFT_WORKDIR") ?: ".nf-test" + + // location of an optional nextflow.config file specific for executing tests + configFile = "assets/oncoflow_test_full.config" + + // ignore tests coming from the nf-core/modules repo + ignore = [ + 'modules/nf-core/**/tests/*', + 'subworkflows/nf-core/**/tests/*', + ] + + // run all test with defined profile(s) from the main nextflow.config + profile = "test_full" + + // list of filenames or patterns that should be trigger a full test run + triggers = [ + '.github/actions/nf-test/action.yml', + '.github/workflows/nf-test.yml', + 'assets/schema_input.json', + 'bin/*', + 'conf/test.config', + 'nextflow.config', + 'nextflow_schema.json', + 'nf-test.config', + 'tests/.nftignore', + 'tests/nextflow.config', + ] + + // load the necessary plugins + plugins { + load "nft-utils@0.0.3" + } +} diff --git a/assets/oncoflow_test_full.config b/assets/oncoflow_test_full.config new file mode 100644 index 0000000..38d5328 --- /dev/null +++ b/assets/oncoflow_test_full.config @@ -0,0 +1,79 @@ +// General pipeline parameters that should be the same for all oncorefiner cases +params { + pipelines_testdata_base_path = 'https://raw.githubusercontent.com/Clinical-Genomics/test-datasets/61dce843b868caaee4135d33509af38aaa80724b/' + + fasta = params.pipelines_testdata_base_path + 'reference/GRCh38/GRCh38_masked_exclusions_alts_hlas_subset.fasta' + fai = params.pipelines_testdata_base_path + 'reference/GRCh38/GRCh38_masked_exclusions_alts_hlas_subset.fasta.fai' + + vep_cache = params.pipelines_testdata_base_path + 'reference/GRCh38/vep_cache.tar.gz' + vep_plugin_files = params.pipelines_testdata_base_path + 'reference/GRCh38/vep_files.csv' + + vcfanno_toml = params.pipelines_testdata_base_path + 'reference/GRCh38/grch38_vcfanno_config.toml' + vcfanno_resources = params.pipelines_testdata_base_path + 'reference/GRCh38/grch38_vcfanno_resources.txt' + vcfanno_lua = params.pipelines_testdata_base_path + 'reference/GRCh38/vcfanno_functions.lua' + + svdb_query_dbs = params.pipelines_testdata_base_path + 'reference/GRCh38/svdb_querydb_files.csv' + + genmod_score_config_snv = params.pipelines_testdata_base_path + 'reference/genmod_score_config_snv.ini' + genmod_score_config_sv = params.pipelines_testdata_base_path + 'reference/genmod_score_config_sv.ini' + + extra_args_cadd_annotate = '--columns Chrom,Pos,Ref,Alt,-,CADD' + extra_args_snv_clinical_filter = " --include '(INFO/GNOMADAF_grpmax <= 0.001 || INFO/GNOMADAF_grpmax == \".\")' " + extra_args_snv_research_filter = " --include '(INFO/GNOMADAF_grpmax <= 0.001 || INFO/GNOMADAF_grpmax == \".\")' " + extra_args_sv_vep = '--pick --pick_order mane_select,mane_plus_clinical,canonical,appris,tsl,biotype,ccds,rank,length,ensembl,refseq' +} + + +process { + + withName: '.*:GENERATE_CYTOSURE_FILES:VCF2CYTOSURE' { + errorStrategy = 'ignore' + } + + withName:'.*PROCESS_SNVS:BCFTOOLS_VIEW_RESEARCH' { + ext.args = { [ + "${params.extra_args_snv_research_filter}", + "--output-type z", + "--write-index=tbi", + ].join(' ') } + } + + withName: '.*PROCESS_SNVS:ENSEMBLVEP_VEP' { + maxForks = 8 + memory = { 10.GB * task.attempt } + cpus = { 2 * task.attempt } + time = { 4.h * task.attempt } + } + + withName: '.*PROCESS_SVS:ENSEMBLVEP_VEP' { + maxForks = 8 + memory = { 10.GB * task.attempt } + cpus = { 2 * task.attempt } + time = { 4.h * task.attempt } + } + + withName: '.*ANNOTATE_CADD:CADD' { + memory = { 30.GB * task.attempt } + cpus = { 1 * task.attempt } + time = { 1.h * task.attempt } + } + + withName: '.*ANNOTATE_CADD:RENAME_CHR_CADD' { + memory = { 1.GB * task.attempt } + cpus = { 1 * task.attempt } + time = { 1.h * task.attempt } + } + + withName: '.*ANNOTATE_CADD:ANNOTATE_INDELS' { + memory = { 1.GB * task.attempt } + cpus = { 1 * task.attempt } + time = { 1.h * task.attempt } + } + + withName: '.*ANNOTATE_CADD:BCFTOOLS_VIEW' { + memory = { 1.GB * task.attempt } + cpus = { 1 * task.attempt } + time = { 1.h * task.attempt } + } + +} diff --git a/conf/test_full.config b/conf/test_full.config index 756ea5c..f5f03ea 100644 --- a/conf/test_full.config +++ b/conf/test_full.config @@ -14,11 +14,27 @@ params { config_profile_name = 'Full test profile' config_profile_description = 'Full test dataset to check pipeline function' - // Input data for full size test - // TODO nf-core: Specify the paths to your full test data ( on nf-core/test-datasets or directly in repositories, e.g. SRA) - // TODO nf-core: Give any required params for the test so that command line flags are not needed - input = params.pipelines_testdata_base_path + 'viralrecon/samplesheet/samplesheet_full_illumina_amplicon.csv' + // Metadata + case_id = 'test_case_id' + sample_id_tumor = 'test_sample_id_tumor' + sample_id_normal = 'test_sample_id_normal' + subject_id = 'subject_a' // matches the subject_id in the samplesheet of the test data of the oncoanalyser pipeline + sex = 'female' + + // Oncoanalyser input parameters + oncoanalyser_nextflow_opts = [ + '-revision 2.2.0-with-purple-tbi-fix', + '-profile test_full,docker', + '--max_fastq_records 0', // Matches the test_full.config for oncoanalyser + ].join(' ') + // oncoanalyser_samplesheet = 'https://raw.githubusercontent.com/nf-core/test-datasets/oncoanalyser/samplesheet/fastq_eval.subject_a.wgts.tndna_trna.minimal.csv' + oncoanalyser_mode = 'wgts' + oncoanalyser_genome = 'GRCh38_hmf' + + // Oncorefiner input parameters + oncorefiner_nextflow_opts = [ + '-revision ac1a8ed33e014d98ae039a1e83294a23ca9bfa61', // Before adding PROCESS_CNVS and LINX input parameters + '-profile docker', + ].join(' ') - // Fasta references - fasta = params.pipelines_testdata_base_path + 'viralrecon/genome/NC_045512.2/GCF_009858895.2_ASM985889v3_genomic.200409.fna.gz' } diff --git a/tests/default_full.nf.test b/tests/default_full.nf.test new file mode 100644 index 0000000..1e24000 --- /dev/null +++ b/tests/default_full.nf.test @@ -0,0 +1,43 @@ +nextflow_pipeline { + + name "Test pipeline" + script "../main.nf" + tag "pipeline" + + test("-profile test_full") { + + when { + params { + outdir = "$outputDir" + } + } + + then { + // stable_path: All files + folders in ${params.outdir}/ with a stable path (including file name) + def stable_path = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['**pipeline_info/*.{html,json,txt}']) + // stable_content: All files in ${params.outdir}/ with stable content + def stable_content = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore', ignore: ['oncorefiner/oncorefiner_params.yaml']) + + // The oncorefiner params file contains $workDir for NFCORE_ONCOANALYSER, which varies for every run + def oncorefiner_params_file_path = "$outputDir/oncorefiner/oncorefiner_params.yaml" + def oncorefiner_params_file = file(oncorefiner_params_file_path) + def clean_oncorefiner_params_file_content = oncorefiner_params_file.text.replaceAll("$workDir/.*/results", "") + + assert workflow.success + assertAll( + { assert snapshot( + // pipeline versions.yml file for multiqc from which Nextflow version is removed because we test pipelines on multiple Nextflow versions + removeNextflowVersion("$outputDir/pipeline_info/oncoflow_software_versions.yml"), + // All stable path name, with a relative path + stable_path, + // All files with stable contents + stable_content, + // Oncoanalyser params file + file("$outputDir/oncoanalyser/oncoanalyser_params.yaml").text.split("\n"), + // Oncorefiner params file without the run $outputDir path + clean_oncorefiner_params_file_content.split("\n") + ).match() } + ) + } + } +}