def test_predict_self_defined_motifs_Bradi1g00260_2_p(self): dataset = [] for m in phytolrr_predictor.default_train_motifs: dataset.append(m[:11]) test_seq = 'MEMITMTLAVFVSCFHLPLLWSFLLQYLNFFSHSTYWKLSLVSCPVVLLSWHKLNSESLHGFARGRKYYHLSDMPSQWPGYWMVMLVLVVIMALSFISIHGQPDSHGFISIDCGYTASKQYVDSRTGLTYASDDGFIDAGLVHTVDSANLQPDLAVRYFNLRYFPSGPRNCYTFRSLTAGGKYLVRAAFGYGDYDKLNRLPTFDLYFGVNYWTTVTIVSSSTAYLFESIAVSPADFLQICLVNTGSGTPFISALDLRSLTANLYPEANVTQSMVLLSFFRDTVGFGPNRYHFGTNYQHIRFPDDPYDRIWQRYEDIASWTDLPNKSNGEIQNPPNDTYDAPSAVMRSASTPLNASAMDLSWSSDSSMSVGVNPTYILVLYFAELDASQDLRQFDVSVDNDLLLASAFSPKFLLATVLSGIVRGSGEHSISLTTTSNSVLDPLISAMEIFMVRPVNESATDSVDAWTMMTIQTKYSVKRNWVGDPCVPTSLAWDGLNCSYTPSSAPRITGLNMSSSGLVSEIDASFGQILLLQHLDLSHNSLSGSIPDFLGQLPALKFLDLSSNNLSGSIPCNLLEKSQNGLLALRVDNPNLHGDCAPRPVGSKNKI' matrix = pssm_matrix.calc_pssm_matrix(dataset) ms = phytolrr_predictor.predict(test_seq, matrix) ms.sort(key=lambda m: m.offset) ms = motifs_tools.found_no_overlapped_motifs(ms, 11) self.assertEqual(len(ms), 6)
def test_default_predict_Bradi1g00260_2_p(self): test_seq = 'MEMITMTLAVFVSCFHLPLLWSFLLQYLNFFSHSTYWKLSLVSCPVVLLSWHKLNSESLHGFARGRKYYHLSDMPSQWPGYWMVMLVLVVIMALSFISIHGQPDSHGFISIDCGYTASKQYVDSRTGLTYASDDGFIDAGLVHTVDSANLQPDLAVRYFNLRYFPSGPRNCYTFRSLTAGGKYLVRAAFGYGDYDKLNRLPTFDLYFGVNYWTTVTIVSSSTAYLFESIAVSPADFLQICLVNTGSGTPFISALDLRSLTANLYPEANVTQSMVLLSFFRDTVGFGPNRYHFGTNYQHIRFPDDPYDRIWQRYEDIASWTDLPNKSNGEIQNPPNDTYDAPSAVMRSASTPLNASAMDLSWSSDSSMSVGVNPTYILVLYFAELDASQDLRQFDVSVDNDLLLASAFSPKFLLATVLSGIVRGSGEHSISLTTTSNSVLDPLISAMEIFMVRPVNESATDSVDAWTMMTIQTKYSVKRNWVGDPCVPTSLAWDGLNCSYTPSSAPRITGLNMSSSGLVSEIDASFGQILLLQHLDLSHNSLSGSIPDFLGQLPALKFLDLSSNNLSGSIPCNLLEKSQNGLLALRVDNPNLHGDCAPRPVGSKNKI' ms = phytolrr_predictor.predict(test_seq) ms.sort(key=lambda m: m.offset) self.assertEqual(len(ms), 3) self.assertEqual([m.offset for m in ms], [506, 530, 554]) numpy.testing.assert_array_almost_equal( [m.score for m in ms], [14.0695893079814, 44.675678790101, 46.0801846076546])
def test_default_predict_AT1G05700_1(self): test_seq = 'MEEFRFLYLIYSAAFALCLVVSVLAQDQSGFISIDCGIPSGSSYKDDTTGINYVSDSSFVETGVSKSIPFTAQRQLQNLRSFPEGSRNCYTLIPIQGKGKKYLIRASFMYGNYDGENGSPEFDLFLGGNIWDTVLLSNGSSIVSKEVVYLSQSENIFVCLGNKGKGTPFISTLELRFLGNDNTTYDSPNGALFFSRRWDLRSLMGSPVRYDDDVYDRIWIPRNFGYCREINTSLPVTSDNNSYSLSSLVMSTAMTPINTTRPITMTLENSDPNVRYFVYMHFAEVEDLSLKPNQTREFDISINGVTVAAGFSPKYLQTNTFFLNPESQSKIAFSLVRTPKSTLPPIVNALEIYVANSFSQSLTNQEDGDAVTSLKTSYKVKKNWHGDPCLPNDYIWEGLNCSYDSLTPPRITSLNLSSSGLTGHISSSFSNLTMIQELDLSNNGLTGDIPEFLSKLKFLRVLNLENNTLTGSVPSELLERSNTGSFSLRLGENPGLCTEISCRKSNSKK' ms = phytolrr_predictor.predict(test_seq) ms.sort(key=lambda m: m.offset) self.assertEqual(len(ms), 3) self.assertEqual([m.offset for m in ms], [410, 434, 458]) numpy.testing.assert_array_almost_equal( [m.score for m in ms], [27.3503114204658, 39.1562104586186, 36.3811748663529])
def test_default_predict_AL1G15610_1(self): test_seq = 'METFRFLYLALFALCLIVSVLAQDQSGFISIDCGIPSGSSYKDDTTGINYVSDSSFVETGISKSIPFTSQRQLQNLRSFPEGSRNCYTLIPVQGKGRKYLIRASFMYGNYDGENDSPEFDLFLGGNIWDTVLLSNESSIVSKEVVYLSQSENIFVCLGNKGKGTPFISTLELRFLGNDNTTYDSPNGTLFFSRRWDFGSLMDSPVRYDEDVYDRIWIPRNFGYCREINTSLPVTSDNNSYSLSSLVMSTAMTPTNTTRPITMTLEDSDPNVRYFVYMHLAEVEDLSLKPNQTREFDIGINGVTVAAGFSPKYLQTNTFFLNPESQSKIVFSLVRTPKSTLPPIVNALEIYIANRVSQSLTNQEDGDAVTSLKTIYKVKKNWQGDPCLPNDYIWEGLNCSYDSLTPPRITSLNLSSSGLTGHISPSFSNLTMIQELDLSNNGLTGDIPEFLSKLKFLRVLNLEKNKLTGSVPSELLERSNSGSFLLRVGENPGLCIEISCRKSNSKK' ms = phytolrr_predictor.predict(test_seq) ms.sort(key=lambda m: m.offset) self.assertEqual(len(ms), 3) self.assertEqual([m.offset for m in ms], [407, 431, 455]) numpy.testing.assert_array_almost_equal( [m.score for m in ms], [27.3503114204658, 39.1562104586186, 36.2951803140635])
def test_default_predict_evm_27_model_AmTr_v1_0_scaffold00002_363(self): test_seq = 'MGILFFLFALTLTLSSLSSSVFGLTQDGEALLEMKRGLNDTKGLLSNWKDTDINPCNWTRISCHLHDQRVRVINLPFLRLGGTISPSIGKITRLHRLAIHENSLHGTIPAEIGNCTELRALYLRANYLEGGIPTELGRLSNLIILDLSSNSLRGSIPPSIGHLGRLRFLNLSTNFLSGEIPKTGVLGSFGNFSFIGNLDLCGPQVQRLCKGSLGFPAVLPGHVNDDEAVPPRRATS' ms = phytolrr_predictor.predict(test_seq) ms.sort(key=lambda m: m.offset) self.assertEqual(len(ms), 6) self.assertEqual([m.offset for m in ms], [6, 69, 93, 117, 141, 165]) numpy.testing.assert_array_almost_equal([m.score for m in ms], [ 10.7748224913081, 19.331539280432, 25.5300148879452, 29.7083175881698, 40.8018286797862, 40.0297399657356 ])
def predict_seqs(seqs: List[Sequence], training_dataset=None) -> List[PredictResult]: if training_dataset is None: matrix = None else: matrix = pssm_matrix.calc_pssm_matrix(training_dataset) rets = [] for seq in seqs: ret = phytolrr_predictor.predict(seq.seq, matrix) if ret is None: raise Exception("Unexpected error, None result when predicting " + seq.id) rets.append(PredictResult(seq, ret)) return rets