<div dir="ltr">Dear All,<div>I got a script from the following link :<a href="https://www.biostars.org/p/42687/"> https://www.biostars.org/p/42687/</a> about how to blast two sequences in biopython, I wonder if is it possible to pass the sequences direct to as following:</div><div><b>NcbiblastpCommandline(query</b>="FQTWEEFSRAAEKLYLADPMKVRV"<b>,subject</b>="FQTWEEFSRAEKLYLADPMK", outfmt=5)()[0]</div><div>unfortunately, I got the error when I'm trying to pass the sequence direct instead of read fasta file, is there any way to pass sequences direct. </div><div><br></div><div><div><pre><code><div style="font-family:arial,sans-serif;white-space:normal"><b> the script is:</b></div><div><br></div>from Bio.Blast.Applications import NcbiblastpCommandline
from StringIO import StringIO
from Bio.Blast import NCBIXML
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio import SeqIO
# Create two sequence files
seq1 = SeqRecord(Seq("FQTWEEFSRAAEKLYLADPMKVRVVLKYRHVDGNLCIKVTDDLVCLVYRTDQAQDVKKIEKF"),
id="seq1")
seq2 = SeqRecord(Seq("FQTWEEFSRAEKLYLADPMKVRVVLRYRHVDGNLCIKVTDDLICLVYRTDQAQDVKKIEKF"),
id="seq2")
SeqIO.write(seq1, "seq1.fasta", "fasta")
SeqIO.write(seq2, "seq2.fasta", "fasta")
# Run BLAST and parse the output as XML
output = NcbiblastpCommandline(<b>query</b>="seq1.fasta", <b>subject</b>="seq2.fasta", outfmt=5)()[0]
blast_result_record = NCBIXML.read(StringIO(output))
# Print some information on the result
for alignment in blast_result_record.alignments:
for hsp in alignment.hsps:
print '****Alignment****'
print 'sequence:', alignment.title
print 'length:', alignment.length
print 'e value:', hsp.expect
print hsp.query
print hsp.match
print hsp.sbjct</code></pre></div>
</div></div>