本文整理汇总了Python中jacquard.utils.vcf.VcfRecord.parse_record方法的典型用法代码示例。如果您正苦于以下问题:Python VcfRecord.parse_record方法的具体用法?Python VcfRecord.parse_record怎么用?Python VcfRecord.parse_record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jacquard.utils.vcf.VcfRecord
的用法示例。
在下文中一共展示了VcfRecord.parse_record方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testHash
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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))
示例2: test_passed_tag_format
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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)
示例3: test_join_info_fields_nullValues
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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)
示例4: testCompare_nonNumericChrom
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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))
示例5: test_parse_record_removesNewlines
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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"])
示例6: test_parse_record_initsSampleTagValues
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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"])
示例7: test_format_field_preservesOrderWhenAddingNewTags
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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())
示例8: test_add_tag_values_nullValues
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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())
示例9: test_add_tag_values
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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())
示例10: test_empty_record
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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())
示例11: test_insert_format_field_failsOnInvalidSampleDict
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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}
)
示例12: test_add_tag_values_nonePassed
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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])
示例13: test_add_sample_format_value
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
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())
示例14: test_parse_record
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
def test_parse_record(self):
sample_names = ["SampleA", "SampleB"]
input_line = self.entab("CHROM|POS|ID|REF|ALT|QUAL|FILTER|INFO|FOO:BAR|SA_foo:SA_bar|SB_foo:SB_bar\n")
record = VcfRecord.parse_record(input_line, sample_names)
self.assertEquals("CHROM", record.chrom)
self.assertEquals("POS", record.pos)
self.assertEquals("ID", record.vcf_id)
self.assertEquals("REF", record.ref)
self.assertEquals("ALT", record.alt)
self.assertEquals("QUAL", record.qual)
self.assertEquals("FILTER", record.filter)
self.assertEquals("INFO", record.info)
示例15: testCompare_orderingByNumericChromAndPos
# 需要导入模块: from jacquard.utils.vcf import VcfRecord [as 别名]
# 或者: from jacquard.utils.vcf.VcfRecord import parse_record [as 别名]
def testCompare_orderingByNumericChromAndPos(self):
sample_names = ["SampleA"]
expected_records = [
VcfRecord.parse_record(self.entab("1|1|ID|A|A|QUAL|FILTER|INFO|F|S\n"), sample_names),
VcfRecord.parse_record(self.entab("2|1|ID|A|A|QUAL|FILTER||foo|S\n"), sample_names),
VcfRecord.parse_record(self.entab("10|1|ID|A|A|QUAL|FILTER|INFO|F|S\n"), sample_names),
VcfRecord.parse_record(self.entab("11|1|ID|C|A|QUAL|FILTER|INFO|F|S\n"), sample_names),
VcfRecord.parse_record(self.entab("20|1|ID|A|A|QUAL|FILTER|INFO|F|S\n"), sample_names),
VcfRecord.parse_record(self.entab("M|1|ID|A|A|QUAL|FILTER|INFO|F|S\n"), sample_names),
VcfRecord.parse_record(self.entab("X|1|ID|A|A|QUAL|FILTER|INFO|F|S\n"), sample_names),
]
input_records = expected_records[::-1]
self.assertEquals(expected_records, sorted(input_records))