Exemple #1
0
 def test_two(self):
     """MinimalClustalParser should handle two-sequence input correctly"""
     result = MinimalClustalParser(two)
     self.assertEqual(result, ({
         "abc": ["uuu", "aaa"],
         "def": ["ccc", "ggg"]
     }, ["abc", "def"]))
Exemple #2
0
 def test_space_labels(self):
     """MinimalClustalParser should tolerate spaces in labels"""
     result = MinimalClustalParser(space_labels)
     self.assertEqual(result, ({
         "abc": ["uca"],
         "def ggg": ["ccc"]
     }, ["abc", "def ggg"]))
Exemple #3
0
 def test_real(self):
     """MinimalClustalParser should handle real Clustal output"""
     data, labels = MinimalClustalParser(real)
     self.assertEqual(labels, ["abc", "def", "xyz"])
     self.assertEqual(
         data,
         {
             "abc": [
                 "GCAUGCAUGCAUGAUCGUACGUCAGCAUGCUAGACUGCAUACGUACGUACGCAUGCAUCA",
                 "GUCGAUACGUACGUCAGUCAGUACGUCAGCAUGCAUACGUACGUCGUACGUACGU-CGAC",
                 "UGACUAGUCAGCUAGCAUCGAUCAGU",
             ],
             "def": [
                 "------------------------------------------------------------",
                 "-----------------------------------------CGCGAUGCAUGCAU-CGAU",
                 "CGAUCAGUCAGUCGAU----------",
             ],
             "xyz": [
                 "------------------------------------------------------------",
                 "-------------------------------------CAUGCAUCGUACGUACGCAUGAC",
                 "UGCUGCAUCA----------------",
             ],
         },
     )
Exemple #4
0
 def test_minimal(self):
     """MinimalClustalParser should handle single-line input correctly"""
     result = MinimalClustalParser([minimal])  # expects seq of lines
     self.assertEqual(result, ({"abc": ["ucag"]}, ["abc"]))
Exemple #5
0
 def test_null(self):
     """MinimalClustalParser should return empty dict and list on null input"""
     result = MinimalClustalParser([])
     self.assertEqual(result, ({}, []))
Exemple #6
0
 def test_bad(self):
     """MinimalClustalParser should reject bad data if strict"""
     result = MinimalClustalParser(bad, strict=False)
     self.assertEqual(result, ({}, []))
     # should fail unless we turned strict processing off
     self.assertRaises(RecordError, MinimalClustalParser, bad)