class Mspire::Ident::Pepxml::SearchDatabase

Attributes

database_name[RW]

optional

database_release_date[RW]

optional

database_release_identifier[RW]

optional

local_path[RW]

required! the local, full path to the protein sequence database

orig_database_url[RW]

optional

seq_type[RW]

required! ‘AA’ or ‘NA’

size_of_residues[RW]

optional

Public Class Methods

new(hash={}, get_size_of_residues=false) click to toggle source

takes a hash to fill in values

# File lib/mspire/ident/pepxml/search_database.rb, line 26
def initialize(hash={}, get_size_of_residues=false)
  merge!(hash)
  if get_size_of_residues && File.exist?(@local_path)
    set_size_of_residues!
  end
end

Public Instance Methods

set_size_of_residues!() click to toggle source

returns self for chaining

# File lib/mspire/ident/pepxml/search_database.rb, line 34
def set_size_of_residues!
  @size_of_residues = 0
  Mspire::Fasta.foreach(@local_path) do |entry|
    @size_of_residues += entry.sequence.size
  end
  self
end
to_xml(builder) click to toggle source
# File lib/mspire/ident/pepxml/search_database.rb, line 42
def to_xml(builder)
  attrs = [:local_path, :seq_type, :database_name, :orig_database_url, :database_release_date, :database_release_identifier, :size_of_residues].map {|k| v=send(k) ; [k, v] if v }.compact
  builder.search_database(Hash[attrs])
  builder
end