Skip to content

Commit 10cdb58

Browse files
committed
add bcftools csq as an annotation tool
1 parent 9c06040 commit 10cdb58

6 files changed

Lines changed: 50 additions & 11 deletions

File tree

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ test:
2828
bash test/scripts/run_test_10.sh
2929
bash test/scripts/run_test_11.sh
3030
bash test/scripts/run_test_12.sh
31+
bash test/scripts/run_test_13.sh

main.nf

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include { FILTER_VCF } from './modules/01_filter'
66
include { BCFTOOLS_NORM; VT_DECOMPOSE_COMPLEX; REMOVE_DUPLICATES } from './modules/02_normalization'
77
include { SUMMARY_VCF; SUMMARY_VCF as SUMMARY_VCF_2 } from './modules/03_summary'
88
include { VAFATOR; MULTIALLELIC_FILTER } from './modules/04_vafator'
9-
include { VARIANT_ANNOTATION } from './modules/05_variant_annotation'
9+
include { VARIANT_ANNOTATION_SNPEFF; VARIANT_ANNOTATION_BCFTOOLS } from './modules/05_variant_annotation'
1010

1111
params.help= false
1212
params.input_vcfs = false
@@ -19,6 +19,8 @@ params.input_clonalities = false
1919

2020

2121
params.reference = false
22+
params.gff = false
23+
2224
params.output = "output"
2325
params.skip_normalization = false
2426
params.skip_decompose_complex = false
@@ -123,12 +125,6 @@ workflow {
123125
.join(input_purities.groupTuple(), remainder: true)
124126
.join(input_clonalities.groupTuple(), remainder: true)
125127

126-
//if (params.input_purities) {
127-
// vafator_input = vafator_input.join(input_purities.groupTuple())
128-
//}
129-
//if (params.input_clonalities) {
130-
// vafator_input = vafator_input.join(input_clonalities.groupTuple())
131-
//}
132128
VAFATOR(vafator_input)
133129

134130
final_vcfs = VAFATOR.out.annotated_vcf
@@ -139,8 +135,12 @@ workflow {
139135
}
140136

141137
if (params.snpeff_organism) {
142-
VARIANT_ANNOTATION(final_vcfs)
143-
final_vcfs = VARIANT_ANNOTATION.out.annotated_vcf
138+
VARIANT_ANNOTATION_SNPEFF(final_vcfs)
139+
final_vcfs = VARIANT_ANNOTATION_SNPEFF.out.annotated_vcf
140+
}
141+
else if (params.gff) {
142+
VARIANT_ANNOTATION_BCFTOOLS(final_vcfs)
143+
final_vcfs = VARIANT_ANNOTATION_BCFTOOLS.out.annotated_vcf
144144
}
145145
}
146146

modules/05_variant_annotation.nf

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ params.snpeff_organism = false
66
params.snpeff_args = ""
77

88

9-
process VARIANT_ANNOTATION {
9+
process VARIANT_ANNOTATION_SNPEFF {
1010
cpus params.cpus
1111
memory params.memory
1212
publishDir "${params.output}/${name}", mode: "copy"
@@ -25,3 +25,25 @@ process VARIANT_ANNOTATION {
2525
snpEff eff ${datadir_arg} ${params.snpeff_args} -nodownload ${params.snpeff_organism} ${vcf} > ${name}.annotated.vcf
2626
"""
2727
}
28+
29+
process VARIANT_ANNOTATION_BCFTOOLS {
30+
cpus params.cpus
31+
memory params.memory
32+
publishDir "${params.output}/${name}", mode: "copy"
33+
34+
conda (params.enable_conda ? "conda-forge::libgcc-ng=10.3.0 conda-forge::gsl=2.7 bioconda::bcftools=1.15.1" : null)
35+
36+
input:
37+
tuple val(name), file(vcf)
38+
39+
output:
40+
tuple val(name), file("${name}.annotated.vcf") , emit: annotated_vcf
41+
42+
"""
43+
bcftools csq \\
44+
--fasta-ref ${params.reference} \\
45+
--gff-annot ${params.gff} ${vcf} \\
46+
--output-type v \\
47+
--output ${name}.annotated.vcf
48+
"""
49+
}
83.7 KB
Binary file not shown.

test/scripts/run_test_13.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
### this test cannot be automated as it relies on SnpEff references which need to be downloaded beforehand
4+
source test/scripts/assert.sh
5+
output_folder=test/output/test13
6+
data_folder=`pwd`/test/data
7+
8+
nextflow main.nf -profile test,conda --output $output_folder \
9+
--gff ${data_folder}/Homo_sapiens.GRCh37.87.minimal.gff3.gz \
10+
--reference ${data_folder}/ucsc.hg19.minimal.fasta
11+
12+
test -s $output_folder/single_sample/single_sample.annotated.vcf || { echo "Missing test 1 output file!"; exit 1; }
13+
test -s $output_folder/tumor_normal/tumor_normal.annotated.vcf || { echo "Missing test 1 output file!"; exit 1; }
14+
15+
assert_eq `grep -v '#' $output_folder/single_sample/single_sample.annotated.vcf| grep BCSQ | wc -l | cut -d' ' -f 1` 32 "Wrong number of variants"
16+
assert_eq `grep -v '#' $output_folder/tumor_normal/tumor_normal.annotated.vcf | grep BCSQ | wc -l | cut -d' ' -f 1` 32 "Wrong number of variants"

test/scripts/run_test_9.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### this test cannot be automated as it relies on SnpEff references which need to be downloaded beforehand
44
source test/scripts/assert.sh
5-
output_folder=test/output/test8
5+
output_folder=test/output/test9
66
snpeff_datadir=/home/you/snpeff
77

88
nextflow main.nf -profile test,conda --output $output_folder --snpeff_organism hg19 --snpeff_datadir $snpeff_datadir

0 commit comments

Comments
 (0)