diff --git a/main.nf b/main.nf index e6fd284..2a6c3b9 100755 --- a/main.nf +++ b/main.nf @@ -26,6 +26,9 @@ Input: Optional input: * output: the folder where to publish output + * skip_multiallelic_filter: skip the filtering of multiallelics by frequency in the tumor (only highest frequency variant at the same position is kept) + * base_call_quality: threshold for the base call quality, only base calls with a higher value are considered (default: 29) + * mapping_quality: threshold for the mapping quality, only reads with a higher value are considered (default: 0) Output: * Annotated VCF file @@ -93,11 +96,11 @@ else { output: set val("${name}"), val("${publish_dir}/${name}/${vcf.baseName}.filtered_multiallelics.vcf") into output_files - file("${vcf.baseName}.filtered_multiallelics.vcf") into annotated_vcf + file("${vcf.baseName}.filtered_multiallelics.vcf") into filtered_vcf script: """ - /home/priesgof/src/vafator/venv/bin/multiallelic-filter --input-vcf ${vcf} --output-vcf ${vcf.baseName}.filtered_multiallelics.vcf + /home/priesgof/src/vafator/venv/bin/multiallelics-filter --input-vcf ${vcf} --output-vcf ${vcf.baseName}.filtered_multiallelics.vcf """ } } diff --git a/vafator/multiallelic_filter.py b/vafator/multiallelic_filter.py index 7c61372..6f08d7e 100755 --- a/vafator/multiallelic_filter.py +++ b/vafator/multiallelic_filter.py @@ -40,7 +40,9 @@ def run(self): # first time stores the variant and moves on prev_variant = variant continue - if variant.is_snp and variant.CHROM == prev_variant.CHROM and variant.POS == prev_variant.POS: + # considers only SNVs with same chromosome, position and reference + if variant.is_snp and variant.CHROM == prev_variant.CHROM and variant.POS == prev_variant.POS and \ + variant.REF == prev_variant.REF: af1 = self.get_tumor_af(prev_variant) af2 = self.get_tumor_af(variant) # keeps the variant with the highest AF @@ -64,15 +66,16 @@ def run(self): if len(batch) >= 1000: self._write_batch(batch) batch = [] - if len(batch) > 0: - self._write_batch(batch) + # do not forget to add the last variant! + batch.append(prev_variant) + self._write_batch(batch) self.vcf_writer.close() self.vcf.close() def set_multiallelic_annotation(self, variant, alt, af): variant.INFO[self.multiallelic_annotation_name] = \ - ",".join(variant.INFO.get(self.multiallelic_annotation_name, []) + [alt, str(af)]) + ",".join(variant.INFO.get(self.multiallelic_annotation_name, "").split(",") + [alt, str(af)]) def get_tumor_af(self, prev_variant): return prev_variant.INFO.get("{}_af".format(self.tumor_sample_name), 0.0) diff --git a/vafator/tests/__init__.py b/vafator/tests/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/vafator/tests/resources/COLO_829_n1.bam b/vafator/tests/resources/COLO_829_n1.bam new file mode 100755 index 0000000..234ebd8 Binary files /dev/null and b/vafator/tests/resources/COLO_829_n1.bam differ diff --git a/vafator/tests/resources/COLO_829_n1.bam.bai b/vafator/tests/resources/COLO_829_n1.bam.bai new file mode 100755 index 0000000..320e274 Binary files /dev/null and b/vafator/tests/resources/COLO_829_n1.bam.bai differ diff --git a/vafator/tests/resources/COLO_829_t1.bam b/vafator/tests/resources/COLO_829_t1.bam new file mode 100755 index 0000000..ad67e28 Binary files /dev/null and b/vafator/tests/resources/COLO_829_t1.bam differ diff --git a/vafator/tests/resources/COLO_829_t1.bam.bai b/vafator/tests/resources/COLO_829_t1.bam.bai new file mode 100755 index 0000000..48e83cb Binary files /dev/null and b/vafator/tests/resources/COLO_829_t1.bam.bai differ diff --git a/vafator/tests/resources/results/test1_output.vcf b/vafator/tests/resources/results/test1_output.vcf new file mode 100644 index 0000000..b0564f3 --- /dev/null +++ b/vafator/tests/resources/results/test1_output.vcf @@ -0,0 +1,25 @@ +##fileformat=VCFv4.2 +##FILTER= +##contig= +##contig= +##contig= +##contig= +##contig= +##contig= +##INFO= +##FORMAT= +##vafator_command_line={"name": "multiallelic-filter", "version": "0.2.0", "date": "Wed Feb 5 14:11:29 2020", "timestamp": 1580908289.074858, "input_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/test1.vcf", "output_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/results/test1_output.vcf"} +##INFO= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT tumor +chr1 25734793 . C T . PASS . GT 0/1 +chr1 37323930 . C T . PASS . GT 0/1 +chr2 1234 . C T . PASS . GT 0/1 +chr2 1235 . C T . PASS . GT 0/1 +chr3 1234 . C T . PASS . GT 0/1 +chr4 1234 . C T . PASS . GT 0/1 +chr4 1235 . C T . PASS . GT 0/1 +chr4 1236 . C T . PASS . GT 0/1 +chr5 1234 . C T . PASS . GT 0/1 +chr6 1234 . C T . PASS . GT 0/1 +chr6 1235 . C T . PASS . GT 0/1 +chr6 1236 . C T . PASS . GT 0/1 diff --git a/vafator/tests/resources/results/test2_output.vcf b/vafator/tests/resources/results/test2_output.vcf new file mode 100644 index 0000000..ac1dc25 --- /dev/null +++ b/vafator/tests/resources/results/test2_output.vcf @@ -0,0 +1,23 @@ +##fileformat=VCFv4.2 +##FILTER= +##contig= +##contig= +##contig= +##contig= +##contig= +##contig= +##INFO= +##FORMAT= +##vafator_command_line={"name": "multiallelic-filter", "version": "0.2.0", "date": "Wed Feb 5 14:11:29 2020", "timestamp": 1580908289.074858, "input_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/test2.vcf", "output_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/results/test2_output.vcf"} +##INFO= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT tumor +chr1 25734793 . C T . PASS . GT 0/1 +chr1 37323930 . C T . PASS . GT 0/1 +chr2 1234 . C T . PASS . GT 0/1 +chr2 1235 . C T . PASS . GT 0/1 +chr3 1234 . C T . PASS . GT 0/1 +chr4 1234 . C T . PASS . GT 0/1 +chr4 1235 . C A . PASS tumor_af=0.2;multiallelic=,T,0.1 GT 0/1 +chr5 1234 . C T . PASS . GT 0/1 +chr6 1234 . C T . PASS tumor_af=0.5 GT 0/1 +chr6 1235 . C G . PASS tumor_af=0.2;multiallelic=,A,0.01,T,0.1 GT 0/1 diff --git a/vafator/tests/resources/results/test3_output.vcf b/vafator/tests/resources/results/test3_output.vcf new file mode 100644 index 0000000..eefcc1c --- /dev/null +++ b/vafator/tests/resources/results/test3_output.vcf @@ -0,0 +1,15 @@ +##fileformat=VCFv4.2 +##FILTER= +##contig= +##contig= +##contig= +##contig= +##contig= +##contig= +##INFO= +##FORMAT= +##vafator_command_line={"name": "multiallelic-filter", "version": "0.2.0", "date": "Wed Feb 5 14:11:29 2020", "timestamp": 1580908289.074858, "input_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/test3.vcf", "output_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/results/test3_output.vcf"} +##INFO= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT tumor +chr1 1234 . C T . PASS . GT 0/1 +chr1 1234 . G T . PASS . GT 0/1 diff --git a/vafator/tests/resources/results/test4_output.vcf b/vafator/tests/resources/results/test4_output.vcf new file mode 100644 index 0000000..a0aa5b7 --- /dev/null +++ b/vafator/tests/resources/results/test4_output.vcf @@ -0,0 +1,14 @@ +##fileformat=VCFv4.2 +##FILTER= +##contig= +##contig= +##contig= +##contig= +##contig= +##contig= +##INFO= +##FORMAT= +##vafator_command_line={"name": "multiallelic-filter", "version": "0.2.0", "date": "Wed Feb 5 14:11:29 2020", "timestamp": 1580908289.074858, "input_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/test4.vcf", "output_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/results/test4_output.vcf"} +##INFO= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT tumor +chr4 1235 . C A . PASS tumor_af=0.2;multiallelic=,G,0.15 GT 0/1 diff --git a/vafator/tests/resources/results/test5_output.vcf b/vafator/tests/resources/results/test5_output.vcf new file mode 100644 index 0000000..2d46d81 --- /dev/null +++ b/vafator/tests/resources/results/test5_output.vcf @@ -0,0 +1,14 @@ +##fileformat=VCFv4.2 +##FILTER= +##contig= +##contig= +##contig= +##contig= +##contig= +##contig= +##INFO= +##FORMAT= +##vafator_command_line={"name": "multiallelic-filter", "version": "0.2.0", "date": "Wed Feb 5 14:11:29 2020", "timestamp": 1580908289.074858, "input_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/test5.vcf", "output_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/results/test5_output.vcf"} +##INFO= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT tumor +chr4 1235 . C A . PASS tumor_af=0.1;multiallelic=,G,0.1 GT 0/1 diff --git a/vafator/tests/resources/results/test_annotator1_output.vcf b/vafator/tests/resources/results/test_annotator1_output.vcf new file mode 100644 index 0000000..aa7a39b --- /dev/null +++ b/vafator/tests/resources/results/test_annotator1_output.vcf @@ -0,0 +1,29 @@ +##fileformat=VCFv4.2 +##FILTER= +##contig= +##contig= +##contig= +##contig= +##contig= +##contig= +##INFO= +##FORMAT= +##vafator_command_line={"name": "vafator", "version": "0.2.0", "date": "Wed Feb 5 14:11:37 2020", "timestamp": 1580908297.673633, "input_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/test1.vcf", "output_vcf": "/home/priesgof/src/vafator/vafator/tests/resources/results/test_annotator1_output.vcf", "normal_bams": ["/home/priesgof/src/vafator/vafator/tests/resources/COLO_829_n1.bam"], "tumor_bams": ["/home/priesgof/src/vafator/vafator/tests/resources/COLO_829_t1.bam"], "mapping_quality_threshold": 0, "base_call_quality_threshold": 29} +##INFO= +##INFO= +##INFO= +##INFO= +##INFO= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT tumor +chr1 25734793 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 +chr1 37323930 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 +chr2 1234 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 +chr2 1235 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 +chr3 1234 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 +chr4 1234 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 +chr4 1235 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 +chr4 1236 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 +chr5 1234 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 +chr6 1234 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 +chr6 1235 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 +chr6 1236 . C T . PASS tumor_af=0.0;tumor_ac=0;tumor_dp=0;normal_af=0.0;normal_ac=0;normal_dp=0 GT 0/1 diff --git a/vafator/tests/resources/test1.vcf b/vafator/tests/resources/test1.vcf new file mode 100755 index 0000000..cdfc0d2 --- /dev/null +++ b/vafator/tests/resources/test1.vcf @@ -0,0 +1,23 @@ +##fileformat=VCFv4.2 +##contig= +##contig= +##contig= +##contig= +##contig= +##contig= +##FILTER= +##INFO= +##FORMAT= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT tumor +chr1 25734793 . C T . PASS . GT 0/1 +chr1 37323930 . C T . PASS . GT 0/1 +chr2 1234 . C T . PASS . GT 0/1 +chr2 1235 . C T . PASS . GT 0/1 +chr3 1234 . C T . PASS . GT 0/1 +chr4 1234 . C T . PASS . GT 0/1 +chr4 1235 . C T . PASS . GT 0/1 +chr4 1236 . C T . PASS . GT 0/1 +chr5 1234 . C T . PASS . GT 0/1 +chr6 1234 . C T . PASS . GT 0/1 +chr6 1235 . C T . PASS . GT 0/1 +chr6 1236 . C T . PASS . GT 0/1 \ No newline at end of file diff --git a/vafator/tests/resources/test2.vcf b/vafator/tests/resources/test2.vcf new file mode 100755 index 0000000..20d49d2 --- /dev/null +++ b/vafator/tests/resources/test2.vcf @@ -0,0 +1,24 @@ +##fileformat=VCFv4.2 +##contig= +##contig= +##contig= +##contig= +##contig= +##contig= +##FILTER= +##INFO= +##FORMAT= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT tumor +chr1 25734793 . C T . PASS . GT 0/1 +chr1 37323930 . C T . PASS . GT 0/1 +chr2 1234 . C T . PASS . GT 0/1 +chr2 1235 . C T . PASS . GT 0/1 +chr3 1234 . C T . PASS . GT 0/1 +chr4 1234 . C T . PASS . GT 0/1 +chr4 1235 . C T . PASS tumor_af=0.1 GT 0/1 +chr4 1235 . C A . PASS tumor_af=0.2 GT 0/1 +chr5 1234 . C T . PASS . GT 0/1 +chr6 1234 . C T . PASS tumor_af=0.5 GT 0/1 +chr6 1235 . C A . PASS tumor_af=0.01 GT 0/1 +chr6 1235 . C G . PASS tumor_af=0.2 GT 0/1 +chr6 1235 . C T . PASS tumor_af=0.1 GT 0/1 \ No newline at end of file diff --git a/vafator/tests/resources/test3.vcf b/vafator/tests/resources/test3.vcf new file mode 100755 index 0000000..5e233d3 --- /dev/null +++ b/vafator/tests/resources/test3.vcf @@ -0,0 +1,13 @@ +##fileformat=VCFv4.2 +##contig= +##contig= +##contig= +##contig= +##contig= +##contig= +##FILTER= +##INFO= +##FORMAT= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT tumor +chr1 1234 . C T . PASS . GT 0/1 +chr1 1234 . G T . PASS . GT 0/1 \ No newline at end of file diff --git a/vafator/tests/resources/test4.vcf b/vafator/tests/resources/test4.vcf new file mode 100755 index 0000000..c85e256 --- /dev/null +++ b/vafator/tests/resources/test4.vcf @@ -0,0 +1,14 @@ +##fileformat=VCFv4.2 +##contig= +##contig= +##contig= +##contig= +##contig= +##contig= +##FILTER= +##INFO= +##FORMAT= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT tumor +chr4 1235 . C G . PASS tumor_af=0.15 GT 0/1 +chr4 1235 . C T . PASS tumor_af=0.1 GT 0/1 +chr4 1235 . C A . PASS tumor_af=0.2 GT 0/1 diff --git a/vafator/tests/resources/test5.vcf b/vafator/tests/resources/test5.vcf new file mode 100755 index 0000000..1cfeab9 --- /dev/null +++ b/vafator/tests/resources/test5.vcf @@ -0,0 +1,14 @@ +##fileformat=VCFv4.2 +##contig= +##contig= +##contig= +##contig= +##contig= +##contig= +##FILTER= +##INFO= +##FORMAT= +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT tumor +chr4 1235 . C G . PASS tumor_af=0.1 GT 0/1 +chr4 1235 . C T . PASS tumor_af=0.1 GT 0/1 +chr4 1235 . C A . PASS tumor_af=0.1 GT 0/1 diff --git a/vafator/tests/test_annotator.py b/vafator/tests/test_annotator.py new file mode 100755 index 0000000..5046b24 --- /dev/null +++ b/vafator/tests/test_annotator.py @@ -0,0 +1,32 @@ +import os +import pkg_resources +from unittest import TestCase +from cyvcf2 import VCF +from vafator.annotator import Annotator +import vafator.tests.utils as test_utils + + +class TestAnnotator(TestCase): + + def test_annotator(self): + input_file = pkg_resources.resource_filename(__name__, "resources/test1.vcf") + output_vcf = pkg_resources.resource_filename(__name__, "resources/results/test_annotator1_output.vcf") + bam1 = pkg_resources.resource_filename(__name__, "resources/COLO_829_n1.bam") + bam2 = pkg_resources.resource_filename(__name__, "resources/COLO_829_t1.bam") + annotator = Annotator(input_vcf=input_file, output_vcf=output_vcf, normal_bams=[bam1], tumor_bams=[bam2]) + annotator.run() + + self.assertTrue(os.path.exists(output_vcf)) + n_variants_input = test_utils._get_count_variants(input_file) + n_variants_output = test_utils._get_count_variants(output_vcf) + self.assertTrue(n_variants_input == n_variants_output) + + def _get_info_at(self, input_file, chromosome, position, annotation): + vcf = VCF(input_file) + self.assertIsNotNone(vcf) + for v in vcf: + if v.POS == position and v.CHROM == chromosome: + vcf.close() + return v.INFO.get(annotation) + vcf.close() + return {} \ No newline at end of file diff --git a/vafator/tests/test_multiallelic_filter.py b/vafator/tests/test_multiallelic_filter.py new file mode 100755 index 0000000..bdc15a0 --- /dev/null +++ b/vafator/tests/test_multiallelic_filter.py @@ -0,0 +1,95 @@ +import os +import pkg_resources +from unittest import TestCase +from cyvcf2 import VCF +from vafator.multiallelic_filter import MultiallelicFilter +import vafator.tests.utils as test_utils + + +class TestMultiallelicFilter(TestCase): + + def setUp(self): + # self.reference_genome_reader = TestReferenceGenomeReader() + pass + + def test_no_variants_filtered(self): + input_file = pkg_resources.resource_filename(__name__, "resources/test1.vcf") + output_vcf = pkg_resources.resource_filename(__name__, "resources/results/test1_output.vcf") + multiallelic_filter = MultiallelicFilter(input_vcf=input_file, output_vcf=output_vcf, tumor_sample_name='tumor') + multiallelic_filter.run() + + self.assertTrue(os.path.exists(output_vcf)) + n_variants_input = test_utils._get_count_variants(input_file) + n_variants_output = test_utils._get_count_variants(output_vcf) + self.assertTrue(n_variants_input == n_variants_output) + + def test_two_variants_filtered(self): + input_file = pkg_resources.resource_filename(__name__, "resources/test2.vcf") + output_vcf = pkg_resources.resource_filename(__name__, "resources/results/test2_output.vcf") + multiallelic_filter = MultiallelicFilter(input_vcf=input_file, output_vcf=output_vcf, tumor_sample_name='tumor') + multiallelic_filter.run() + + self.assertTrue(os.path.exists(output_vcf)) + n_variants_input = test_utils._get_count_variants(input_file) + n_variants_output = test_utils._get_count_variants(output_vcf) + self.assertTrue(n_variants_input == n_variants_output + 3, "input:{}; output:{}".format( + n_variants_input, n_variants_output)) + + af1 = self._get_info_at(output_vcf, chromosome="chr4", position=1235, annotation='tumor_af') + self.assertTrue(af1, 0.2) + multiallelic1 = self._get_info_at(output_vcf, chromosome="chr4", position=1235, annotation='multiallelic') + self.assertTrue(multiallelic1, "T,0.1") + + af2 = self._get_info_at(output_vcf, chromosome="chr6", position=1235, annotation='tumor_af') + self.assertTrue(af2, 0.2) + multiallelic2 = self._get_info_at(output_vcf, chromosome="chr6", position=1235, annotation='multiallelic') + self.assertTrue(multiallelic2, "A,0.01") + + af3 = self._get_info_at(output_vcf, chromosome="chr6", position=1234, annotation='tumor_af') + self.assertTrue(af3, 0.5) + + def test_different_reference_is_kept(self): + input_file = pkg_resources.resource_filename(__name__, "resources/test3.vcf") + output_vcf = pkg_resources.resource_filename(__name__, "resources/results/test3_output.vcf") + multiallelic_filter = MultiallelicFilter(input_vcf=input_file, output_vcf=output_vcf, tumor_sample_name='tumor') + multiallelic_filter.run() + + self.assertTrue(os.path.exists(output_vcf)) + n_variants_input = test_utils._get_count_variants(input_file) + n_variants_output = test_utils._get_count_variants(output_vcf) + self.assertTrue(n_variants_input == n_variants_output) + self.assertTrue(n_variants_input == 2) + + def test_three_multiallelics(self): + input_file = pkg_resources.resource_filename(__name__, "resources/test4.vcf") + output_vcf = pkg_resources.resource_filename(__name__, "resources/results/test4_output.vcf") + multiallelic_filter = MultiallelicFilter(input_vcf=input_file, output_vcf=output_vcf, tumor_sample_name='tumor') + multiallelic_filter.run() + + self.assertTrue(os.path.exists(output_vcf)) + n_variants_input = test_utils._get_count_variants(input_file) + n_variants_output = test_utils._get_count_variants(output_vcf) + self.assertTrue(n_variants_input == n_variants_output + 2) + self.assertTrue(n_variants_output == 1) + + def test_equal_af(self): + input_file = pkg_resources.resource_filename(__name__, "resources/test5.vcf") + output_vcf = pkg_resources.resource_filename(__name__, "resources/results/test5_output.vcf") + multiallelic_filter = MultiallelicFilter(input_vcf=input_file, output_vcf=output_vcf, tumor_sample_name='tumor') + multiallelic_filter.run() + + self.assertTrue(os.path.exists(output_vcf)) + n_variants_input = test_utils._get_count_variants(input_file) + n_variants_output = test_utils._get_count_variants(output_vcf) + self.assertTrue(n_variants_input == n_variants_output + 2) + self.assertTrue(n_variants_output == 1) + + def _get_info_at(self, input_file, chromosome, position, annotation): + vcf = VCF(input_file) + self.assertIsNotNone(vcf) + for v in vcf: + if v.POS == position and v.CHROM == chromosome: + vcf.close() + return v.INFO.get(annotation) + vcf.close() + return {} \ No newline at end of file diff --git a/vafator/tests/utils.py b/vafator/tests/utils.py new file mode 100755 index 0000000..6a69a5b --- /dev/null +++ b/vafator/tests/utils.py @@ -0,0 +1,10 @@ +from cyvcf2 import VCF + + +def _get_count_variants(input_file): + vcf = VCF(input_file) + n_variants = 0 + for v in vcf: + n_variants += 1 + vcf.close() + return n_variants \ No newline at end of file