예제 #1
0
 def test_core_ignore_invalid(self):
     "Test Lanthipeptide.core ignores invalid amino acids"
     lant = Lanthipeptide(23, 42, 17, 23, 'Class-I')
     self.assertEqual('', lant.core)
     assert lant.core_analysis is None
     lant.core = "MAGICXHAT"
     self.assertEqual('MAGICXHAT', lant.core)
     assert lant.core_analysis
예제 #2
0
 def test_core(self):
     "Test Lanthipeptide.core"
     lant = Lanthipeptide(23, 42, 17, 23, 'Class-I')
     self.assertEqual('', lant.core)
     assert lant.core_analysis is None
     lant.core = "MAGICHAT"
     self.assertEqual('MAGICHAT', lant.core)
     assert lant.core_analysis
예제 #3
0
    def test_result_vec_to_features(self):
        "Test lanthipeptides.result_vec_to_features()"
        orig_feature = DummyCDS(0, 165)
        orig_feature.locus_tag = 'FAKE0001'
        vec = Lanthipeptide(17, 23, 42, 23, 'Class-I')
        seq = "TAILTAILTAILTAILTAILTAILTAILTAILTAILCC"
        vec.core = seq
        vec.leader = "HEADHEADHEAD"
        motif = result_vec_to_feature(orig_feature, vec)
        assert motif.location.start == 0
        assert motif.location.end == 165
        assert motif.location.strand == 1
        assert motif.locus_tag == orig_feature.locus_tag
        assert motif.score == 42
        assert motif.rodeo_score == 23
        assert motif.peptide_class == "lanthipeptide"
        assert motif.peptide_subclass == "Class I"
        assert motif.lan_bridges == 2
        self.assertAlmostEqual(motif.molecular_weight, 3648.6, places=1)
        self.assertAlmostEqual(motif.monoisotopic_mass, 3646.3, places=1)
        for calc, expected in zip(
                motif.alternative_weights,
            [3666.6, 3684.6, 3702.7, 3720.7, 3738.7, 3756.7, 3774.7]):
            self.assertAlmostEqual(calc, expected, places=1)
        assert motif.core == seq
        assert motif.leader == vec.leader

        new_features = motif.to_biopython()
        self.assertEqual(2, len(new_features))
        leader, core = new_features

        self.assertEqual(0, leader.location.start)
        self.assertEqual((12 * 3), leader.location.end)
        self.assertEqual(leader.location.strand, 1)
        self.assertEqual('CDS_motif', leader.type)
        self.assertEqual(orig_feature.locus_tag,
                         leader.qualifiers['locus_tag'][0])
        self.assertEqual(
            set([
                'leader peptide', 'lanthipeptide',
                'predicted leader seq: HEADHEADHEAD'
            ]), set(leader.qualifiers['note']))

        self.assertEqual(leader.location.end, core.location.start)
        self.assertEqual(165, core.location.end)
        self.assertEqual(1, core.location.strand)
        self.assertEqual('CDS_motif', core.type)
        expected = [
            'core peptide', 'lanthipeptide', 'monoisotopic mass: 3646.3',
            'molecular weight: 3648.6',
            'alternative weights: 3666.6; 3684.6; 3702.7; 3720.7; 3738.7; 3756.7; 3774.7',
            'number of bridges: 2',
            'predicted core seq: TAILTAILTAILTAILTAILTAILTAILTAILTAILCC',
            'predicted class: Class I', 'score: 42.00', 'RODEO score: 23'
        ]
        self.assertEqual(set(expected), set(core.qualifiers['note']))
        self.assertEqual(orig_feature.locus_tag,
                         core.qualifiers['locus_tag'][0])
예제 #4
0
 def test_alternative_weights(self):
     "Test Lanthipeptide.alt_weights"
     lant = Lanthipeptide(23, 42, 17, 23, 'Class-I')
     lant.core = "MAGICHATS"
     analysis = ProteinAnalysis("MAGICHATS", monoisotopic=False)
     weight = analysis.molecular_weight()
     # One Ser/Thr is assumed to be dehydrated, but not the other
     weight -= 18.02
     self.assertEqual([weight], lant.alternative_weights)
