コード例 #1
0
def blast(Gene_id, Blast_data):

    ID = []
    i = 0

    file1 = open(Gene_id, "r")
    file2 = open(Blast_data, "w")

    for k in file1:
        ID.append(k)

    while i != len(ID):
        for id in TogoWS.search_iter("gene", ID[i], limit=1):
            file2.write(id)
            i += 1
コード例 #2
0
ファイル: test_TogoWS.py プロジェクト: biopython/biopython
    def check(self, database, search_term, expected_matches=(), limit=None):
        if expected_matches and limit:
            raise ValueError("Bad test - TogoWS makes no promises about order")
        search_count = TogoWS.search_count(database, search_term)
        if expected_matches and search_count < len(expected_matches):
            raise ValueError("Only %i matches, expected at least %i" % (search_count, len(expected_matches)))
        if search_count > 5000 and not limit:
            print("%i results, skipping" % search_count)
            return
        if limit:
            count = min(search_count, limit)
        else:
            count = search_count

        # Iteration should find everything... unless a limit is used
        search_iter = list(TogoWS.search_iter(database, search_term, limit))
        self.assertEqual(count, len(search_iter))
        for match in expected_matches:
            self.assertTrue(match in search_iter, "Expected %s in results but not" % match)
コード例 #3
0
ファイル: test_TogoWS.py プロジェクト: olgabot/biopython
    def check(self, database, search_term, expected_matches=[], limit=None):
        if expected_matches and limit:
            raise ValueError("Bad test - TogoWS makes no promises about order")
        search_count = TogoWS.search_count(database, search_term)
        if expected_matches and search_count < len(expected_matches):
            raise ValueError("Only %i matches, expected at least %i" \
                             % (search_count, len(expected_matches)))
        if search_count > 5000 and not limit:
            print "%i results, skipping" % search_count
            return
        if limit:
            count = min(search_count, limit)
        else:
            count = search_count

        #Iteration should find everything... unless a limit is used
        search_iter = list(TogoWS.search_iter(database, search_term, limit))
        self.assertEqual(count, len(search_iter))
        for match in expected_matches:
            self.assert_(match in search_iter,
                         "Expected %s in results but not" % match)
コード例 #4
0
    def check(self, database, search_term, expected_matches=(), limit=None):
        if expected_matches and limit:
            raise ValueError("Bad test - TogoWS makes no promises about order")
        try:
            search_count = TogoWS.search_count(database, search_term)
        except HTTPError as err:
            raise ValueError("%s from %s" % (err, err.url)) from None
        if expected_matches:
            self.assertGreaterEqual(search_count, len(expected_matches))
        if search_count > 5000 and not limit:
            print("%i results, skipping" % search_count)
            return
        if limit:
            count = min(search_count, limit)
        else:
            count = search_count

        # Iteration should find everything... unless a limit is used
        search_iter = list(TogoWS.search_iter(database, search_term, limit))
        self.assertEqual(count, len(search_iter))
        for match in expected_matches:
            self.assertIn(match, search_iter, "Expected %s in results" % match)