comparison run_seqsero.py @ 3:38ad1130d077 draft

planemo upload commit a4fb57231f274270afbfebd47f67df05babffa4a-dirty
author charles_s_test
date Mon, 27 Nov 2017 11:21:07 -0500
parents 6895de35a263
children 3d6680af0bec
comparison
equal deleted inserted replaced
2:0d65b71ff8df 3:38ad1130d077
2 2
3 import os, re, sys, time, datetime 3 import os, re, sys, time, datetime
4 import subprocess 4 import subprocess
5 from subprocess import Popen, PIPE 5 from subprocess import Popen, PIPE
6 6
7 database = '/nfs/sw/apps/galaxy/database/universe.sqlite' 7
8 seqsero = '/nfs/sw/apps/galaxy/tools/seqsero/SeqSero.py' 8 # Declare Variables
9 test_out = open("/nfs/sw/apps/galaxy/tools/seqsero/test.txt", 'w') 9 # paths to files and scripts
10 out_path = '/nfs/sw/apps/galaxy/database/files/000' 10
11 test_out2 = open("/nfs/sw/apps/galaxy/tools/seqsero/test2.txt", 'w') 11 fileDir = os.path.dirname(os.path.realpath('__file__'))
12 12 print fileDir
13 path2sample = '/nfs/sw/apps/galaxy/tools/seqsero/fastq_tmp' 13
14 fq_list1 = []
15 Tool_directory = sys.argv[2]
16 database = Tool_directory + '/universe.sqlite'
17 seqsero = Tool_directory + 'SeqSero.py'
18 test_out = open(Tool_directory + "/test.txt", 'w')
19 out_path = Tool_directory + '/files/000'
20 test_out2 = open(Tool_directory + "/test2.txt", 'w')
21
22 path2sample = Tool_directory + 'fastq_tmp'
23
14 24
15 #test_out2.write(" Test test test"); 25 #test_out2.write(" Test test test");
16 26
17 test_out.write("monkey "); 27 test_out.write("monkey ");
18 #test_out.write(""); 28 #test_out.write("");
19 test_out.write("\t".join(sys.argv)+'\n') 29 test_out.write("\t".join(sys.argv)+'\n')
20 30
21 fq_list1 = [] 31
22 fq_list2 = [] 32
33
34 print Tool_directory + ' path printed '
23 35
24 test_out.write(str(len(sys.argv))+"\n") 36 test_out.write(str(len(sys.argv))+"\n")
25 if len(sys.argv) >= 2: 37 if len(sys.argv) >= 2:
26 test_out.write("\t".join(sys.argv)+'\n') 38 test_out.write("\t".join(sys.argv)+'\n')
27 fq_list1 = sys.argv[1] 39 fq_list1 = sys.argv[1]
31 fastq_files = re.split(",", fq_list1) 43 fastq_files = re.split(",", fq_list1)
32 44
33 def print_time(): 45 def print_time():
34 test_out.write(time.asctime( time.localtime(time.time()))) 46 test_out.write(time.asctime( time.localtime(time.time())))
35 47
36 tmp_path = "/nfs/sw/apps/galaxy/tools/seqsero/fastq_tmp" 48 tmp_path = "fastq_tmp"
37 if not os.path.exists(tmp_path): 49 if not os.path.exists(tmp_path):
38 os.system('mkdir '+tmp_path) 50 os.system('mkdir '+tmp_path)
39 51
40 test_out.write(str(len(fastq_files))+"\n") 52 test_out.write(str(len(fastq_files))+"\n")
41 53
186 html_out.write('</tr>\n') 198 html_out.write('</tr>\n')
187 html_out.write('</body>\n') 199 html_out.write('</body>\n')
188 html_out.write('</html>\n') 200 html_out.write('</html>\n')
189 html_out.close() 201 html_out.close()
190 202
203
204 def readFile(filename):
205 filehandle = open(filename)
206 print filehandle.read()
207 filehandle.close()
208
209
191 run2fastqs = list_runs(fastq_files) 210 run2fastqs = list_runs(fastq_files)
192 outputs = run_seqsero(run2fastqs) 211 outputs = run_seqsero(run2fastqs)
193 fastq2serotype, fastq2comment = get_serotypes(outputs) 212 fastq2serotype, fastq2comment = get_serotypes(outputs)
194 print_html(fastq2serotype, fastq2comment) 213 print_html(fastq2serotype, fastq2comment)
195 214