<div dir="ltr">Many thanks Peter, I thought that It may be possible to pass raw sequences instead of passing fasta file.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 10, 2017 at 9:43 AM, Peter Cock <span dir="ltr"><<a href="mailto:p.j.a.cock@googlemail.com" target="_blank">p.j.a.cock@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The NCBI BLAST+ arguments query and subject should be filenames, not<br>
raw sequences.<br>
<br>
The example you linked to on BioStars had an example by Ryan showing<br>
how to first create two temp files which he called "seq1.fasta" and<br>
"seq2.fasta" using Biopython's SeqIO.<br>
<br>
Peter<br>
<div><div class="h5"><br>
<br>
On Thu, Mar 9, 2017 at 7:42 AM, Islam Amin <<a href="mailto:eng.islamamin@gmail.com">eng.islamamin@gmail.com</a>> wrote:<br>
> Dear All,<br>
> I got a script from the following link : <a href="https://www.biostars.org/p/42687/" rel="noreferrer" target="_blank">https://www.biostars.org/p/<wbr>42687/</a><br>
> about how to blast two sequences in biopython, I wonder if is it possible to<br>
> pass the sequences direct to as following:<br>
> NcbiblastpCommandline(query="<wbr>FQTWEEFSRAAEKLYLADPMKVRV",<wbr>subject="FQTWEEFSRAEKLYLADPMK"<wbr>,<br>
> outfmt=5)()[0]<br>
> unfortunately, I got the error when I'm trying to pass the sequence direct<br>
> instead of read fasta file, is there any way to pass sequences direct.<br>
><br>
> the script is:<br>
><br>
> from Bio.Blast.Applications import NcbiblastpCommandline<br>
> from StringIO import StringIO<br>
> from Bio.Blast import NCBIXML<br>
> from Bio.Seq import Seq<br>
> from Bio.SeqRecord import SeqRecord<br>
> from Bio import SeqIO<br>
><br>
> # Create two sequence files<br>
> seq1 =<br>
> SeqRecord(Seq("<wbr>FQTWEEFSRAAEKLYLADPMKVRVVLKYRH<wbr>VDGNLCIKVTDDLVCLVYRTDQAQDVKKIE<wbr>KF"),<br>
> id="seq1")<br>
> seq2 =<br>
> SeqRecord(Seq("<wbr>FQTWEEFSRAEKLYLADPMKVRVVLRYRHV<wbr>DGNLCIKVTDDLICLVYRTDQAQDVKKIEK<wbr>F"),<br>
> id="seq2")<br>
> SeqIO.write(seq1, "seq1.fasta", "fasta")<br>
> SeqIO.write(seq2, "seq2.fasta", "fasta")<br>
><br>
> # Run BLAST and parse the output as XML<br>
> output = NcbiblastpCommandline(query="<wbr>seq1.fasta", subject="seq2.fasta",<br>
> outfmt=5)()[0]<br>
> blast_result_record = NCBIXML.read(StringIO(output))<br>
><br>
> # Print some information on the result<br>
> for alignment in blast_result_record.<wbr>alignments:<br>
> for hsp in alignment.hsps:<br>
> print '****Alignment****'<br>
> print 'sequence:', alignment.title<br>
> print 'length:', alignment.length<br>
> print 'e value:', hsp.expect<br>
> print hsp.query<br>
> print hsp.match<br>
> print hsp.sbjct<br>
><br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> Biopython mailing list - <a href="mailto:Biopython@mailman.open-bio.org">Biopython@mailman.open-bio.org</a><br>
> <a href="http://mailman.open-bio.org/mailman/listinfo/biopython" rel="noreferrer" target="_blank">http://mailman.open-bio.org/<wbr>mailman/listinfo/biopython</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span>Best Regards,<br>Islam Amin.<br><br><a href="http://www.egyptscience.net/" rel="nofollow nofollow" target="_blank">www.egyptscience.net</a><br></span><div>Scientific Research Group in EGYPT</div></div></div>
</div>