当前位置: 首页>>代码示例>>Python>>正文


Python vcf.VcfRecord类代码示例

本文整理汇总了Python中jacquard.utils.vcf.VcfRecord的典型用法代码示例。如果您正苦于以下问题:Python VcfRecord类的具体用法?Python VcfRecord怎么用?Python VcfRecord使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了VcfRecord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_text

 def test_text(self):
     sampleA = OrderedDict(sorted({"F1": "SA.1", "F2": "SA.2", "F3": "SA.3"}.items()))
     sampleB = OrderedDict(sorted({"F1": "SB.1", "F2": "SB.2", "F3": "SB.3"}.items()))
     sample_tag_values = OrderedDict(sorted({"SampleA": sampleA, "SampleB": sampleB}.items()))
     record = VcfRecord("CHROM", "POS", "REF", "ALT", "ID", "QUAL", "FILTER", "INFO", sample_tag_values)
     expected = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|F1:F2:F3|SA.1:SA.2:SA.3|SB.1:SB.2:SB.3\n")
     self.assertEquals(expected, record.text())
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:7,代码来源:vcf_test.py

示例2: test_asTextWhenEmptyFormatField

 def test_asTextWhenEmptyFormatField(self):
     sampleA = OrderedDict({})
     sampleB = OrderedDict({})
     sample_tag_values = OrderedDict({"SampleA": sampleA, "SampleB": sampleB})
     record = VcfRecord("CHROM", "POS", "REF", "ALT", "ID", "QUAL", "FILTER", "INFO", sample_tag_values)
     expected = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|.|.|.\n")
     self.assertEquals(expected, record.text())
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:7,代码来源:vcf_test.py

示例3: test_empty_record

    def test_empty_record(self):
        sample_names = ["SampleA"]
        base = VcfRecord.parse_record(self.entab("chr2|1|ID|A|C|QUAL|FILTER|INFO|F|S\n"), sample_names)

        empty_record = base.get_empty_record()

        expected_record = VcfRecord(chrom="chr2", pos="1", ref="A", alt="C")
        self.assertEquals(expected_record.text(), empty_record.text())
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:8,代码来源:vcf_test.py

示例4: testHash

 def testHash(self):
     sample_names = ["sampleA"]
     base = VcfRecord.parse_record(self.entab("A|B|ID|C|D|QUAL|FILTER|INFO|F|S\n"), sample_names)
     base_equivalent = VcfRecord.parse_record(self.entab("A|B|ID|C|D|QUAL|FILTER||foo|S\n"), sample_names)
     self.assertEquals(base.__hash__(), base_equivalent.__hash__())
     record_set = set()
     record_set.add(base)
     record_set.add(base_equivalent)
     self.assertEquals(1, len(record_set))
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:9,代码来源:vcf_test.py

示例5: test_passed_tag_format

 def test_passed_tag_format(self):
     passed_tag = common_tags.PassedTag("foo")
     actual_line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|F1:F2|SA.1:SA.2|SB.1:SB.2\n")
     actual_vcf_record = VcfRecord.parse_record(actual_line, ["SA", "SB"])
     expected_line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|F1:F2:foo_CALLER_REPORTED"
                                "|SA.1:SA.2:1|SB.1:SB.2\n")
     expected_vcf_record = VcfRecord.parse_record(expected_line, ["SA", "SB"])
     passed_tag.add_tag_values(actual_vcf_record)
     self.assertEquals(expected_vcf_record, actual_vcf_record)
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:9,代码来源:common_tags_test.py

示例6: test_join_info_fields_nullValues

    def test_join_info_fields_nullValues(self):
        sample_names = ["SampleA"]
        input_line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|.|F|S\n")
        vcf_record = VcfRecord.parse_record(input_line, sample_names)
        vcf_record._join_info_fields()
        self.assertEquals(".", vcf_record.info)

        vcf_record = VcfRecord.parse_record(input_line, sample_names)
        vcf_record.add_info_field("foo")
        vcf_record._join_info_fields()
        self.assertEquals("foo", vcf_record.info)
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:11,代码来源:vcf_test.py