예제 #5
0
 def test_molecular_weight(self):
     "Test Lanthipeptide.molecular_weight"
     lant = Lanthipeptide(23, 42, 17, 23, 'Class-I')
     lant.core = "MAGICHAT"
     analysis = ProteinAnalysis("MAGICHAT", monoisotopic=False)
     weight = analysis.molecular_weight()
     # Thr is assumed to be dehydrated
     weight -= 18.02
     self.assertAlmostEqual(weight, lant.molecular_weight)
     self.assertAlmostEqual(weight, lant._weight)
예제 #6
0
 def test_result_vec_to_features(self):
     "Test lanthipeptides.result_vec_to_features()"
     orig_feature = DummyCDS(0, 165)
     orig_feature.locus_tag = 'FAKE0001'
     seq = "TAILTAILTAILTAILTAILTAILTAILTAILTAILCC"
     vec = Lanthipeptide(CleavageSiteHit(23, 42, 'Class-I'), 23,
                         "HEADHEADHEAD", seq)
     motif = result_vec_to_feature(orig_feature, vec)
     assert motif.location.start == 0
     assert motif.location.end == 165
     assert motif.location.strand == 1
     assert motif.locus_tag == orig_feature.locus_tag
     assert motif.score == 42
     assert motif.detailed_information.rodeo_score == 23
     assert motif.peptide_class == "lanthipeptide"
     assert motif.peptide_subclass == "Class I"
     assert motif.detailed_information.lan_bridges == 2
     self.assertAlmostEqual(motif.molecular_weight, 3648.6, places=1)
     self.assertAlmostEqual(motif.monoisotopic_mass, 3646.3, places=1)
     for calc, expected in zip(
             motif.alternative_weights,
         [3666.6, 3684.6, 3702.7, 3720.7, 3738.7, 3756.7, 3774.7]):
         self.assertAlmostEqual(calc, expected, places=1)
     assert motif.core == seq
     assert motif.leader == vec.leader
예제 #7
0
 def test_init(self):
     "Test Lanthipeptide instantiation"
     lant = Lanthipeptide(23, 42, 17, 23, 'Class-I')
     self.assertTrue(isinstance(lant, Lanthipeptide))
     self.assertEqual(23, lant.start)
     self.assertEqual(42, lant.end)
     self.assertEqual(17, lant.score)
     self.assertEqual('Class-I', lant.lantype)
     self.assertEqual('', lant.core)
     with self.assertRaisesRegex(AssertionError,
                                 "calculating weight without a core"):
         print(lant.molecular_weight)
예제 #8
0
 def test_number_of_lan_bridges(self):
     "Test Lanthipeptide.number_of_lan_bridges"
     lant = Lanthipeptide(23, 42, 17, 23, 'Class-I')
     lant.core = "MAGICHAT"
     self.assertEqual(1, lant.number_of_lan_bridges)
     lant.core = "MAGICHATCS"
     self.assertEqual(2, lant.number_of_lan_bridges)
     lant.core = "MAGICHATCSS"
     self.assertEqual(2, lant.number_of_lan_bridges)
     lant.core = "MAGICHATCT"
     self.assertEqual(2, lant.number_of_lan_bridges)
     lant.core = "MAGICHATCCS"
     self.assertEqual(2, lant.number_of_lan_bridges)
예제 #9
0
 def setUp(self):
     self.lant = Lanthipeptide(CleavageSiteHit(42, 17, 'Class-I'), 23, "HEAD", "MAGICHAT")
예제 #10
0
 def test_repr(self):
     "Test Lanthipeptide representation"
     lant = Lanthipeptide(23, 42, 17, 23, 'Class-I')
     expected = "Lanthipeptide(23..42, 17, 'Class-I', '', -1, -1(-1))"
     self.assertEqual(expected, repr(lant))