-
Notifications
You must be signed in to change notification settings - Fork 0
/
initblast.py
34 lines (30 loc) · 1002 Bytes
/
initblast.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import sys
from Utils import FetchUtil
import Reciprocal
from helpers.constants import BlastThresholds
if len(sys.argv) > 1:
query = sys.argv[1]
FetchUtil.set_email(sys.argv[2])
else:
query = input('Query: ')
FetchUtil.set_email(input('Email: '))
dom = FetchUtil.fetch_organism(query)
if dom[1] == 'Archaea':
thresh = BlastThresholds(arch=1e-10, bac=1e-5, euk=5)
elif dom[1] == 'Eukaryota':
thresh = BlastThresholds(arch=5, bac=5, euk=1e-10)
else:
thresh = BlastThresholds(arch=1e-5, bac=1e-10, euk=5)
orgs = ['Homo sapiens', 'Bacteroidota bacterium', 'Haloferax volcanii']
org_dict= zip(orgs, [thresh.euk, thresh.bac, thresh.arch])
init_acc = [Reciprocal.best_reciprocal_blast(k, query, v) for k,v in org_dict]
print(init_acc)
runs = []
for idx in range(len(init_acc)):
e = init_acc[idx]
if not e:
continue
print("Pass " + repr(idx))
for o in orgs:
runs.append(Reciprocal.best_reciprocal_blast(o, list(e.values())[0][0], 5))
print(runs)