[BioPython] FormatConverter: from Fasta format to ClustalW format
Lee,Byung-chul
lee.byung-chul at kaist.ac.kr
Wed Jan 2 06:00:37 EST 2008
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.
I did like below:
----
#!/usr/bin/env python
from Bio import Fasta
from Bio.Align.FormatConvert import FormatConverter
from Bio.Alphabet import IUPAC
alignment = Fasta.FastaAlign.parse_file('tmp.fasta',type='PROTEIN')
converter = FormatConverter(alignment)
clw_align = converter.to_clustal()
print clw_align
----
and tmp.fasta is
---
>seq2
DAC
>seq3
DC-
>seq1
DAD
>seq4
DDD
But error occured.
error messages are below:
---
Traceback (most recent call last):
File "tmp.py", line 7, in <module>
alignment = Fasta.FastaAlign.parse_file('tmp.fasta', type='PROTEIN')
File "/var/lib/python-support/python2.5/Bio/Fasta/FastaAlign.py", line
48, in parse_file
cur_align = iterator.next()
File "/var/lib/python-support/python2.5/Bio/Fasta/__init__.py", line 72,
in next
result = self._iterator.next()
File "/var/lib/python-support/python2.5/Martel/IterParser.py", line 152,
in iterateFile
self.header_parser.parseString(rec)
File "/var/lib/python-support/python2.5/Martel/Parser.py", line 356, in
parseString
self._err_handler.fatalError(result)
File "/usr/lib/python2.5/site-packages/_xmlplus/sax/handler.py", line
38, in fatalError
raise exception
Martel.Parser.ParserPositionException: error parsing at or beyond
character 0
-----
What should I do? Could you advide me ?
Thank you!
Byung chul Lee
More information about the BioPython
mailing list