Mercurial > repos > p.lucas > ssuisserotyping_pipeline
comparison Prepare_Ssuis_serotypingPipeline.py @ 1:8164dae8b281 draft
Uploaded
| author | p.lucas |
|---|---|
| date | Thu, 09 May 2019 04:14:32 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:135510a99b5a | 1:8164dae8b281 |
|---|---|
| 1 #!/usr/bin/python | |
| 2 #-*- coding: utf-8 -*- | |
| 3 #Libraries: | |
| 4 import os, os.path, argparse, sys, gzip, re | |
| 5 | |
| 6 | |
| 7 | |
| 8 ##### MAIN | |
| 9 def __main__(): | |
| 10 ### Arguments: | |
| 11 parser = argparse.ArgumentParser(description='''Launch Ssuis_serotypingPipeline.pl with correct argument''', epilog="""This script needs few options use -h to see it.""") | |
| 12 | |
| 13 parser.add_argument('--fastq_file', dest='ffile') | |
| 14 parser.add_argument('--scoreName', dest='sname') | |
| 15 parser.add_argument('--output2', dest='o2') | |
| 16 parser.add_argument('--output3', dest='o3') | |
| 17 parser.add_argument('--output4', dest='o4') | |
| 18 parser.add_argument('--output5', dest='o5') | |
| 19 parser.add_argument('--output6', dest='o6') | |
| 20 parser.add_argument('--output7', dest='o7') | |
| 21 parser.add_argument('--output8', dest='o8') | |
| 22 parser.add_argument('--serotype_db', dest='sd') | |
| 23 parser.add_argument('--serotype_definitions', dest='sdef') | |
| 24 parser.add_argument('--cps2K', dest='cps') | |
| 25 parser.add_argument('--Virulence_db', dest='Vdb') | |
| 26 parser.add_argument('--recN_db', dest='recdb') | |
| 27 parser.add_argument('--MLST_definitions', dest='MLSTdef') | |
| 28 parser.add_argument('--MLST_db', dest='MLSTdb') | |
| 29 parser.add_argument('--ends', dest='ends') | |
| 30 parser.add_argument('--forward', dest='f') | |
| 31 parser.add_argument('--reverse', dest='r') | |
| 32 | |
| 33 ### Get argument in variable: | |
| 34 options = parser.parse_args() | |
| 35 ffile = options.ffile | |
| 36 sname = options.sname | |
| 37 output2 = options.o2 | |
| 38 output3 = options.o3 | |
| 39 output4 = options.o4 | |
| 40 output5 = options.o5 | |
| 41 output6 = options.o6 | |
| 42 output7 = options.o7 | |
| 43 output8 = options.o8 | |
| 44 sd = options.sd | |
| 45 sdef = options.sdef | |
| 46 cps = options.cps | |
| 47 Vdb = options.Vdb | |
| 48 recdb = options.recdb | |
| 49 MLSTdef = options.MLSTdef | |
| 50 MLSTdb = options.MLSTdb | |
| 51 ends = options.ends | |
| 52 f = options.f | |
| 53 r = options.r | |
| 54 | |
| 55 way_pipeline = "/results/anses/bin/SsuisSerotyping_pipeline/" | |
| 56 input_path = os.path.splitext(output2)[0]+"_input_file_test/" | |
| 57 output_path = os.path.splitext(output2)[0]+"_Results/" | |
| 58 os.system("mkdir -p "+input_path) | |
| 59 os.system("cp "+ffile+" "+input_path+"/file_test.fastq") | |
| 60 fdir = input_path | |
| 61 | |
| 62 if ends == "se": | |
| 63 f = "SINGLE" | |
| 64 r = "SINGLE" | |
| 65 | |
| 66 if sd is None: | |
| 67 os.system("perl "+way_pipeline+"/Ssuis_serotypingPipeline.pl --fastq_directory "+str(fdir)+" --scoreName "+output_path+"Results --ends "+str(ends)+" --forward "+str(f)+" --reverse "+str(r)) | |
| 68 else: | |
| 69 os.system("perl "+way_pipeline+"/Ssuis_serotypingPipeline.pl --fastq_directory "+str(fdir)+" --scoreName "+output_path+"Results --serotype_db "+str(sd)+" --serotype_definitions "+str(sdef)+" --cps2K "+str(cps)+" --Virulence_db "+str(Vdb)+" --recN_db "+str(recdb)+" --MLST_definitions "+str(MLSTdef)+" --MLST_db "+str(MLSTdb)+" --ends "+str(ends)+" --forward "+str(f)+" --reverse "+str(r)) | |
| 70 | |
| 71 os.system("rm -r "+fdir) | |
| 72 os.system("mv "+output_path+"/Results_FinalResults.txt "+sname) | |
| 73 os.system("mv "+output_path+"/Results_MLSTResults.txt "+output2) | |
| 74 os.system("mv "+output_path+"/Results_recN__fullgenes__recN_full__results.txt "+output3) | |
| 75 os.system("mv "+output_path+"/Results_speciesConfirmation.txt "+output4) | |
| 76 os.system("mv "+output_path+"/Results_FinalSerotypingResults.txt "+output5) | |
| 77 os.system("mv "+output_path+"/Results_InitialCapsuleResults.txt "+output6) | |
| 78 os.system("mv "+output_path+"/Results_VirulenceFactors__fullgenes__Virulence__results.txt "+output7) | |
| 79 os.system("mv "+output_path+"/Results_VirulenceFactorResults.txt "+output8) | |
| 80 #### MAIN END | |
| 81 if __name__ == "__main__": __main__() | |
| 82 |
