[Biopython] Passing sequence to local BLAST
Peter Cock
p.j.a.cock at googlemail.com
Thu Jul 21 09:40:36 UTC 2011
On Thu, Jul 21, 2011 at 10:14 AM, Sheila the angel
<from.d.putto at gmail.com> wrote:
> yes replacing '-' by 'stdin' works :)
>
> seq_record = SeqIO.read(open("alpha.fasta"), "fasta") #or a sequence object
> water_cline = WaterCommandline(asequence="stdin", bsequence="beta.fasta",
> gapopen=10, gapextend=0.5, outfile="water.txt")
> stdout, stderr =water_cline(stdin=seq_record.format("fasta"))
Good - thanks for letting us know.
I can probably make the tutorial text a little clearer here.
> but I tried to replace bsequence also by 'stdin' and it shows error
> #----------------------------------------------------------------------------------------------------------------------
> seq_record = SeqIO.read(open("alpha.fasta"), "fasta") #or a sequence object
> seq_record2 = SeqIO.read(open("beta.fasta"), "fasta")
> water_cline = WaterCommandline(asequence="stdin", bsequence="stdin",
> gapopen=10, gapextend=0.5, outfile="water.txt", auto=True)
That won't work - there is only one stdin pipe in a Unix style command
line environment.
You have to use either two input files, or stdin and one file, (or one
file and stdin).
> stdout, stderr =water_cline(stdin=seq_record.format("fasta"),
> stdin=seq_record2.format("fasta"))
> # File "<stdin>", line 1 # <the error msg.
> #SyntaxError: keyword argument repeated
That is a python syntax error message because you tried to use the stdin
argument twice. Named Python function arguments can only be used once.
I hope that makes sense.
Peter
More information about the Biopython
mailing list