[BioPython] problems parsing alignment files
ashleigh smythe
absmythe at ucdavis.edu
Tue Mar 2 13:05:45 EST 2004
Hello biopythoneers! I've been having problems parsing alignments, but
I can parse fasta files with no problem so I don't think I'm totally off
base. I can't get either the NBRF parser or the Clustalw parser to
work. I have updated biopython on February 27th and just updated Martel
- both via the command "CVS update", but I guess it looks like a Martel
problem. I think the NBRF (.pir) files and .aln files I'm using are
fine as they open with no problem directly in ClustalX.
Here's the traceback for NBRF:
>>> from Bio import NBRF
>>> parser=NBRF.RecordParser()
>>> afile=open('allopen6ext2.pir')
>>> iterator=NBRF.Iterator(afile, parser)
>>> cur_record=iterator.next()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/site-packages/Bio/NBRF/__init__.py", line 63,
in next
return self._parser.parse(File.StringHandle(data))
File "/usr/lib/python2.2/site-packages/Bio/NBRF/__init__.py", line
158, in parse
self._scanner.feed(handle, self._consumer)
File "/usr/lib/python2.2/site-packages/Bio/NBRF/__init__.py", line
108, in feed
self._parser.parseFile(handle)
File "/usr/lib/python2.2/site-packages/Martel/Parser.py", line 328, in
parseFile
self.parseString(fileobj.read())
File "/usr/lib/python2.2/site-packages/Martel/Parser.py", line 356, in
parseString
self._err_handler.fatalError(result)
File "/usr/lib/python2.2/site-packages/_xmlplus/sax/handler.py", line
38, in fatalError
raise exception
Martel.Parser.ParserPositionException: error parsing at or beyond
character 2517
And here's the one from Clustalw (I'm not sure if I've got the syntax
right on this as it doesn't seem to have the same RecordParser as NBRF
or Fasta):
>>> from Bio import Clustalw
>>> dir(Clustalw)
['Alignment', 'Alphabet', 'ClustalAlignment', 'IUPAC',
'MultipleAlignCL', 'Seq', 'SeqRecord', '_AlignCreator', '__all__',
'__builtins__', '__doc__', '__file__', '__name__', '__path__',
'clustal_format', 'do_alignment', 'handler', 'os', 'parse_file',
'saxutils', 'string']
>>> parser=Clustalw.parse_file('allopen4ext2.aln')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.2/site-packages/Bio/Clustalw/__init__.py", line
60, in parse_file
parser.parseFile(to_parse)
File "/usr/lib/python2.2/site-packages/Martel/Parser.py", line 328, in
parseFile
self.parseString(fileobj.read())
File "/usr/lib/python2.2/site-packages/Martel/Parser.py", line 361, in
parseString
self._err_handler.fatalError(ParserIncompleteException(pos))
File "/usr/lib/python2.2/site-packages/_xmlplus/sax/handler.py", line
38, in fatalError
raise exception
Martel.Parser.ParserIncompleteException: error parsing at or beyond
character 8311 (unparsed text remains)
>>>
Thanks for any help that anybody can provide!
Ashleigh
--
****************************
Ashleigh B. Smythe
Graduate Research Assistant
Department of Nematology
University of California,
Davis, CA 95616
email:absmythe at ucdavis.edu
phone:530-754-4321
More information about the BioPython
mailing list