Mercurial > repos > estrain > seqsero_v1
comparison SeqSero/SeqSero.py @ 0:b0e627ec0dda draft
Uploaded
| author | estrain |
|---|---|
| date | Wed, 06 Dec 2017 15:17:29 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:b0e627ec0dda |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 ############################################################################ | |
| 4 # Copyright (c) 2014-2015 University of Georgia | |
| 5 # All Rights Reserved | |
| 6 ############################################################################ | |
| 7 | |
| 8 import argparse,os,sys,time,random | |
| 9 | |
| 10 def main(): | |
| 11 parser = argparse.ArgumentParser(usage='SeqSero.py -m <data_type> -i <input_data> [-b <BWA_algorithm>]\n\nDevelopper: Shaokang Zhang (zskzsk@uga.edu) and Xiangyu Deng (xdeng@uga.edu)\n\nContact email:seqsero@gmail.com') | |
| 12 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)") | |
| 13 parser.add_argument("-i", nargs="+", help="<string>: path/to/input_data") | |
| 14 parser.add_argument("-b",choices=['sam','mem','nanopore'],default="sam",help="<string>: 'sam'(bwa samse/sampe), 'mem'(bwa mem), default=sam") | |
| 15 args=parser.parse_args() | |
| 16 dirpath = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) | |
| 17 if len(sys.argv)==1: | |
| 18 os.system(dirpath+"/SeqSero.py -h") | |
| 19 else: | |
| 20 request_id = time.strftime("%m_%d_%Y_%H_%M_%S", time.localtime()) | |
| 21 request_id += str(random.randint(1, 10000000)) | |
| 22 make_dir="SeqSero_result_"+request_id | |
| 23 os.system("mkdir "+make_dir) | |
| 24 os.system("cp -rf "+dirpath+"/database "+make_dir) | |
| 25 mode_choice=args.m | |
| 26 mapping_mode=args.b | |
| 27 dataset=args.i | |
| 28 if mode_choice=="1": | |
| 29 print dataset[0] | |
| 30 os.system("cp "+dataset[0]+" "+make_dir) | |
| 31 os.chdir(make_dir) | |
| 32 os.system("python2.7 "+dirpath+"/libs/run_auto_All_for_web_multi_revise.py "+dataset[0].split("/")[-1]+" "+mapping_mode+" 1") | |
| 33 print "\n\n\nResult:\n" | |
| 34 os.system("cat Seqsero_result.txt") | |
| 35 os.system("rm "+dataset[0].split("/")[-1]) | |
| 36 elif mode_choice=="2": | |
| 37 os.system("cp "+dataset[0]+" "+make_dir) | |
| 38 os.system("cp "+dataset[1]+" "+make_dir) | |
| 39 fnameA=dataset[0].split("/")[-1] | |
| 40 fnameB=dataset[1].split("/")[-1] | |
| 41 os.chdir(make_dir) | |
| 42 print "check fastq id and make them in accordance with each other...please wait..." | |
| 43 os.system("python2.7 "+dirpath+"/libs/run_auto_All_for_web_multi_revise.py "+fnameA+" "+mapping_mode+" "+fnameB+" 2") | |
| 44 print "\n\n\nResult:\n" | |
| 45 os.system("cat Seqsero_result.txt") | |
| 46 elif mode_choice=="3": | |
| 47 os.system("cp "+dataset[0]+" "+make_dir) | |
| 48 os.chdir(make_dir) | |
| 49 os.system("python2.7 "+dirpath+"/libs/run_auto_All_for_web_multi_revise.py "+dataset[0].split("/")[-1]+" "+mapping_mode+" 3") | |
| 50 print "\n\n\nResult:\n" | |
| 51 os.system("cat Seqsero_result.txt") | |
| 52 elif mode_choice=="4": | |
| 53 os.system("cp "+dataset[0]+" "+make_dir) | |
| 54 os.chdir(make_dir) | |
| 55 os.system("python2.7 "+dirpath+"/libs/run_auto_All_for_assemblies.py "+dataset[0].split("/")[-1]) | |
| 56 print "\n\n\nResult:\n" | |
| 57 os.system("cat Seqsero_result.txt") | |
| 58 | |
| 59 if __name__ == '__main__': | |
| 60 main() |
