SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
BLAST+ and blasting against the NCBI database kevluv93 Bioinformatics 4 04-25-2015 02:25 AM
BLASTing masssive protein sequences dena.dinesh Introductions 5 02-17-2015 09:04 PM
Blasting contigs against reference database cyanoevo Bioinformatics 4 01-27-2015 05:54 AM
Blasting your blastx results against your own database? noobie Bioinformatics 1 06-30-2012 03:55 AM
using blast+ for remote blasting rangel Bioinformatics 2 03-29-2012 03:30 PM

Reply
 
Thread Tools
Old 04-29-2015, 07:08 AM   #1
queueing
Junior Member
 
Location: TX

Join Date: Mar 2015
Posts: 4
Default automated remote blasting issue

Hi everyone,

I'm trying to remotely blast about 70 200-nt sequences using Biopython.
I've been trying for hours to figure out why the following Python script won't work.
I can get it to work for a read file that contains just one fasta using SeqIO.read, but when I try to switch to SeqIO.parse, I don't get anything in the .xml save file that I create.
Any ideas?

As a side note, if anyone knows the option syntax for excluding organisms from the results (as is possible when using the ncbi website, please let me know).

Thanks very much for any help.

Matt

from Bio.Blast import NCBIWWW
from Bio import SeqIO
import tkinter.filedialog as tkfd
in_file=tkfd.askopenfilename()
record = SeqIO.parse(in_file, format="fasta")
out_file = tkfd.asksaveasfilename()
save_file = open(out_file, "w")
for rec in record:
....print(rec)
....result_handle = NCBIWWW.qblast("blastn", "nt", rec.format("fasta"))
....save_file.write(result_handle.read())
....result_handle.close()
else:
....save_file.close()

This is the content of the in_file that I'm using as a test file (the line formatting of my file is set at 80 char, which might have been lost below):
>165613
TAACTGCAGTGTTTTGTGTCGAGCCTTTTTTGTGCCTTTTTTATAAAGGCATAACGTTATATTTAATTGAAGAGTTTGAT
TCTGGCTCAGATTGAACGCTAGCGGCATGCTTAACACATGCAAGTCGAACGGCAGCGCGGGGAGCTTGCTCCCTGGCGGC
GAGTGGCGGACGGGTGAGTAATGCGTAGGAATCTACCTTG
>165875
GGGATCTTCGGACCTCGTGCTATAAGATGAGCCTACGTCGGATTAGCTTGTTGGTGGGGTAATGGCCTACCAAGGCGACG
ATCCGTAGCTGGTCTGAGAGGACGATCAGCCACACTGGGACTGAGACACGGCCCAGACTCCTACGGGAGGCAGCAGTGGG
GAATATTGGACAATGGGGGAAACCCTGATCCAGCAATGCC

Last edited by queueing; 04-29-2015 at 07:12 AM. Reason: fixed indentation
queueing is offline   Reply With Quote
Old 05-04-2015, 03:45 AM   #2
maubp
Peter (Biopython etc)
 
Location: Dundee, Scotland, UK

Join Date: Jul 2009
Posts: 1,543
Default

Species restriction can be down with qblast setting entrez_query (or BLAST+ using -remote) and an Entrez [orgn] query, e.g. http://news.open-bio.org/news/2009/0...nfo-biopython/

As to your script, try adding a bit more debugging, e.g.

Code:
    data = result_handle.read()
    print("Got back: %r" % data)
    save_file.write(data)
maubp is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 10:59 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO