Class: Mspire::Ident::Peptide::Db
- Inherits:
-
Object
- Object
- Mspire::Ident::Peptide::Db
- Defined in:
- lib/mspire/ident/peptide/db.rb
Overview
Very simple object for protein retrieval from a peptide-centric database See Mspire::Ident::Peptide::Db::IO for an on-disc version for larger files.
Defined Under Namespace
Constant Summary collapse
- PROTEIN_DELIMITER =
"\t"
- KEY_VALUE_DELIMITER =
': '
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
-
#[](key) ⇒ Object
returns protein id’s as an array.
-
#initialize(db_file) ⇒ Db
constructor
A new instance of Db.
- #keys ⇒ Object
- #size ⇒ Object
- #values ⇒ Object
Constructor Details
#initialize(db_file) ⇒ Db
Returns a new instance of Db.
15 16 17 |
# File 'lib/mspire/ident/peptide/db.rb', line 15 def initialize(db_file) @data = YAML.load_file(db_file) end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
13 14 15 |
# File 'lib/mspire/ident/peptide/db.rb', line 13 def data @data end |
Instance Method Details
#[](key) ⇒ Object
returns protein id’s as an array
20 21 22 23 |
# File 'lib/mspire/ident/peptide/db.rb', line 20 def [](key) val=@data[key] val.chomp.split(PROTEIN_DELIMITER) if val end |
#keys ⇒ Object
25 26 27 |
# File 'lib/mspire/ident/peptide/db.rb', line 25 def keys @data.keys end |
#size ⇒ Object
33 34 35 |
# File 'lib/mspire/ident/peptide/db.rb', line 33 def size @data.size end |
#values ⇒ Object
29 30 31 |
# File 'lib/mspire/ident/peptide/db.rb', line 29 def values @data.values end |