I'm trying to use biopython to blast a list of sequences and retrieve the best hit. This works fine. Now I'd like to filter the results, as I would on the NCBI BLAST web interface, so that metagenomes and uncultered organisms are NOT included in the search. I tried using the
filter argument of
qblast, but then I don't get an youtput. Removing the
filter keywork works fine, but then I only get uncultered organisms.
I've pasted the relevant code snippet below
for record in SeqIO.parse(handle, 'fasta'): print "Blasting seq "+strrecord.id) blast_handle = NCBIWWW.qblast('blastn', 'nt', record.seq, filter='all [filter] NOT(environmental samples[organism] OR metagenomes[orgn])') blast_records = NCBIXML.parse(blast_handle) for blast_record in blast_records: if blast_record.alignments: match = blast_record.alignments hsps = match.hsps %% writing various outputs f.write(str(hsps.gaps)+';') break
If anyone can tell me where to look, that would be much appreciated.