def test_get_ensembl_id_single_isoform(self):
     fetcher = dba.UniprotFetcher()
     xml_soup = fetcher.fetch('P61258', 'xml')
     parser = dba.UniprotParser(xml_soup, None)
     exp = 'ENSMFAG00000036845'
     res = parser.get_ensembl_references()
     self.assertEqual(res, exp)
 def test_get_ensembl_id_non_matching_isoform(self):
     fetcher = dba.UniprotFetcher()
     xml_soup = fetcher.fetch('Q9UJ41', 'xml')
     parser = dba.UniprotParser(xml_soup, None)
     exp = '*ENSG00000154710'
     res = parser.get_ensembl_references(isoform_number=3)
     self.assertEqual(res, exp)
 def __init__(self, *args, **kwargs):
     super(TestUniprotParser, self).__init__(*args, **kwargs)
     fetcher = dba.UniprotFetcher()
     self.xml_soup = fetcher.fetch('Q9NWV8', 'xml')
     self.html_soup = fetcher.fetch('Q9NWV8', 'html')
     self.protein_seq = fetcher.fetch('Q9NWV8', 'sequence')
     self.maxDiff = None
 def test_get_ensembl_id_isoform1(self):
     fetcher = dba.UniprotFetcher()
     xml_soup = fetcher.fetch('Q9NWV8', 'xml')
     parser = dba.UniprotParser(xml_soup, None)
     exp = 'ENSG00000105393'
     res = parser.get_ensembl_references()
     self.assertEqual(res, exp)
 def test_returns_beautifulsoup(self):
     fetcher = dba.UniprotFetcher()
     result = fetcher.fetch('q9uj41', 'xml')
     self.assertTrue(type(BeautifulSoup('<a></a>', 'xml') == type(result)))
     result = fetcher.fetch('q9uj41', 'html')
     self.assertTrue(
         type(BeautifulSoup('<a></a>', 'html.parser') == type(result)))
 def test_common_name_not_in_entry(self):
     fetcher = dba.UniprotFetcher()
     self.parser.xml_soup = fetcher.fetch('Q7JKC3', 'xml')
     self.assertEqual(self.parser.get_common_name(), '')
 def test_returns_fasta(self):
     fetcher = dba.UniprotFetcher()
     result = fetcher.fetch('q9uj41', 'sequence')
     expected = q9uj41_2_protein_seq  # sequence at end of file
     self.assertEqual(result, expected)
 def test_nonexistent_id(self):
     fetcher = dba.UniprotFetcher()
     nonexistent_id = 'ThisDoesNotExist'
     for format_ in self.formats:
         with self.assertRaises(IdNotFoundError):
             fetcher.fetch(nonexistent_id, format_)
 def test_wrong_format(self):
     fetcher = dba.UniprotFetcher()
     with self.assertRaises(ValueError):
         fetcher.fetch('Q9UJ41', 'NonSupportedFormat')