Changeset 301


Ignore:
Timestamp:
Mar 10, 2010, 5:02:55 PM (10 years ago)
Author:
jjbot
Message:

First version of new basicparsers: this module should provide simple parse functions which can be used to build more complex parsers. Also provided unittests for this module.

Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • parsers/gff.py

    r216 r301  
    99from parsers import liner, utils, genericparser
    1010
    11 fieldnames = [  'seqname', 'source', 'feature', \
    12                 'start', 'end', 'score',        \
    13                 'strand', 'frame'               \
     11fieldnames = [  'seqname', 'source', 'feature', 'start', 'end', 'score',
     12                'strand', 'frame'               
    1413             ]
    1514
     
    2827
    2928class GFFParser(genericparser.GenericParser):
    30     """\nParser for gff files.
     29    """Parser for gff files.
    3130    """
    3231
     
    4948        mapper = utils.getSimpleMapper(*range(0,len(fieldnames)))
    5049        out = liner.parse(filename, fieldnames, fts, \
    51                 mapper, sepchar="\t", comment=['#'])
     50                mapper, delimiter="\t", comment=['#'])
    5251        return out
  • parsers/obo.py

    r205 r301  
    1717    # multi_fields contains the fieldnames which can occur more than
    1818    # once in an obo record.
    19     multi_fields = ['alt_id', 'consider', 'disjoint_from', \
    20             'intersection_of',  'is_a', 'relationship',    \
    21             'replaced_by', 'synonym', 'xref'               \
     19    multi_fields = ['alt_id', 'consider', 'disjoint_from',
     20            'intersection_of',  'is_a', 'relationship',
     21            'replaced_by', 'synonym', 'xref'
    2222    ]
    2323
  • parsers/obo2.py

    r295 r301  
    22__author__="Jan Bot"
    33__date__ ="$Mar 8, 2010 4:29:35 PM$"
     4
     5# Ibidas imports
     6import representor
     7from representor.wrapper_py import *
     8from representor.repops_rel import *
    49
    510MULTI_FIELDS = [
     
    127132        self._cur_rec_type = self._handle.next()
    128133        while not isempty:
    129             line = self._handle.next().strip()
     134            line = ""
     135            try:
     136                line = self._handle.next().strip()
     137            except:
     138                # we ran out of file
     139                return cur_record
    130140            if line.strip() == "":
    131141                isempty = True
  • unitsuite.py

    r296 r301  
    44from unit.unitrepresentor import *
    55from unit.unittypes import *
     6from unit.unitbasicparsers import *
    67from unit.unitobo import *
    78#from unit.unitcontainer import *
Note: See TracChangeset for help on using the changeset viewer.