-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathSeqSero.py
executable file
·63 lines (59 loc) · 3.03 KB
/
SeqSero.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
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python
############################################################################
# Copyright (c) 2014-2015 University of Georgia
# All Rights Reserved
############################################################################
import argparse,os,sys,time,random
def main():
parser = argparse.ArgumentParser(usage='SeqSero.py -m <data_type> -i <input_data> [-b <BWA_algorithm>]\n\nDevelopper: Shaokang Zhang ([email protected]) and Xiangyu Deng ([email protected])\n\nContact email:[email protected]')
parser.add_argument("-m", choices=['1','2','3', '4'],help="<int>: '1'(pair-end reads, interleaved),'2'(pair-end reads, seperated),'3'(single-end reads), '4'(assembly)")
parser.add_argument("-i", nargs="+", help="<string>: path/to/input_data")
parser.add_argument("-b",choices=['sam','mem','nanopore'],default="sam",help="<string>: 'sam'(bwa samse/sampe), 'mem'(bwa mem), default=sam")
parser.add_argument("-d",help="<string>: output directory name, if not set, the output directory would be 'SeqSero_result_'+time stamp+one random number")
args=parser.parse_args()
dirpath = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
if len(sys.argv)==1:
os.system(dirpath+"/SeqSero.py -h")
else:
request_id = time.strftime("%m_%d_%Y_%H_%M_%S", time.localtime())
request_id += str(random.randint(1, 10000000))
make_dir=args.d
if make_dir is None:
make_dir="SeqSero_result_"+request_id
os.system("mkdir "+make_dir)
os.system("cp -rf "+dirpath+"/database "+make_dir)
mode_choice=args.m
mapping_mode=args.b
dataset=args.i
if mode_choice=="1":
print dataset[0]
os.system("cp "+dataset[0]+" "+make_dir)
os.chdir(make_dir)
os.system("python2.7 "+dirpath+"/libs/run_auto_All_for_web_multi_revise.py "+dataset[0].split("/")[-1]+" "+mapping_mode+" 1")
print "\n\n\nResult:\n"
os.system("cat Seqsero_result.txt")
os.system("rm "+dataset[0].split("/")[-1])
elif mode_choice=="2":
os.system("cp "+dataset[0]+" "+make_dir)
os.system("cp "+dataset[1]+" "+make_dir)
fnameA=dataset[0].split("/")[-1]
fnameB=dataset[1].split("/")[-1]
os.chdir(make_dir)
print "check fastq id and make them in accordance with each other...please wait..."
os.system("python2.7 "+dirpath+"/libs/run_auto_All_for_web_multi_revise.py "+fnameA+" "+mapping_mode+" "+fnameB+" 2")
print "\n\n\nResult:\n"
os.system("cat Seqsero_result.txt")
elif mode_choice=="3":
os.system("cp "+dataset[0]+" "+make_dir)
os.chdir(make_dir)
os.system("python2.7 "+dirpath+"/libs/run_auto_All_for_web_multi_revise.py "+dataset[0].split("/")[-1]+" "+mapping_mode+" 3")
print "\n\n\nResult:\n"
os.system("cat Seqsero_result.txt")
elif mode_choice=="4":
os.system("cp "+dataset[0]+" "+make_dir)
os.chdir(make_dir)
os.system("python2.7 "+dirpath+"/libs/run_auto_All_for_assemblies.py "+dataset[0].split("/")[-1])
print "\n\n\nResult:\n"
os.system("cat Seqsero_result.txt")
if __name__ == '__main__':
main()