diff bin/SeqSero2_package.py @ 8:357e38526e2a draft

planemo upload commit c50df40caef2fb97c178d6890961e0e527992324-dirty
author cstrittmatter
date Thu, 30 Apr 2020 21:16:45 -0400
parents aa54a94b9aeb
children e6437d423693
line wrap: on
line diff
--- a/bin/SeqSero2_package.py	Mon Apr 27 19:39:25 2020 -0400
+++ b/bin/SeqSero2_package.py	Thu Apr 30 21:16:45 2020 -0400
@@ -22,7 +22,7 @@
 ### SeqSero Kmer
 def parse_args():
     "Parse the input arguments, use '-h' for help."
-    parser = argparse.ArgumentParser(usage='SeqSero2_package.py -t <data_type> -m <mode> -i <input_data> [-d <output_directory>] [-p <number of threads>] [-b <BWA_algorithm>]\n\nDevelopper: Shaokang Zhang (zskzsk@uga.edu), Hendrik C Den-Bakker (Hendrik.DenBakker@uga.edu) and Xiangyu Deng (xdeng@uga.edu)\n\nContact email:seqsero@gmail.com\n\nVersion: v1.1.0')#add "-m <data_type>" in future
+    parser = argparse.ArgumentParser(usage='SeqSero2_package.py -t <data_type> -m <mode> -i <input_data> [-d <output_directory>] [-p <number of threads>] [-b <BWA_algorithm>]\n\nDevelopper: Shaokang Zhang (zskzsk@uga.edu), Hendrik C Den-Bakker (Hendrik.DenBakker@uga.edu) and Xiangyu Deng (xdeng@uga.edu)\n\nContact email:seqsero@gmail.com\n\nVersion: v1.1.1')#add "-m <data_type>" in future
     parser.add_argument("-i",nargs="+",help="<string>: path/to/input_data",type=os.path.abspath)  ### add 'type=os.path.abspath' to generate absolute path of input data.
     parser.add_argument("-t",choices=['1','2','3','4','5','6'],help="<int>: '1' for interleaved paired-end reads, '2' for separated paired-end reads, '3' for single reads, '4' for genome assembly, '5' for nanopore fasta, '6' for nanopore fastq")
     parser.add_argument("-b",choices=['sam','mem'],default="mem",help="<string>: algorithms for bwa mapping for allele mode; 'mem' for mem, 'sam' for samse/sampe; default=mem; optional; for now we only optimized for default 'mem' mode")
@@ -1240,13 +1240,11 @@
   print(samid_strcmd)
   salmID_output=subprocess.Popen(samid_strcmd,shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
   out, err = salmID_output.communicate()
-  print(err)
-  print(out)
+  print("judge_subspecies -> err = salmID_output.communicate() " + err)
   out=out.decode("utf-8")
   file=open("data_log.txt","a")
   file.write(out)
   file.close()
-  
   salm_species_scores=out.split("\n")[1].split("\t")[6:]
   salm_species_results=out.split("\n")[0].split("\t")[6:]
   max_score=0
@@ -1264,7 +1262,6 @@
     prediction="-"
   return prediction
 
-
 def judge_subspecies_Kmer(Special_dict):
   #seqsero2 -k;
   max_score=0
@@ -1331,10 +1328,11 @@
     request_id += str(random.randint(1, 10000000))
     if make_dir is None:
       make_dir="SeqSero_result_"+request_id
+    make_dir=os.path.abspath(make_dir)
     if os.path.isdir(make_dir):
       pass
     else:
-      subprocess.check_call(["mkdir",make_dir])
+      subprocess.check_call("mkdir -p "+make_dir,shell=True)
     #subprocess.check_call("cp "+dirpath+"/"+database+" "+" ".join(input_file)+" "+make_dir,shell=True)
     #subprocess.check_call("ln -sr "+dirpath+"/"+database+" "+" ".join(input_file)+" "+make_dir,shell=True)
     subprocess.check_call("ln -f -s "+seqsero2_db+" "+" ".join(input_file)+" "+make_dir,shell=True) # ed_SL_11092019: change path to database for packaging