Skip to content

Commit

Permalink
Add NFTest (#179)
Browse files Browse the repository at this point in the history
* Add NFTest template

* Add paired test case

* Add paired test case config and YAML

* Add assertions

* Add VCF comparison script

* Update CHANGELOG
  • Loading branch information
yashpatel6 authored Aug 12, 2024
1 parent 984589e commit c4f9539
Show file tree
Hide file tree
Showing 6 changed files with 122 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
---

## [Unreleased]
### Added
- NFTest test case

---

Expand Down
37 changes: 37 additions & 0 deletions nftest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
global:
temp_dir: ./test/work
nf_config: test/global.config
remove_temp: true
clean_logs: true

cases:
- name: test-call-gSNP-paired
message: Test call-gSNP pipeline with one normal and one tumor pair
nf_script: ./main.nf
nf_config: test/test-call-gSNP-paired.config
params_file: test/Illumina-paired.yaml
skip: false
verbose: true
asserts:
- actual: call-gSNP-*/NA24143/GATK-*/output/GATK-*_IlluminaTest_NA24143.g.vcf.gz
expect: /hot/software/pipeline/pipeline-call-gSNP/Nextflow/development/output/test-call-gSNP-paired/call-gSNP-10.1.0-rc.1/NA24143/GATK-4.5.0.0/output/GATK-4.5.0.0_IlluminaTest_NA24143.g.vcf.gz
script: test/assert-vcf.sh
- actual: call-gSNP-*/NA24143/GATK-*/output/GATK-*_IlluminaTest_NA24143_indel.vcf.gz
expect: /hot/software/pipeline/pipeline-call-gSNP/Nextflow/development/output/test-call-gSNP-paired/call-gSNP-10.1.0-rc.1/NA24143/GATK-4.5.0.0/output/GATK-4.5.0.0_IlluminaTest_NA24143_indel.vcf.gz
script: test/assert-vcf.sh
- actual: call-gSNP-*/NA24143/GATK-*/output/GATK-*_IlluminaTest_NA24143_snv.vcf.gz
expect: /hot/software/pipeline/pipeline-call-gSNP/Nextflow/development/output/test-call-gSNP-paired/call-gSNP-10.1.0-rc.1/NA24143/GATK-4.5.0.0/output/GATK-4.5.0.0_IlluminaTest_NA24143_snv.vcf.gz
script: test/assert-vcf.sh
- actual: call-gSNP-*/NA24143/GATK-*/output/GATK-*_IlluminaTest_NA24143.vcf.gz
expect: /hot/software/pipeline/pipeline-call-gSNP/Nextflow/development/output/test-call-gSNP-paired/call-gSNP-10.1.0-rc.1/NA24143/GATK-4.5.0.0/output/GATK-4.5.0.0_IlluminaTest_NA24143.vcf.gz
script: test/assert-vcf.sh
- actual: call-gSNP-*/NA24143/GATK-*/output/GATK-*_IlluminaTest_NA24143_VQSR-SNP-AND-INDEL.vcf.gz
expect: /hot/software/pipeline/pipeline-call-gSNP/Nextflow/development/output/test-call-gSNP-paired/call-gSNP-10.1.0-rc.1/NA24143/GATK-4.5.0.0/output/GATK-4.5.0.0_IlluminaTest_NA24143_VQSR-SNP-AND-INDEL.vcf.gz
script: test/assert-vcf.sh
- actual: call-gSNP-*/NA24143/GATK-*/output/GATK-*_IlluminaTest_NA24149.g.vcf.gz
expect: /hot/software/pipeline/pipeline-call-gSNP/Nextflow/development/output/test-call-gSNP-paired/call-gSNP-10.1.0-rc.1/NA24143/GATK-4.5.0.0/output/GATK-4.5.0.0_IlluminaTest_NA24149.g.vcf.gz
script: test/assert-vcf.sh
- actual: call-gSNP-*/NA24143/GATK-*/output/GATK-*_IlluminaTest_NA24143_genotype-count.tsv
expect: /hot/software/pipeline/pipeline-call-gSNP/Nextflow/development/output/test-call-gSNP-paired/call-gSNP-10.1.0-rc.1/NA24143/GATK-4.5.0.0/output/GATK-4.5.0.0_IlluminaTest_NA24143_genotype-count.tsv
method: md5
8 changes: 8 additions & 0 deletions test/Illumina-paired.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
patient_id: "NA24143"
input:
BAM:
normal:
- "/hot/software/pipeline/metapipeline-DNA/Nextflow/development/input/data/BAM/NA24149/BWA-MEM2-2.2.1_GATK-4.2.4.1_IlluminaSampleTest_NA24149.bam"
tumor:
- "/hot/software/pipeline/metapipeline-DNA/Nextflow/development/input/data/BAM/NA24143/BWA-MEM2-2.2.1_GATK-4.2.4.1_IlluminaSampleTest_NA24143.bam"
17 changes: 17 additions & 0 deletions test/assert-vcf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

function md5_vcf {
zcat "$1" | grep -v "^##" | md5sum | cut -d ' ' -f 1
}

received=$(md5_vcf "$1")
expected=$(md5_vcf "$2")

if [ "$received" == "$expected" ]
then
echo "VCF files are equal."
exit 0
else
echo "VCF files are not equal" >&2
exit 1
fi
9 changes: 9 additions & 0 deletions test/global.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
docker {
enabled = true

// Pass user's UID/GID and group IDs to Docker
uid_and_gid = "-u \$(id -u):\$(id -g)"
all_group_ids = "\$(for i in `id --real --groups`; do echo -n \"--group-add=\$i \"; done)"

runOptions = "${uid_and_gid} ${all_group_ids}"
}
49 changes: 49 additions & 0 deletions test/test-call-gSNP-paired.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// EXECUTION SETTINGS AND GLOBAL DEFAULTS

// External config files import. DO NOT MODIFY THESE LINES!
includeConfig "${projectDir}/config/default.config"
includeConfig "${projectDir}/config/methods.config"
includeConfig "${projectDir}/nextflow.config"


// Inputs/parameters of the pipeline
params {
dataset_id = 'IlluminaTest'
blcds_registered_dataset = false // if you want the output to be registered

// Set to false to disable the publish rule and delete intermediate files as they're no longer needed
// Disable this option for large input BAMs where /scratch space may not be sufficient
save_intermediate_files = false

// Whether to cache intermediate processes. Set to false by default
// To enable caching, uncomment this option and set to true
// cache_intermediate_pipeline_steps = false

// Target intervals to process for DNA panel/targeted sequencing samples
// For WGS, leave this field blank. The intervals will be extracted automatically from the reference dictionary
// For WXS/WES and targeted sequencing samples: provide path to targets in .list, .intervals, BED file, or VCF file format
// Defaults to WGS mode
intervals = ""

// Number of intervals to split into and any additional splitting arguments
scatter_count = 50
split_intervals_extra_args = ''

// Reference - Used here hg38 decoy version
// GATK requires the reference fasta to be accompanied by a .fai index and .dict dictionary associated with the fasta for fast random access
// These can be found in the same folder as the reference here: /hot/ref/reference/GRCh38-BI-20160721
reference_fasta = "/hot/ref/reference/GRCh38-BI-20160721/Homo_sapiens_assembly38.fasta"

// GATK bundle - Used here hg38 decoy version
bundle_mills_and_1000g_gold_standard_indels_vcf_gz = "/hot/ref/tool-specific-input/GATK/GRCh38/Mills_and_1000G_gold_standard.indels.hg38.vcf.gz"
bundle_v0_dbsnp138_vcf_gz = "/hot/ref/tool-specific-input/GATK/GRCh38/resources_broad_hg38_v0_Homo_sapiens_assembly38.dbsnp138.vcf.gz"
bundle_hapmap_3p3_vcf_gz = "/hot/ref/tool-specific-input/GATK/GRCh38/hapmap_3.3.hg38.vcf.gz"
bundle_omni_1000g_2p5_vcf_gz = "/hot/ref/tool-specific-input/GATK/GRCh38/1000G_omni2.5.hg38.vcf.gz"
bundle_phase1_1000g_snps_high_conf_vcf_gz = "/hot/ref/tool-specific-input/GATK/GRCh38/1000G_phase1.snps.high_confidence.hg38.vcf.gz"

// Base resource allocation updater
// See README for adding parameters to update the base resource allocations
}

// Setup the pipeline config. DO NOT REMOVE THIS LINE!
methods.setup()

0 comments on commit c4f9539

Please sign in to comment.