This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Emboss In Biopython Asequence And Bsequence

In biopython emboss applications, is it possible that asequence and bsequence attributes of needle/watercommandline object be a variable instead of fasta file ? i.e I want to write the sequence either directly or through variable as shown below

bseq= "aaatttccggtt"
    needle_cline = NeedleCommandline(asequence="acgtggcc", bsequence=bseq,
    ...                                  gapopen=10, gapextend=0.5, outfile="needle.txt")

Is it possible to do it ?

python biopython

1 answer

This isn't a Biopython specific thing, but an EMBOSS trick - you can use their pretend file format to give the sequence in place of a filename using asis:aaatttccggtt, see also http://emboss.sourceforge.net/docs/themes/SequenceFormats.html - e.g.

>>> from Bio.Emboss.Applications import NeedleCommandline
>>> aseq = "acgtggcc"
>>> bseq = "aaatttccggtt"
>>> needle_cline = NeedleCommandline(asequence="asis:"+aseq, bsequence="asis:"+bseq, gapopen=10, gapextend=0.5, outfile="needle.txt")
>>> stdout, stderr = needle_cline()
>>> print stdout + stderr
Needleman-Wunsch global alignment of two sequences

Also you might be able to specify you want to read the a-sequences from stdin rather than a file, and supply this when you actually run Needle, e.g. with needle_cline(stdin=aseq) (not tested).

is there equivalent in MafftCommandline?

Log in to answer this question.