示例#1
0
def _read_sts(line):
    """Reads STS lines: format is in the full docstring.

    Format:
    Name|Chromosome|StsId|Segment|SequenceKnown|Evidence
    """
    return MappedRecord(sts_wrapper(line))
示例#2
0
文件: info.py 项目: wjjmjh/cogent3
    def __init__(self, *args, **kwargs):
        """Returns new Info object. Creates DbRefs if necessary."""
        temp = dict(*args, **kwargs)
        if "Refs" in temp:
            refs = temp["Refs"]
            if not isinstance(refs, DbRefs):
                refs = DbRefs(refs)
        else:
            refs = DbRefs()
        # move keys into refs if they belong there: allows init from flat dict
        for key, val in list(temp.items()):
            if key in KnownDatabases:
                refs[key] = val
                del temp[key]

        Delegator.__init__(self, refs)
        self["Refs"] = refs
        MappedRecord.__init__(self, temp)
示例#3
0
def _read_cdd(line):
    """Reads CDD lines: format is Name|Key|Score|EValue|BitScore."""
    return MappedRecord(cdd_wrapper(line))
示例#4
0
def _read_map(line):
    """Reads MAP lines: format is Location|Source|Type."""
    return MappedRecord(map_wrapper(line))
示例#5
0
 def test_init_data(self):
     """MappedRecord should work like normal dict init"""
     exp = {"a": 3, "b": 4}
     self.assertEqual(MappedRecord({"a": 3, "b": 4}), exp)
     self.assertEqual(MappedRecord(a=3, b=4), exp)
     self.assertEqual(MappedRecord([["a", 3], ["b", 4]]), exp)
示例#6
0
 def test_init_empty(self):
     """MappedRecord empty init should work OK"""
     g = MappedRecord()
     self.assertEqual(g, {})
示例#7
0
 def setUp(self):
     """Define a few standard MappedRecords"""
     self.empty = MappedRecord()
     self.single = MappedRecord({"a": 3})
     self.several = MappedRecord(a=4, b=5, c="a", d=[1, 2, 3])