[BioPython] Martel Parser error...
mmayhew at MCB.McGill.CA
mmayhew at MCB.McGill.CA
Wed Jul 11 00:12:22 UTC 2007
Tested a sample file with a single FASTA record at home with my Windows XP
machine and produced the following set of results using Bio.SeqIO first
and then Bio.Fasta (with Fasta.Iterator and Fasta.RecordParser()
instances).
Looks like the same error, with a completely different OS (received exact
same error with Mac OSX v10.4 & biopython 1.42). Since Bio.SeqIO works
fine (thank you for the reccomendation) I will use that, but the Bio.Fasta
error may potentially be an error to look into.
>>> from Bio import SeqIO
>>> handle = open('test.txt', 'r')
>>> for record in SeqIO.parse(handle, "fasta"):
print record.id
hg18_knownGene_uc001hsx.1
>>> record.seq
Seq('ATGGCCCGAACCAAGCAGACTGCGCGCAAGTCAACGGGTGGCAAGGCGCCGCGCAAGCAGCTGGCCACCAAGGTGGCTCGCAAGAGCGCACCTGCCACTGGCGGCGTGAAGAAGCCGCACCGCTACCGGCCCGGCACGGTGGCGCTTCGCGAGATCCGCCGCTACCAGAAGTCCACTGAGCTGCTAATCCGCAAGTTGCCCTTCCAGCGGCTGATGCGCGAGATCGCTCAGGACTTTAAGACCGACCTGCGCTTCCAGAGCTCGGCCGTGATGGCGCTGCAGGAGGCGTGCGAGTCTTACCTGGTGGGGCTGTTTGAGGACACCAACCTGTGTGTCATCCATGCCAAACGGGTCACCATCATGCCTAAGGACATCCAGCTGGCACGCCGTATCCGCGGGGAGCGGGCCTAG',
SingleLetterAlphabet())
>>> record.seq.tostring()
'ATGGCCCGAACCAAGCAGACTGCGCGCAAGTCAACGGGTGGCAAGGCGCCGCGCAAGCAGCTGGCCACCAAGGTGGCTCGCAAGAGCGCACCTGCCACTGGCGGCGTGAAGAAGCCGCACCGCTACCGGCCCGGCACGGTGGCGCTTCGCGAGATCCGCCGCTACCAGAAGTCCACTGAGCTGCTAATCCGCAAGTTGCCCTTCCAGCGGCTGATGCGCGAGATCGCTCAGGACTTTAAGACCGACCTGCGCTTCCAGAGCTCGGCCGTGATGGCGCTGCAGGAGGCGTGCGAGTCTTACCTGGTGGGGCTGTTTGAGGACACCAACCTGTGTGTCATCCATGCCAAACGGGTCACCATCATGCCTAAGGACATCCAGCTGGCACGCCGTATCCGCGGGGAGCGGGCCTAG'
>>> handle.close()
>>> from Bio import Fasta
>>> handle = open('test.txt', 'r')
>>> it = Fasta.Iterator(handle, Fasta.RecordParser())
>>> seq = it.next()
Traceback (most recent call last):
File "<pyshell#13>", line 1, in -toplevel-
seq = it.next()
File "C:\Python24\Lib\site-packages\Bio\Fasta\__init__.py", line 72, in
next
result = self._iterator.next()
File "C:\Python24\Lib\site-packages\Martel\IterParser.py", line 152, in
iterateFile
self.header_parser.parseString(rec)
File "C:\Python24\Lib\site-packages\Martel\Parser.py", line 356, in
parseString
self._err_handler.fatalError(result)
File "C:\Python24\lib\xml\sax\handler.py", line 38, in fatalError
raise exception
ParserPositionException: error parsing at or beyond character 0
> Michael Mayhew wrote:
>> Greetings,
>>
>> I am using BioPython-1.42 (also tried 1.43) on Mac OS X (10.4.8) and
>> have successfully compiled/installed the prerequisite packages (Numeric
>> and mxTextTools).
>>
>> I have been receiving a Martel Parser error as detailed in the
>> following readout (from a python interactive session), when I try to use
>> either Fasta.RecordParser() or Fasta.SequenceParser() instances:
>>
>> >>tester = iter.next()
>> Traceback (most recent call last):
> > ...
>
> Could you give a complete stand alone example? I'm not sure what you are
> trying to do here...
>
> Have you looked at Bio.SeqIO (available in Biopython 1.43) instead of
> Bio.Fasta?
>
> http://biopython.org/wiki/SeqIO
>
>> I confirmed this when I ran the included test suites (with python
>> setup.py test).
>
> Could you show us the failed test result?
>
>> I have seen some suggestions to get the most recent CVS version of
>> biopython to rectify this problem. How would I go about this?
>>
>> Is getting the most recent CVS version of biopython the only/best
>> thing to do?
>
> I'm not sure what's wrong here - so its hard to say if CVS would be any
> better. I've not used Biopython on Mac OS X, but it should work.
>
> Peter
>
More information about the Biopython
mailing list