import blastparser fp = open('sample-blast.txt') for record in blastparser.parse_fp(fp): for hit in record.hits: for match in hit.matches: print record.query_name, hit.subject_name print match.subject_start, match.query_start print match.subject_end, match.query_end print match.expect print dir(match) break break evalues = [] fp = open('sample-blast.txt') for record in blastparser.parse_fp(fp): for hit in record.hits: for match in hit.matches: evalues.append(match.expect) hist(evalues, bins=100, normed=True) show() fp = open('sample-blast.txt') n = 0 for record in blastparser.parse_fp(fp): n += 1 if n > 5: break for hit in record.hits: for match in hit.matches: print record.query_name, hit.subject_name, match.expect break break fp = open('sample-blast.txt') outfp = open('/tmp/blastout.csv', 'w') for record in blastparser.parse_fp(fp): for hit in record.hits: for match in hit.matches: print >>outfp, record.query_name, hit.subject_name, match.expect break break import csv fp = open('sample-blast.txt') outfp = open('/tmp/blastout.csv', 'wb') w = csv.writer(outfp) for record in blastparser.parse_fp(fp): for hit in record.hits: for match in hit.matches: w.writerow([record.query_name, hit.subject_name, match.expect]) break break outfp.close()