how can I run ClustalW2 without a input FASTA file?
Can I add a pipe to the command? I am currently following section 6.2.1 in the Biopython Tutorial and Cookbook.
how can I run ClustalW2 without a input FASTA file?
Can I add a pipe to the command? I am currently following section 6.2.1 in the Biopython Tutorial and Cookbook.
I'm assuming you wish to use the clustal
wrapper, ClustalwCommandLine
. As a wrapper, its function is to create the appropriate command line call from an instance.
I think it's often easier to just work with the command line tool directly, using subprocess
(and thus skipping Biopython entirely).
stdin in clustalw2
Consulting the clustalw2
documentation, I see no way to pass data from stdin
:
DATA (sequences)
-INFILE=file.ext :input sequences.
-PROFILE1=file.ext and -PROFILE2=file.ext :profiles (old alignment).
stdin in clustalo
However, if upgrading to Clustal Omega is an option, you can see in the Clustal Omega documentation
that one can pass -
to indicate taking input from stdin
:
SEQUENCE INPUT:
-i, --in, --infile={<file>,-}
Multiple sequence input file (- for stdin)
See how do I pass a string in subprocess.Popen
for reference, but in short:
from subprocess import Popen, PIPE, STDOUT
proc = Popen(['clustalwo', '-', <...>], stdout=PIPE, stdin=PIPE, stderr=STDOUT)
stdout = p.communicate(input='> Seq one\nATCGCTACGCACTACGTACG...')