Class: Bio::FlatFileIndex::Indexer::Parser::MaXMLSequenceParser

Inherits:
TemplateParser show all
Defined in:
lib/bio/io/flatfile/indexer.rb

Overview

class FastaFormatParser

Constant Summary collapse

NAMESTYLE =
NameSpaces.new(
             NameSpace.new( 'id', Proc.new { |x| x.entry_id } ),
             NameSpace.new( 'altid', Proc.new { |x| x.id_strings } ),
             NameSpace.new( 'gene_ontology', Proc.new { |x|
                             x.annotations.get_all_by_qualifier('gene_ontology').collect { |y|
                               y.anntext
                             }
                           }),
             NameSpace.new( 'datasrc', Proc.new { |x|
                             a = []
                             x.annotations.each { |y|
                               y.datasrc.each { |z|
                                 a << z.split('|',2)[-1]
                                 a << z
                               }
                             }
                             a.sort!
                             a.uniq!
                             a
                           })
)
PRIMARY =
'id'
SECONDARY =
[ 'altid', 'gene_ontology', 'datasrc' ]

Instance Attribute Summary

Attributes inherited from TemplateParser

#dbclass, #errorlog, #fileid, #format, #primary, #secondary

Instance Method Summary collapse

Methods inherited from TemplateParser

#add_secondary_namespaces, #close_flatfile, #each, #open_flatfile, #parse_primary, #parse_secondary, #set_primary_namespace

Constructor Details

#initialize(pri_name = nil, sec_names = nil) ⇒ MaXMLSequenceParser

Returns a new instance of MaXMLSequenceParser.



322
323
324
325
326
327
328
329
330
331
# File 'lib/bio/io/flatfile/indexer.rb', line 322

def initialize(pri_name = nil, sec_names = nil)
  super()
  self.format = 'raw'
  self.dbclass = Bio::FANTOM::MaXML::Sequence
  self.set_primary_namespace((pri_name or PRIMARY))
  unless sec_names then
    sec_names = self.class::SECONDARY
  end
  self.add_secondary_namespaces(*sec_names)
end