comparison BlastParser_and_hits.py @ 2:36103afa0934 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/blastparser_and_hits commit 22ac2287a510708784dec78647afea4eff658f02
author artbio
date Tue, 19 Jun 2018 05:18:31 -0400
parents 9dfb65ebb02e
children b4c9c085d709
comparison
equal deleted inserted replaced
1:9beb85dba280 2:36103afa0934
215 continue 215 continue
216 return results 216 return results
217 217
218 F = open(F, "w") 218 F = open(F, "w")
219 Fasta = open(Fasta, "w") 219 Fasta = open(Fasta, "w")
220 blasted_transcripts = [] 220 blasted_transcripts = dict()
221 filter_results(results, filter_relativeCov, filter_maxScore, 221 filter_results(results, filter_relativeCov, filter_maxScore,
222 filter_meanScore, filter_term_in, filter_term_out) 222 filter_meanScore, filter_term_in, filter_term_out)
223 for subject in results: 223 for subject in results:
224 for transcript in Xblastdict[subject]: 224 for transcript in Xblastdict[subject]:
225 blasted_transcripts.append(transcript) 225 blasted_transcripts[transcript] = ">%s\n%s\n" % (transcript,
226 blasted_transcripts = list(set(blasted_transcripts)) 226 insert_newlines(
227 fastadict[
228 transcript
229 ]))
227 if mode == "verbose": 230 if mode == "verbose":
228 F.write("--- %s ---\n" % dataset_name) 231 F.write("--- %s ---\n" % dataset_name)
229 F.write("# %s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % ("SeqId", "%Identity", 232 F.write("# %s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % ("SeqId", "%Identity",
230 "AlignLength", 233 "AlignLength",
231 "StartSubject", 234 "StartSubject",
299 unmatched_sequences): 302 unmatched_sequences):
300 '''to output the sequences that matched and did not matched in the blast''' 303 '''to output the sequences that matched and did not matched in the blast'''
301 F_matched = open(matched_sequences, "w") 304 F_matched = open(matched_sequences, "w")
302 F_unmatched = open(unmatched_sequences, "w") 305 F_unmatched = open(unmatched_sequences, "w")
303 for transcript in fastadict: 306 for transcript in fastadict:
304 if transcript in blasted_transcripts: 307 try:
305 ''''list of blasted_transcripts is generated 308 F_matched.write(blasted_transcripts[transcript])
306 by the outputParsing function''' 309 except KeyError:
307 F_matched.write(">%s\n%s\n" % (transcript, insert_newlines(
308 fastadict[transcript])))
309 else:
310 F_unmatched.write(">%s\n%s\n" % (transcript, insert_newlines( 310 F_unmatched.write(">%s\n%s\n" % (transcript, insert_newlines(
311 fastadict[transcript]))) 311 fastadict[transcript])))
312 F_matched.close() 312 F_matched.close()
313 F_unmatched.close() 313 F_unmatched.close()
314 return 314 return
315 315
316 316