-
Notifications
You must be signed in to change notification settings - Fork 2
/
pssmParallel.py
45 lines (27 loc) · 869 Bytes
/
pssmParallel.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
35
36
37
38
39
40
41
42
43
44
# In[46]:
numberThread=2500
import os
import glob
from multiprocessing import Process
os.chdir('/home/mrz/Desktop/Bk/PSSM/') #Please, set path where PSSM directory is located.
Files = os.listdir()
print(Files)
# In[47]:
def run(file):
try:
os.system('psiblast -query {} -db ../../nr/nr -out {}.out -num_iterations 3 -out_ascii_pssm {}.pssm -inclusion_ethresh 0.001 -num_threads {}'.format(file, file, file, numberThread))
except:
print('File Error is {}!'.format(file))
P = []
def beginParallel(): [p.start() for p in P]
def endParallel(): [p.join() for p in P]
def parallel():
for file in glob.glob('*.fasta'): # Run only *.fasta
P.append(Process(target=run, args=(file,)))
beginParallel()
endParallel()
#%%
import time
begin = time.time()
parallel()
print(time.time()-begin)