Mercurial > repos > pjbriggs > amplicon_analysis_pipeline
comparison amplicon_analysis_pipeline.py @ 37:e832be1635b4 draft
planemo upload for repository https://github.com/pjbriggs/Amplicon_analysis-galaxy commit 601f7d1e21b25c583cc6e1a563029bab3f226921-dirty
author | pjbriggs |
---|---|
date | Tue, 16 Oct 2018 10:54:44 -0400 |
parents | 18e6427c5e4a |
children | 7b2c40450792 |
comparison
equal
deleted
inserted
replaced
36:c9ed9443f293 | 37:e832be1635b4 |
---|---|
165 ref_database = "silva" | 165 ref_database = "silva" |
166 elif args.use_homd: | 166 elif args.use_homd: |
167 ref_database = "homd" | 167 ref_database = "homd" |
168 else: | 168 else: |
169 ref_database = "gg" | 169 ref_database = "gg" |
170 | |
171 # Executables | |
172 os.mkdir("bin") | |
173 os.environ["PATH"] = os.path.abspath("bin") + \ | |
174 os.pathsep + \ | |
175 os.environ["PATH"] | |
176 print "-- updated PATH: %s" % os.environ["PATH"] | |
177 # Pipeline wants 'vsearch113' but bioconda version is just | |
178 # 'vsearch' | |
179 vsearch = find_executable("vsearch113") | |
180 if vsearch is None: | |
181 vsearch = find_executable("vsearch") | |
182 if vsearch: | |
183 os.symlink(vsearch,os.path.join("bin","vsearch113")) | |
184 print "-- made symlink to %s" % vsearch | |
185 else: | |
186 sys.stderr.write("Missing 'vsearch[113]'\n") | |
187 # Pipeline wants 'fasta-splitter.pl' but bioconda provides | |
188 # 'fasta-splitter' | |
189 fasta_splitter = find_executable("fasta-splitter.pl") | |
190 if fasta_splitter is None: | |
191 fasta_splitter = find_executable("fasta-splitter") | |
192 if os.path.islink(fasta_splitter): | |
193 fasta_splitter = os.path.join( | |
194 os.path.dirname(fasta_splitter), | |
195 os.readlink(fasta_splitter)) | |
196 if fasta_splitter: | |
197 os.symlink(fasta_splitter,os.path.join("bin","fasta-splitter.pl")) | |
198 print "-- made symlink to %s" % fasta_splitter | |
199 else: | |
200 sys.stderr.write("Missing 'fasta-splitter[.pl]'\n") | |
201 # Qiime 1.8.0 wants 'RDP_JAR_PATH' env var to point to | |
202 # the rdp_classifier.jar file | |
203 # biconda provides this in the 'share/rdp_classifier/' dir | |
204 # which is a link to the 'share/rdp_classifier-<VERSION>/' dir | |
205 rdp_classifier = find_executable("rdp_classifier") | |
206 if rdp_classifier: | |
207 # Generate expected path to JAR file | |
208 rdp_classifier = os.path.normpath( | |
209 os.path.join(os.path.dirname(rdp_classifier), | |
210 "..", | |
211 "share", | |
212 "rdp_classifier", | |
213 "rdp_classifier.jar")) | |
214 if rdp_classifier and os.path.exists(rdp_classifier): | |
215 # Get real directory (which contains version) | |
216 rdp_classifier_dir = os.readlink( | |
217 os.path.dirname(rdp_classifier)) | |
218 # Extract the version | |
219 rdp_version = '-'.join(os.path.basename( | |
220 rdp_classifier_dir).split('-')[1:]) | |
221 # Make a symlink to JAR file with version in the name | |
222 rdp_jar_path = os.path.join(os.path.abspath("bin"), | |
223 "rdp_classifier-%s.jar" % | |
224 rdp_version) | |
225 os.symlink(rdp_classifier,rdp_jar_path) | |
226 print "-- made symlink to %s" % rdp_classifier | |
227 # Set the RDP_JAR_PATH env var | |
228 os.environ["RDP_JAR_PATH"] = rdp_jar_path | |
229 print "-- set RDP_JAR_PATH: %s" % os.environ["RDP_JAR_PATH"] | |
230 else: | |
231 sys.stderr.write("Missing 'rdp_classifier.jar'\n") | |
232 # Set up qiime_config file | |
233 qiime_config_file = os.path.abspath("qiime_config") | |
234 with open(qiime_config_file,'w') as qiime_config: | |
235 # Set qiime_scripts_dir | |
236 qiime_config.write("qiime_scripts_dir\t%s" % | |
237 os.path.dirname( | |
238 find_executable("single_rarefaction.py"))) | |
239 os.environ["QIIME_CONFIG_FP"] = qiime_config_file | |
240 print "-- set QIIME_CONFIG_FP: %s" % os.environ["QIIME_CONFIG_FP"] | |
241 | 170 |
242 # Construct the pipeline command | 171 # Construct the pipeline command |
243 print "Amplicon analysis: constructing pipeline command" | 172 print "Amplicon analysis: constructing pipeline command" |
244 pipeline = PipelineCmd("Amplicon_analysis_pipeline.sh") | 173 pipeline = PipelineCmd("Amplicon_analysis_pipeline.sh") |
245 if args.forward_pcr_primer: | 174 if args.forward_pcr_primer: |