1
|
1 #!/usr/bin/python
|
|
2 #-*- coding: utf-8 -*-
|
|
3 #Libraries:
|
|
4 import os, os.path, argparse, sys, gzip, re
|
|
5
|
|
6 ##### MAIN
|
|
7 def __main__():
|
|
8 ### Arguments:
|
|
9 parser = argparse.ArgumentParser(description='''Launch Ssuis_serotypingPipeline.pl with correct argument''', epilog="""This script needs few options use -h to see it.""")
|
|
10 parser.add_argument('--fastq_file', dest='ffile')
|
7
|
11 parser.add_argument('--fastq_file2', dest='ffile2')
|
1
|
12 parser.add_argument('--scoreName', dest='sname')
|
|
13 parser.add_argument('--output2', dest='o2')
|
|
14 parser.add_argument('--output3', dest='o3')
|
|
15 parser.add_argument('--output4', dest='o4')
|
|
16 parser.add_argument('--output5', dest='o5')
|
|
17 parser.add_argument('--output6', dest='o6')
|
|
18 parser.add_argument('--output7', dest='o7')
|
|
19 parser.add_argument('--output8', dest='o8')
|
|
20 parser.add_argument('--serotype_db', dest='sd')
|
|
21 parser.add_argument('--serotype_definitions', dest='sdef')
|
|
22 parser.add_argument('--cps2K', dest='cps')
|
|
23 parser.add_argument('--Virulence_db', dest='Vdb')
|
|
24 parser.add_argument('--recN_db', dest='recdb')
|
|
25 parser.add_argument('--MLST_definitions', dest='MLSTdef')
|
|
26 parser.add_argument('--MLST_db', dest='MLSTdb')
|
|
27 parser.add_argument('--ends', dest='ends')
|
|
28 parser.add_argument('--forward', dest='f')
|
|
29 parser.add_argument('--reverse', dest='r')
|
|
30
|
|
31 ### Get argument in variable:
|
|
32 options = parser.parse_args()
|
|
33 ffile = options.ffile
|
7
|
34 ffile2 = options.ffile2
|
1
|
35 sname = options.sname
|
|
36 output2 = options.o2
|
|
37 output3 = options.o3
|
|
38 output4 = options.o4
|
|
39 output5 = options.o5
|
|
40 output6 = options.o6
|
|
41 output7 = options.o7
|
|
42 output8 = options.o8
|
|
43 sd = options.sd
|
|
44 sdef = options.sdef
|
|
45 cps = options.cps
|
|
46 Vdb = options.Vdb
|
|
47 recdb = options.recdb
|
|
48 MLSTdef = options.MLSTdef
|
|
49 MLSTdb = options.MLSTdb
|
|
50 ends = options.ends
|
|
51 f = options.f
|
|
52 r = options.r
|
|
53
|
3
|
54 # Need to clone repo from git : https://github.com/streplab/SsuisSerotyping_pipeline.git
|
|
55 way_pipeline = "/nfs/bin/SsuisSerotyping_pipeline/"
|
1
|
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 fdir = input_path
|
|
60
|
|
61 if ends == "se":
|
|
62 f = "SINGLE"
|
|
63 r = "SINGLE"
|
4
|
64 os.system("cp "+ffile+" "+input_path+"/file_test.fastq")
|
|
65
|
|
66 elif ends == "pe":
|
|
67 os.system("cp "+ffile+" "+input_path+"/file_test"+f+".fastq")
|
7
|
68 os.system("cp "+ffile2+" "+input_path+"/file_test"+r+".fastq")
|
1
|
69
|
|
70 if sd is None:
|
|
71 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))
|
|
72 else:
|
|
73 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))
|
|
74
|
|
75 os.system("rm -r "+fdir)
|
|
76 os.system("mv "+output_path+"/Results_FinalResults.txt "+sname)
|
|
77 os.system("mv "+output_path+"/Results_MLSTResults.txt "+output2)
|
|
78 os.system("mv "+output_path+"/Results_recN__fullgenes__recN_full__results.txt "+output3)
|
|
79 os.system("mv "+output_path+"/Results_speciesConfirmation.txt "+output4)
|
|
80 os.system("mv "+output_path+"/Results_FinalSerotypingResults.txt "+output5)
|
|
81 os.system("mv "+output_path+"/Results_InitialCapsuleResults.txt "+output6)
|
|
82 os.system("mv "+output_path+"/Results_VirulenceFactors__fullgenes__Virulence__results.txt "+output7)
|
|
83 os.system("mv "+output_path+"/Results_VirulenceFactorResults.txt "+output8)
|
|
84 #### MAIN END
|
|
85 if __name__ == "__main__": __main__()
|
|
86
|