[Biopython] Passing sequence to local BLAST
Sheila the angel
from.d.putto at gmail.com
Wed Jul 20 16:22:37 UTC 2011
This method do not work with Bio.Emboss.Applications!!!
I am trying to do the same with 'Bio.Emboss.Applications' as
seq_record = SeqIO.read(open("alpha.fasta"), "fasta") #or a sequence object
water_cline = WaterCommandline(asequence="-", bsequence="beta.fasta",
gapopen=10, gapextend=0.5, outfile="water.txt")
stdout, stderr =water_cline(stdin=seq_record.format("fasta"))
but it is displaying error.
How can I specify file handle or sequence only in Emboss Applications???
On Thu, Jul 7, 2011 at 12:43 PM, Peter Cock <p.j.a.cock at googlemail.com>wrote:
> On Thu, Jul 7, 2011 at 11:26 AM, Sheila the angel
> <from.d.putto at gmail.com> wrote:
> > Hi All,
> >
> > I want to download genbank file from NCBI and pass the protein sequence
> > directly to the local BLAST. But I am getting error in BLAST step
> >
> #-------------------------------------------------------------------------------------------
> > from Bio import SeqIO
> > from Bio import Entrez
> > from Bio.Blast.Applications import NcbiblastpCommandline
> > id='200203'
> > handle = Entrez.efetch(db="protein", id=id, rettype="gp")
> > seq_record = SeqIO.read(handle, "gb")
> > x=seq_record.seq #getting the
> > sequence in a variable x
> > blastp_cline = NcbiblastpCommandline(query=x, db="protein_database",
> > evalue=0.001) # My BLAST command
> > result_handle, stderr = blastp_cline() #Running BLAST
> and
> > getting error :(
> >
> >
> #-------------------------------------------------------------------------------------------
> >
> > At this last step I am getting error.....
> > I sort-of understand the problem.....it is taking value of x as a file
> name
> > while its a variable which contains the sequence.
> > Is there any way out to this problem without making temporary file.
>
> With the standalone blast tools you generally need to prepare an input
> FASTA file with your query sequence(s).
>
> However, in principle you can give the input filename as - (default),
> and instead pipe the query FASTA record in as stdin (standard input).
> Try something like this (untested):
>
> ...
> blastp_cline = NcbiblastpCommandline(query="-", db="protein_database",
> evalue=0.001)
> stdout, stderr = blastp_cline(stdin=seq_record.format("fasta"))
>
> Peter
>
More information about the Biopython
mailing list