示例7: testCompare_nonNumericChrom

    def testCompare_nonNumericChrom(self):
        sample_names = ["SampleA"]
        expected_records = [
            VcfRecord.parse_record(self.entab("chr2|1|ID|A|A|QUAL|FILTER|INFO|F|S\n"), sample_names),
            VcfRecord.parse_record(self.entab("chr5|1|ID|A|A|QUAL|FILTER||foo|S\n"), sample_names),
            VcfRecord.parse_record(self.entab("10|1|ID|A|C|QUAL|FILTER|INFO|F|S\n"), sample_names),
        ]

        input_records = expected_records[::-1]

        self.assertEquals(expected_records, sorted(input_records))
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:11,代码来源:vcf_test.py

示例8: test_parse_record_removesNewlines

    def test_parse_record_removesNewlines(self):
        sample_names = ["SampleA"]
        input_line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|FOO:BAR|SB_foo:SB_bar\n")
        record = VcfRecord.parse_record(input_line, sample_names)
        self.assertEquals("SB_bar", record.sample_tag_values["SampleA"]["BAR"])

        input_line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|FOO:BAR|SB_foo:SB_bar\r")
        record = VcfRecord.parse_record(input_line, sample_names)
        self.assertEquals("SB_bar", record.sample_tag_values["SampleA"]["BAR"])

        input_line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|FOO:BAR|SB_foo:SB_bar\r\n")
        record = VcfRecord.parse_record(input_line, sample_names)
        self.assertEquals("SB_bar", record.sample_tag_values["SampleA"]["BAR"])
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:13,代码来源:vcf_test.py

示例9: test_format_field_preservesOrderWhenAddingNewTags

 def test_format_field_preservesOrderWhenAddingNewTags(self):
     sample_names = ["SA", "SB"]
     input_line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|F3:F1:F2|SA.1:SA.2:SA.3|SB.1:SB.2:SB.3\n")
     record = VcfRecord.parse_record(input_line, sample_names)
     record.add_sample_tag_value("Z4", {"SA": "SA.4", "SB": "SB.4"})
     record.add_sample_tag_value("A5", {"SA": "SA.A5", "SB": "SB.A5"})
     self.assertEquals("F3:F1:F2:Z4:A5", record._format_field())
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:7,代码来源:vcf_test.py

示例10: test_parse_record_initsSampleTagValues

 def test_parse_record_initsSampleTagValues(self):
     sample_names = ["SampleA", "SampleB"]
     input_line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|F1:F2:F3|SA.1:SA.2:SA.3|SB.1:SB.2:SB.3\n")
     record = VcfRecord.parse_record(input_line, sample_names)
     self.assertEquals(["SampleA", "SampleB"], sorted(record.sample_tag_values.keys()))
     self.assertEquals({"F1": "SA.1", "F2": "SA.2", "F3": "SA.3"}, record.sample_tag_values["SampleA"])
     self.assertEquals({"F1": "SB.1", "F2": "SB.2", "F3": "SB.3"}, record.sample_tag_values["SampleB"])
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:7,代码来源:vcf_test.py

示例11: test_add_tag_values_nullValues

    def test_add_tag_values_nullValues(self):
        line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|JQ_DP:{}{}:{}{}|X:1:.|Y:1:.\n".format(mutect.JQ_MUTECT_TAG, common_tags.CALLER_PASSED, varscan.JQ_VARSCAN_TAG, common_tags.CALLER_PASSED))
        processedVcfRecord = VcfRecord.parse_record(line, ["SA", "SB"])
        tag = summarize_caller._CallersPassedListTag()
        tag.add_tag_values(processedVcfRecord)

        expected = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|JQ_DP:{}{}:{}{}:{}CALLERS_PASSED_LIST|X:1:.:MT|Y:1:.:MT\n".format(mutect.JQ_MUTECT_TAG, common_tags.CALLER_PASSED, varscan.JQ_VARSCAN_TAG, common_tags.CALLER_PASSED, summarize_caller.JQ_SUMMARY_TAG))
        self.assertEquals(expected, processedVcfRecord.text())
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:8,代码来源:summarize_rollup_transform_test.py

示例12: test_add_tag_values

    def test_add_tag_values(self):
        line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|JQ_DP:{}{}:{}{}|X:1:1|Y:1:1\n".format(mutect.JQ_MUTECT_TAG, common_tags.CALLER_REPORTED, varscan.JQ_VARSCAN_TAG, common_tags.CALLER_REPORTED))
        processedVcfRecord = VcfRecord.parse_record(line, ["SA", "SB"])
        tag = summarize_caller._CallersReportedTag()
        tag.add_tag_values(processedVcfRecord)

        expected = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|JQ_DP:{}{}:{}{}:{}{}|X:1:1:2|Y:1:1:2\n".format(mutect.JQ_MUTECT_TAG, common_tags.CALLER_REPORTED, varscan.JQ_VARSCAN_TAG, common_tags.CALLER_REPORTED, summarize_caller.JQ_SUMMARY_TAG, summarize_caller.JQ_REPORTED))
        self.assertEquals(expected, processedVcfRecord.text())
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:8,代码来源:summarize_rollup_transform_test.py

示例13: test_add_sample_format_value

 def test_add_sample_format_value(self):
     sample_names = ["SampleA", "SampleB"]
     input_line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|F1:F2:F3|SA.1:SA.2:SA.3|SB.1:SB.2:SB.3\n")
     record = VcfRecord.parse_record(input_line, sample_names)
     record.add_sample_tag_value("inserted", {"SampleB": "insertedValueB", "SampleA": "insertedValueA"})
     expected = self.entab(
         "CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|F1:F2:F3:inserted|SA.1:SA.2:SA.3:insertedValueA|SB.1:SB.2:SB.3:insertedValueB\n"
     )
     self.assertEquals(expected, record.text())
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:9,代码来源:vcf_test.py

示例14: test_insert_format_field_failsOnInvalidSampleDict

 def test_insert_format_field_failsOnInvalidSampleDict(self):
     sample_names = ["SampleA", "SampleB"]
     input_line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|F1:F2:F3|SA.1:SA.2:SA.3|SB.1:SB.2:SB.3\n")
     record = VcfRecord.parse_record(input_line, sample_names)
     self.assertRaises(KeyError, record.add_sample_tag_value, "inserted", {"SampleA": 0.6})
     self.assertRaises(KeyError, record.add_sample_tag_value, "inserted", {"SampleA": 0.6, "SampleZ": 0.6})
     self.assertRaises(
         KeyError, record.add_sample_tag_value, "inserted", {"SampleA": 0.6, "SampleB": 0.6, "SampleZ": 0.6}
     )
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:9,代码来源:vcf_test.py

示例15: test_add_tag_values_nonePassed

    def test_add_tag_values_nonePassed(self):
        line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|JQ_DP:{}{}|X:0|Y:0\n".format(summarize_caller.JQ_SUMMARY_TAG, summarize_caller.JQ_PASSED))
        vcf_record = VcfRecord.parse_record(line, ["SA", "SB"])
        tag = summarize_caller._SamplesPassed()
        tag.add_tag_values(vcf_record)

        info_tag = summarize_caller.JQ_SUMMARY_TAG + summarize_caller.JQ_SAMPLES_PASSED
        self.assertIn(info_tag, vcf_record.info_dict)
        self.assertEquals("0", vcf_record.info_dict[info_tag])
开发者ID:umich-brcf-bioinf,项目名称:Jacquard,代码行数:9,代码来源:summarize_rollup_transform_test.py


注:本文中的jacquard.utils.vcf.VcfRecord类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。