annotate STACKS_refmap.py @ 0:d6ba40f6c824

first commit
author cmonjeau
date Mon, 24 Aug 2015 09:29:12 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
1 #!/usr/bin/python
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
2 # -*- coding: utf-8 -*-
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
3
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
4 import sys
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
5 import re
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
6 import os
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
7 import tempfile
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
8 import shutil
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
9 import subprocess
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
10 import glob
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
11 import optparse
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
12 from os.path import basename
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
13 import zipfile
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
14 import tarfile
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
15 import gzip
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
16 from galaxy.datatypes.checkers import *
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
17 from stacks import *
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
18
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
19
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
20 def __main__():
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
21
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
22 # arguments recuperation
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
23
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
24 parser = optparse.OptionParser()
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
25 parser.add_option('-p')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
26 parser.add_option('-r')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
27 parser.add_option('-s')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
28 parser.add_option('-O')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
29 parser.add_option('-n')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
30 parser.add_option('-m')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
31 parser.add_option('--bound_low')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
32 parser.add_option('--bound_high')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
33 parser.add_option('--alpha')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
34 parser.add_option('--logfile')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
35 parser.add_option('--compress_output')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
36 parser.add_option('--catalogsnps')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
37 parser.add_option('--catalogalleles')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
38 parser.add_option('--catalogtags')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
39
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
40 # additionnal outputs
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
41
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
42 parser.add_option('--total_output')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
43 parser.add_option('--tags_output')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
44 parser.add_option('--snps_output')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
45 parser.add_option('--alleles_output')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
46 parser.add_option('--matches_output')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
47 (options, args) = parser.parse_args()
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
48
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
49 # create working directories
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
50
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
51 os.mkdir('inputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
52 os.mkdir('job_outputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
53 os.mkdir('galaxy_outputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
54
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
55 cmd_line = []
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
56 cmd_line.append('ref_map.pl')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
57
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
58 # if genetic map
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
59
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
60 if options.p:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
61
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
62 # parse config files
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
63
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
64 tab_parent_files = galaxy_config_to_tabfiles_for_STACKS(options.p)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
65
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
66 # check if zipped files are into the tab and change tab content
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
67
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
68 extract_compress_files_from_tabfiles(tab_parent_files, 'inputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
69
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
70 # check files extension (important to have .sam files)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
71
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
72 check_sam_extension_and_add(tab_parent_files, 'inputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
73
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
74 # create symlink into the temp dir
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
75
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
76 create_symlinks_from_tabfiles(tab_parent_files, 'inputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
77
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
78 # create the command input line
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
79
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
80 for key in tab_parent_files:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
81
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
82 # if is a file (skip repository created after a decompression)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
83
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
84 if os.path.isfile('inputs/'+key):
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
85 cmd_line.extend(['-p', os.path.normpath('inputs/'+key)])
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
86
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
87 # if genetic map with progeny files
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
88
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
89 if options.r:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
90
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
91 # parse config files
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
92
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
93 tab_progeny_files = galaxy_config_to_tabfiles_for_STACKS(options.r)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
94
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
95 # check if zipped files are into the tab and change tab content
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
96
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
97 extract_compress_files_from_tabfiles(tab_progeny_files, 'inputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
98
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
99 # check files extension (important to have .sam files)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
100
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
101 check_sam_extension_and_add(tab_progeny_files, 'inputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
102
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
103 # create symlink into the temp dir
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
104
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
105 create_symlinks_from_tabfiles(tab_progeny_files, 'inputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
106
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
107 for key in tab_progeny_files:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
108
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
109 # if is a file (skip repository created after a decompression)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
110
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
111 if os.path.isfile('inputs/' + key):
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
112 cmd_line.extend(['-r', 'inputs/' + key])
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
113
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
114 # parse config files and create symlink if individual files are selected
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
115
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
116 if options.s:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
117
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
118 # parse config files
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
119
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
120 tab_individual_files = galaxy_config_to_tabfiles_for_STACKS(options.s)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
121
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
122 # check if zipped files are into the tab and change tab content
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
123
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
124 extract_compress_files_from_tabfiles(tab_individual_files, 'inputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
125
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
126 # check files extension (important to have .sam files)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
127
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
128 check_sam_extension_and_add(tab_individual_files, 'inputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
129
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
130 # create symlink into the temp dir
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
131
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
132 create_symlinks_from_tabfiles(tab_individual_files, 'inputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
133
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
134 # create the command input line
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
135
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
136 for key in tab_individual_files:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
137 cmd_line.extend(['-s', 'inputs/' + key])
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
138
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
139 # create the options command line
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
140
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
141 cmd_line.extend([
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
142 '-S',
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
143 '-b', '1',
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
144 '-T', '4',
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
145 '-o', 'job_outputs',
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
146 '-n', options.n,
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
147 '-m', options.m,
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
148 ])
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
149
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
150 if options.O:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
151 cmd_line.extend(['-O', options.O])
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
152
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
153 if options.bound_low:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
154 cmd_line.extend(['--bound_low', options.bound_low])
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
155
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
156 if options.bound_high:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
157 cmd_line.extend(['--bound_high', options.bound_high])
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
158
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
159 if options.alpha:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
160 cmd_line.extend(['--alpha', options.alpha])
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
161
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
162 # execute job
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
163
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
164 print '[COMMAND LINE]' + ' '.join(cmd_line)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
165
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
166 p = subprocess.Popen(cmd_line, stdout=subprocess.PIPE,
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
167 stderr=subprocess.PIPE)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
168
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
169 (stdoutput, stderror) = p.communicate()
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
170
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
171 print stdoutput
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
172 print stderror
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
173
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
174 # postprocesses
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
175
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
176 try:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
177 shutil.move('job_outputs/ref_map.log', options.logfile)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
178 except:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
179 sys.stderr.write('Error in ref_map execution; Please read the additional output (stdout)\n')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
180
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
181 # go inside the outputs dir
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
182
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
183 os.chdir('job_outputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
184
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
185 # move files
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
186
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
187 for i in glob.glob('*'):
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
188 if re.search('catalog.snps.tsv$', i):
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
189 shutil.copy(i, options.catalogsnps)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
190 if re.search('catalog.alleles.tsv$', i):
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
191 shutil.copy(i, options.catalogalleles)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
192 if re.search('catalog.tags.tsv$', i):
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
193 shutil.copy(i, options.catalogtags)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
194
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
195 # copy all files inside tmp_dir into workdir
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
196
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
197 list_files = glob.glob('*')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
198
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
199 # if compress output is total
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
200
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
201 if options.compress_output == 'total':
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
202
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
203 mytotalzipfile = zipfile.ZipFile('total.zip.temp', 'w',
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
204 allowZip64=True)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
205
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
206 for i in list_files:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
207
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
208 mytotalzipfile.write(os.path.basename(i))
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
209
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
210 # return the unique archive
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
211
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
212 shutil.move('total.zip.temp', options.total_output)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
213 elif options.compress_output == 'categories':
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
214
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
215 # if compress output is by categories
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
216
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
217 mytagszip = zipfile.ZipFile('tags.zip.temp', 'w', allowZip64=True)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
218 mysnpszip = zipfile.ZipFile('snps.zip.temp', 'w', allowZip64=True)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
219 myalleleszip = zipfile.ZipFile('alleles.zip.temp', 'w', allowZip64=True)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
220 mymatcheszip = zipfile.ZipFile('matches.zip.temp', 'w', allowZip64=True)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
221
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
222 for i in list_files:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
223
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
224 # for each type of files
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
225
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
226 if re.search("tags\.tsv$", i) and not re.search('batch', i):
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
227 mytagszip.write(os.path.basename(i))
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
228 os.remove(i)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
229 elif re.search("snps\.tsv$", i) and not re.search('batch', i):
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
230 mysnpszip.write(os.path.basename(i))
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
231 os.remove(i)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
232 elif re.search("alleles\.tsv$", i) and not re.search('batch', i):
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
233 myalleleszip.write(os.path.basename(i))
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
234 os.remove(i)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
235 elif re.search("matches\.tsv$", i) and not re.search('batch', i):
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
236 mymatcheszip.write(os.path.basename(i))
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
237 os.remove(i)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
238 else:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
239 shutil.move(os.path.basename(i), '../galaxy_outputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
240
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
241 # return archives....
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
242
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
243 shutil.move('tags.zip.temp', options.tags_output)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
244 shutil.move('snps.zip.temp', options.snps_output)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
245 shutil.move('alleles.zip.temp', options.alleles_output)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
246 shutil.move('matches.zip.temp', options.matches_output)
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
247 else:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
248
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
249 # else no compression
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
250
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
251 for i in list_files:
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
252 shutil.move(os.path.basename(i), '../galaxy_outputs')
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
253
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
254
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
255 if __name__ == '__main__':
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
256 __main__()
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
257
d6ba40f6c824 first commit
cmonjeau
parents:
diff changeset
258