-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathSeqPrepMP.py
52 lines (42 loc) · 1.4 KB
/
SeqPrepMP.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
45
46
47
48
49
50
51
52
import os
import sys
from multiprocessing import Pool, cpu_count
runPath = ""
def mergeDNA(idTag):
fqF = runPath + "/d1_" + idTag + ".fq.gz"
fqR = runPath + "/d2_" + idTag + ".fq.gz"
dis1 = runPath + "/dis_d1_" + idTag + ".fq.gz"
dis2 = runPath + "/dis_d2_" + idTag + ".fq.gz"
mg = runPath + "/dm_" + idTag + ".fq.gz"
ret = os.system("SeqPrep -f %s -r %s -1 %s -2 %s -s %s" % (fqF, fqR, dis1, dis2, mg))
return ret
def mergeRNA(idTag):
fqF = runPath + "/r1_" + idTag + ".fq.gz"
fqR = runPath + "/r2_" + idTag + ".fq.gz"
dis1 = runPath + "/dis_r1_" + idTag + ".fq.gz"
dis2 = runPath + "/dis_r2_" + idTag + ".fq.gz"
mg = runPath + "/rm_" + idTag + ".fq.gz"
ret = os.system("SeqPrep -f %s -r %s -1 %s -2 %s -s %s" % (fqF, fqR, dis1, dis2, mg))
return ret
def mergeAllDNA():
idListFile = runPath + "idListDNA"
with open(idListFile) as f:
idList = f.read().splitlines()
p = Pool(cpu_count())
id = 0
for x in p.imap(mergeDNA, idList):
id += 1
return id
def mergeAllRNA():
idListFile = runPath + "idListRNA"
with open(idListFile) as f:
idList = f.read().splitlines()
p = Pool(cpu_count())
id = 0
for y in p.imap(mergeRNA, idList):
id += 1
return id
if __name__ == "__main__":
runPath = sys.argv[1]
mergeAllDNA()
mergeAllRNA()