Skip to content

Commit

Permalink
Updated pangolin task to accept vcf with caller == input
Browse files Browse the repository at this point in the history
Updated main.nf to respect parameter params.skip_normalization
Added integration tests for lineage mode and reference generate mode
  • Loading branch information
johausmann committed Oct 5, 2023
1 parent 9d75700 commit 27386e7
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 3 deletions.
9 changes: 7 additions & 2 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,13 @@ workflow {
PANGOLIN_LINEAGE(input_fastas)
}
else if (input_vcfs) {
VARIANT_NORMALIZATION(input_vcfs, reference)
normalized_vcfs = VARIANT_NORMALIZATION.out
if (! params.skip_normalization) {
VARIANT_NORMALIZATION(input_vcfs, reference)
normalized_vcfs = VARIANT_NORMALIZATION.out
}
else {
normalized_vcfs = input_vcfs
}
VCF2FASTA(normalized_vcfs, reference)
PANGOLIN_LINEAGE(VCF2FASTA.out)
}
Expand Down
5 changes: 5 additions & 0 deletions modules/00_prepare_annotation.nf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ process BWA_INDEX {
path("reference/sequences.fa"), emit: reference
path("reference/sequences.fa.fai"), emit: fai
path("reference/sequences.dict"), emit: gatk_dict
path("reference/sequences.fa.0123")
path("reference/sequences.fa.amb")
path("reference/sequences.fa.ann")
path("reference/sequences.fa.bwt.2bit.64")
path("reference/sequences.fa.pac")

script:
memory = "${params.memory}".replaceAll(" ", "").toLowerCase()
Expand Down
3 changes: 2 additions & 1 deletion modules/07_lineage_annotation.nf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ process PANGOLIN_LINEAGE {

when:
// only runs pangolin on LoFreq and the assembly results
caller == "lofreq" || caller == "assembly"
// JoHa: added input to run lineage mode for vcf input
caller == "lofreq" || caller == "assembly" || caller == "input"

shell:
"""
Expand Down
32 changes: 32 additions & 0 deletions tests/scripts/test_14.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

##################################################################################
# Genome generate
##################################################################################
echo "Running CoVigator pipeline test 14"
source bin/assert.sh
output=tests/output/test14
nextflow main.nf -profile conda --name test_data \
--output $output \
--reference_generate \
--reference reference/Sars_cov_2.ASM985889v3.dna.toplevel.fa \
--gff reference/Sars_cov_2.ASM985889v3.101.gff3 \
--snpeff_organism Sars_cov_2

# Test reference genome related output
test -s $output/reference/sequences.fa.fai || { echo "Missing fasta index file!"; exit 1; }
test -s $output/reference/sequences.fa.dict || { echo "Missing GATK dict file!"; exit 1; }

# Test bwa index files are present
test -s $output/reference/sequences.fa.0123 || { echo "Missing bwa 0123 index file!"; exit 1; }
test -s $output/reference/sequences.fa.amb || { echo "Missing bwa amb index file!"; exit 1; }
test -s $output/reference/sequences.fa.ann || { echo "Missing bwa ann index file!"; exit 1; }
test -s $output/reference/sequences.fa.bwt.2bit.64 || { echo "Missing bwa bwt.2bit.64 index file!"; exit 1; }
test -s $output/reference/sequences.fa.pac || { echo "Missing bwa pac index file!"; exit 1; }


# Test snpEff output
test -s $output/snpeff/snpEff.config || { echo "Missing snpEff config file!"; exit 1; }
test -s $output/snpeff/Sars_cov_2/snpEffectPredictor.bin || { echo "Missing snpEff predictor bin file!"; exit 1; }
test -s $output/snpeff/Sars_cov_2/sequences.fa || { echo "Missing snpEff reference genome!"; exit 1; }
test -s $output/snpeff/Sars_cov_2/genes.gff || { echo "Missing snpEff reference annotation!"; exit 1; }
21 changes: 21 additions & 0 deletions tests/scripts/test_15.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

##################################################################################
# Lineage only mode
##################################################################################

echo "Running CoVigator pipeline test 15"
source bin/assert.sh
output=tests/output/test15
nextflow main.nf -profile conda --name test_data \
--output $output \
--vcf tests/test_data/test_data.lofreq.vcf \
--lineage_mode

test -s $output/test_data.input.fasta || { echo "Missing VCF2FASTA fasta file (lineage mode with vcf input)!"; exit 1; }
test -s $output/test_data.input.pangolin.csv || { echo "Missing pangolin output file (lineage mode with vcf input)!"; exit 1; }
assert_eq `wc -l $output/test_data.input.pangolin.csv` 2 "Wrong number of pangolin results"

Check notice on line 17 in tests/scripts/test_15.sh

View check run for this annotation

codefactor.io / CodeFactor

tests/scripts/test_15.sh#L17

Use $(...) notation instead of legacy backticks `...`. (SC2006)




16 changes: 16 additions & 0 deletions tests/scripts/test_16.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

##################################################################################
# Lineage only mode
##################################################################################

echo "Running CoVigator pipeline test 16"
source bin/assert.sh
output=tests/output/test15
nextflow main.nf -profile conda --name test_data \
--output $output \
--fasta tests/test_data/test_data.fasta \
--lineage_mode

test -s $output/test_data.assembly.pangolin.csv || { echo "Missing pangolin output file (lineage mode with vcf input)!"; exit 1; }
assert_eq `wc -l $output/test_data.assembly.pangolin.csv` 2 "Wrong number of pangolin results"

Check notice on line 16 in tests/scripts/test_16.sh

View check run for this annotation

codefactor.io / CodeFactor

tests/scripts/test_16.sh#L16

Use $(...) notation instead of legacy backticks `...`. (SC2006)

0 comments on commit 27386e7

Please sign in to comment.