[BioPython] FormatConverter: from Fasta format to ClustalW format
Lee,Byung-chul
lee.byung-chul at kaist.ac.kr
Wed Jan 2 13:44:47 UTC 2008
Thank you very much for your kind reply, Peter.
As your explanation, I tried to use SeqIO, but another error occured
I did it like below:
-----------------
from Bio import SeqIO
from Bio.Align import AlignInfo
alignment = SeqIO.to_alignment(SeqIO.parse(open('tmp.fasta'), "fasta"))
summary_align = AlignInfo.SummaryInfo(alignment)
print summary_align.dumb_consensus()
--------------------
but the results are
-----------------
Traceback (most recent call last):
File "tmp.py", line 16, in <module>
print summary_align.dumb_consensus()
File "/var/lib/python-support/python2.5/Bio/Align/AlignInfo.py", line 111, in dumb_consensus
consensus_alpha = self._guess_consensus_alphabet()
File "/var/lib/python-support/python2.5/Bio/Align/AlignInfo.py", line 189, in _guess_consensus_alphabet
("Non-gapped alphabet found in alignment object.")
ValueError: Non-gapped alphabet found in alignment object.
---------------------
In addition, all sequences have the same lenghth in my tmp.fasta file.
-----
>seq2
DAC
>seq3
DC-
>seq1
DAD
>seq4
DDD
Is this problem caused by the Biopython/Martel and mxTextTools vesions?
I am using biopython 1.43-2 (ubuntu version) and mxtexttools 3.0.0-2ubuntu1.
What should I do for this? Thanks.
Byung chul.
Peter wrote:
> Hello Byung chul Lee,
>
> On 1/2/08, Lee,Byung-chul wrote:
>
>> Dear colleagues.
>>
>> I want to use the AlignInfo.SummaryInfo for fasta-format alignment file.
>> I think that to do the process firstly the fasta format should be
>> converted to clustalw format, so I try to use Formatconverter.
>> However, at my trial, I cannot do that.
>>
>
> Once you have an alignment object (loaded from any file format), this
> should work with AlignInfo. I don't think you need to convert it from
> FASTA to ClustalW.
>
> I would guess the error you saw is a problem with Biopython/Martel and
> mxTextTools 3.0, which isn't 100% compatible with mxTextTools 2.0.
> What version of Biopython are you using, as I would have expected this
> to work fine with Biopython 1.44?
>
> You could also try using Bio.SeqIO to load the FASTA format alignment
> file instead, see http://biopython.org/wiki/SeqIO
>
> from Bio import SeqIO
> from Bio.Align import AlignInfo
> alignment = SeqIO.to_alignment(SeqIO.parse(open('tmp.fasta'), "fasta"))
> summary_align = AlignInfo.SummaryInfo(alignment)
>
> Peter
>
>
More information about the Biopython
mailing list