jpayne@0: #!/usr/bin/env python jpayne@0: jpayne@0: ############################################################################ jpayne@0: # Copyright (c) 2014-2015 University of Georgia jpayne@0: # Developer: Shaokang Zhang, zskzsk@uga.edu jpayne@0: # All Rights Reserved jpayne@0: ############################################################################ jpayne@0: jpayne@0: import argparse,os,sys,time,random jpayne@0: jpayne@0: def main(): jpayne@0: parser = argparse.ArgumentParser(usage='SeqSero2.py -i [-p ] [-b ]\n\nDevelopper: Shaokang Zhang (zskzsk@uga.edu) and Xiangyu Deng (xdeng@uga.edu)\n\nContact email:seqsero@gmail.com')#add "-m " in future jpayne@0: parser.add_argument("-i",nargs="+", help=": path/to/input_data") jpayne@0: parser.add_argument("-b",choices=['sam','mem'],default="mem",help=": 'sam'(bwa samse/sampe), 'mem'(bwa mem),default=mem") jpayne@0: parser.add_argument("-p",default="1",help=": if p>4, only 4 threads will be used for assembly, default=1") jpayne@0: args=parser.parse_args() jpayne@0: dirpath = os.path.abspath(os.path.dirname(os.path.realpath(__file__))) jpayne@0: if len(sys.argv)==1: jpayne@0: os.system(dirpath+"/SeqSero2.py -h") jpayne@0: else: jpayne@0: request_id = time.strftime("%m_%d_%Y_%H_%M_%S", time.localtime()) jpayne@0: request_id += str(random.randint(1, 10000000)) jpayne@0: make_dir="SeqSero_result_"+request_id jpayne@0: os.system("mkdir "+make_dir) jpayne@0: os.system("cp -rf "+dirpath+"/database/H_and_O_and_specific_genes.fasta "+make_dir) jpayne@0: #mode_choice=args.m jpayne@0: mapping_mode=args.b jpayne@0: threads=args.p jpayne@0: dataset=args.i jpayne@0: os.system("cp "+dataset[0]+" "+make_dir) jpayne@0: # print len(dataset) jpayne@0: os.system("cp "+dataset[1]+" "+make_dir) jpayne@0: fnameA=dataset[0].split("/")[-1] jpayne@0: fnameB=dataset[1].split("/")[-1] jpayne@0: os.chdir(make_dir) jpayne@0: os.system("python2.7 "+dirpath+"/libs/mapping_and_assembly_hybrid.py H_and_O_and_specific_genes.fasta "+mapping_mode+" "+str(threads)+" "+fnameA+" "+fnameB) jpayne@0: os.system("rm H_and_O_and_specific_genes.fasta* *.bam *.sam *.fastq *.fastq.gz *.fq temp.txt *.xml "+fnameA+"*_db* 2> /dev/null") jpayne@0: #print "Output_directory:",make_dir jpayne@0: #print "\n\n\nResult:\n" jpayne@0: #os.system("cat Seqsero_result.txt") jpayne@0: jpayne@0: if __name__ == '__main__': jpayne@0: main()