comparison SeqSero2.py @ 0:4ff2aee11e5b

planemo upload
author jpayne
date Tue, 06 Nov 2018 09:45:57 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4ff2aee11e5b
1 #!/usr/bin/env python
2
3 ############################################################################
4 # Copyright (c) 2014-2015 University of Georgia
5 # Developer: Shaokang Zhang, zskzsk@uga.edu
6 # All Rights Reserved
7 ############################################################################
8
9 import argparse,os,sys,time,random
10
11 def main():
12 parser = argparse.ArgumentParser(usage='SeqSero2.py -i <input_data> [-p <number of threads>] [-b <BWA_algorithm>]\n\nDevelopper: Shaokang Zhang (zskzsk@uga.edu) and Xiangyu Deng (xdeng@uga.edu)\n\nContact email:seqsero@gmail.com')#add "-m <data_type>" in future
13 parser.add_argument("-i",nargs="+", help="<string>: path/to/input_data")
14 parser.add_argument("-b",choices=['sam','mem'],default="mem",help="<string>: 'sam'(bwa samse/sampe), 'mem'(bwa mem),default=mem")
15 parser.add_argument("-p",default="1",help="<int>: if p>4, only 4 threads will be used for assembly, default=1")
16 args=parser.parse_args()
17 dirpath = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
18 if len(sys.argv)==1:
19 os.system(dirpath+"/SeqSero2.py -h")
20 else:
21 request_id = time.strftime("%m_%d_%Y_%H_%M_%S", time.localtime())
22 request_id += str(random.randint(1, 10000000))
23 make_dir="SeqSero_result_"+request_id
24 os.system("mkdir "+make_dir)
25 os.system("cp -rf "+dirpath+"/database/H_and_O_and_specific_genes.fasta "+make_dir)
26 #mode_choice=args.m
27 mapping_mode=args.b
28 threads=args.p
29 dataset=args.i
30 os.system("cp "+dataset[0]+" "+make_dir)
31 # print len(dataset)
32 os.system("cp "+dataset[1]+" "+make_dir)
33 fnameA=dataset[0].split("/")[-1]
34 fnameB=dataset[1].split("/")[-1]
35 os.chdir(make_dir)
36 os.system("python2.7 "+dirpath+"/libs/mapping_and_assembly_hybrid.py H_and_O_and_specific_genes.fasta "+mapping_mode+" "+str(threads)+" "+fnameA+" "+fnameB)
37 os.system("rm H_and_O_and_specific_genes.fasta* *.bam *.sam *.fastq *.fastq.gz *.fq temp.txt *.xml "+fnameA+"*_db* 2> /dev/null")
38 #print "Output_directory:",make_dir
39 #print "\n\n\nResult:\n"
40 #os.system("cat Seqsero_result.txt")
41
42 if __name__ == '__main__':
43 main()