Class: Bio::FlatFileIndex::Indexer::Parser::MaXMLClusterParser

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

Overview

class MaXMLSequenceParser

Constant Summary collapse

NAMESTYLE =
NameSpaces.new(
             NameSpace.new( 'id', Proc.new { |x| x.entry_id } ),
             NameSpace.new( 'altid', Proc.new { |x| x.sequences.id_strings } ),
             NameSpace.new( 'datasrc', Proc.new { |x|
                             a = x.sequences.collect { |y|
                               MaXMLSequenceParser::NAMESTYLE['datasrc'].proc.call(y)
                             }
                             a.flatten!
                             a.sort!
                             a.uniq!
                             a
                           }),
             NameSpace.new( 'gene_ontology', Proc.new { |x|
                             a = x.sequences.collect { |y|
                               MaXMLSequenceParser::NAMESTYLE['gene_ontology'].proc.call(y)
                             }
                             a.flatten!
                             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) ⇒ MaXMLClusterParser

Returns a new instance of MaXMLClusterParser.



359
360
361
362
363
364
365
366
367
368
# File 'lib/bio/io/flatfile/indexer.rb', line 359

def initialize(pri_name = nil, sec_names = nil)
  super()
  self.format = 'raw'
  self.dbclass = Bio::FANTOM::MaXML::Cluster
  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