Method: Bio::FlatFileIndex.makeindex

Defined in:
lib/bio/io/flatfile/indexer.rb

.makeindex(is_bdb, dbname, format, options, *files) ⇒ Object



733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
# File 'lib/bio/io/flatfile/indexer.rb', line 733

def self.makeindex(is_bdb, dbname, format, options, *files)
  if format then
    dbclass = formatstring2class(format)
  else
    dbclass = Bio::FlatFile.autodetect_file(files[0])
    raise "Cannot determine format" unless dbclass
    DEBUG.print "file format is #{dbclass}\n"
  end

  options = {} unless options
  pns = options['primary_namespace']
  sns = options['secondary_namespaces']

  parser = Indexer::Parser.new(dbclass, pns, sns)

  #if /(EMBL|SPTR)/ =~ dbclass.to_s then
    #a = [ 'DR' ]
    #parser.add_secondary_namespaces(*a)
  #end
  if sns = options['additional_secondary_namespaces'] then
    parser.add_secondary_namespaces(*sns)
  end

  if is_bdb then
    Indexer::makeindexBDB(dbname, parser, options, *files)
  else
    Indexer::makeindexFlat(dbname, parser, options, *files)
  end
end