Question: Remove Uncultured Organisms From Blast Results With Biopython
0
gravatar for t.poisot
6.0 years ago by
t.poisot40
t.poisot40 wrote:

Hi,

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[0]
        hsps = match.hsps[0]
        %% writing various outputs
        f.write(str(hsps.gaps)+';')
        break

If anyone can tell me where to look, that would be much appreciated.

filter biopython • 2.3k views
ADD COMMENTlink modified 6.0 years ago • written 6.0 years ago by t.poisot40
4
gravatar for t.poisot
6.0 years ago by
t.poisot40
t.poisot40 wrote:

OK, I managed to answer the question by myself.

As it is, the search filters should not go in filter but in entrez_query. So changing the blast_handle = ... line did the job.

edit: Any chance I can make this the accepted answer, as it solved the problem?

ADD COMMENTlink modified 6.0 years ago • written 6.0 years ago by t.poisot40
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1613 users visited in the last hour