def test_vcfparser(self):
        'It test the vcf arser'
        vcf_path = join(TEST_DATA_DIR, 'contigs.vcf')
        vcf = VcfParser(vcf_path)
        assert vcf.version == '3.3'

        header = vcf.header
        filter_info = 'SNV is not a CAP detectable by the enzymes: cheap ones'
        assert header['FILTER']['CEF'] == filter_info

        vcf_ = vcf.get_snv(('CUTC000002', '79'))
        assert vcf_['CHROM'] == 'CUTC000002'
        assert vcf_['POS'] == '79'

        vcfs = list(vcf.vcfs)
        assert len(vcfs) == 15
        assert  vcfs[4]['samples'] == {'MU16_454_MU16': {},
                                       'UPV196_454_UPV196': {'C': 2, 'T': 16}}
        assert vcfs[14]['samples'] == {'MU16_454_MU16': {'A': 2},
                                       'UPV196_454_UPV196': {'G': 2}}

        #version 4.1
        vcf_path = join(TEST_DATA_DIR, 'snvs_to_igv.vcf')
        vcf = VcfParser(vcf_path)
        assert vcf.version == '4.1'
        assert  vcf.header['FILTER'] == {'q10': 'Quality below 10'}
        vcf_ = vcf.get_snv(('ctg1', '36'))
        vcfs = list(vcf.vcfs)
        assert len(vcfs) == 2
        assert vcfs[0] == vcf_

        assert 'GROUP11' in vcf_['samples']
        assert vcf_['FILTER'] == ['.']
Esempio n. 2
0
    def test_vcfparser(self):
        "It test the vcf arser"
        vcf_path = join(TEST_DATA_DIR, "contigs.vcf")
        vcf = VcfParser(vcf_path)
        assert vcf.version == "3.3"

        header = vcf.header
        filter_info = "SNV is not a CAP detectable by the enzymes: cheap ones"
        assert header["FILTER"]["CEF"] == filter_info

        vcf_ = vcf.get_snv(("CUTC000002", "79"))
        assert vcf_["CHROM"] == "CUTC000002"
        assert vcf_["POS"] == "79"

        vcfs = list(vcf.vcfs)
        assert len(vcfs) == 15
        assert vcfs[4]["samples"] == {"MU16_454_MU16": {}, "UPV196_454_UPV196": {"C": 2, "T": 16}}
        assert vcfs[14]["samples"] == {"MU16_454_MU16": {"A": 2}, "UPV196_454_UPV196": {"G": 2}}