Remove Uncultured Organisms From Blast Results With Biopython
1
0
Entering edit mode
10.9 years ago
t.poisot ▴ 40

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.

biopython filter • 3.6k views
ADD COMMENT
4
Entering edit mode
10.9 years ago
t.poisot ▴ 40

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 COMMENT

Login before adding your answer.

Traffic: 1808 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6