def test_run_with_filter_cluster_include_ref_alleles(self):
     '''test run with filtering and clustering'''
     vcf_file_in = os.path.join(data_dir, 'run.calls.include_ref_calls.vcf')
     vcf_reference_file = os.path.join(data_dir, 'run.ref.fa')
     verify_reference_file = os.path.join(data_dir, 'run.ref.mutated.fa')
     tmp_out = 'tmp.mapping_based_verifier.out.include_ref_calls'
     verifier = mapping_based_verifier.MappingBasedVerifier(
         vcf_file_in,
         vcf_reference_file,
         verify_reference_file,
         tmp_out,
         flank_length=31,
         filter_and_cluster_vcf=True,
         discard_ref_calls=False)
     verifier.run()
     expected_out = os.path.join(data_dir, 'run.out.include_ref_calls')
     for suffix in [
             '.false_negatives.vcf', '.stats.tsv', '.vcf',
             '.gt_conf_hist.TP.tsv', '.gt_conf_hist.FP.tsv'
     ]:
         expected_file = expected_out + suffix
         got_file = tmp_out + suffix
         self.assertTrue(filecmp.cmp(expected_file, got_file,
                                     shallow=False))
         os.unlink(got_file)
     samfile = tmp_out + '.sam'
     self.assertTrue(os.path.exists(samfile))
     os.unlink(samfile)
     for suffix in [
             '.dnadiff.merged.vcf', '.dnadiff.qdiff', '.dnadiff.raw.vcf',
             '.dnadiff.snps', '.filter.vcf', '.filter.cluster.vcf'
     ]:
         os.unlink(tmp_out + suffix)
Exemple #2
0
def run(options):
    verifier = mapping_based_verifier.MappingBasedVerifier(
        options.vcf_file,
        options.vcf_ref,
        options.truth_ref,
        options.outprefix,
        flank_length=options.flank_length,
        expected_variants_vcf=options.expected_variants_vcf,
        run_dnadiff=options.run_dnadiff,
        filter_and_cluster_vcf=not options.no_filter_cluster,
        discard_ref_calls=not options.include_ref_calls,
        allow_flank_mismatches=not options.no_flank_mismatches,
        merge_length=options.variant_merge_length,
        exclude_regions_bed_file=options.exclude_bed,
        max_soft_clipped=options.max_soft_clipped,
    )
    verifier.run()
Exemple #3
0
 def test_run_no_filter_cluster_with_exclude_region(self):
     """test run without filtering and clustering but with region excluded"""
     vcf_file_in = os.path.join(data_dir, "run.calls.vcf")
     vcf_reference_file = os.path.join(data_dir, "run.ref.fa")
     verify_reference_file = os.path.join(data_dir, "run.ref.mutated.fa")
     exclude_regions_bed_file = os.path.join(data_dir, "run.exclude.bed")
     tmp_out = "tmp.mapping_based_verifier.out.no_filter_cluster.with_exclude"
     verifier = mapping_based_verifier.MappingBasedVerifier(
         vcf_file_in,
         vcf_reference_file,
         verify_reference_file,
         tmp_out,
         flank_length=31,
         filter_and_cluster_vcf=False,
         exclude_regions_bed_file=exclude_regions_bed_file,
     )
     verifier.run()
     expected_out = os.path.join(data_dir,
                                 "run.out.no_filter_cluster_with_exclude")
     for suffix in [
             ".false_negatives.vcf",
             ".stats.tsv",
             ".vcf",
             ".gt_conf_hist.TP.tsv",
             ".gt_conf_hist.FP.tsv",
     ]:
         expected_file = expected_out + suffix
         got_file = tmp_out + suffix
         self.assertTrue(filecmp.cmp(expected_file, got_file,
                                     shallow=False))
         os.unlink(got_file)
     samfile = tmp_out + ".sam"
     self.assertTrue(os.path.exists(samfile))
     os.unlink(samfile)
     for suffix in [
             ".dnadiff.merged.vcf",
             ".dnadiff.qdiff",
             ".dnadiff.raw.vcf",
             ".dnadiff.snps",
     ]:
         os.unlink(tmp_out + suffix)