Class: Ms::Ident::Pepxml::SearchDatabase
- Inherits:
-
Object
- Object
- Ms::Ident::Pepxml::SearchDatabase
- Includes:
- Merge
- Defined in:
- lib/ms/ident/pepxml/search_database.rb
Instance Attribute Summary collapse
-
#database_name ⇒ Object
optional.
-
#database_release_date ⇒ Object
optional.
-
#database_release_identifier ⇒ Object
optional.
-
#local_path ⇒ Object
required! the local, full path to the protein sequence database.
-
#orig_database_url ⇒ Object
optional.
-
#seq_type ⇒ Object
required! ‘AA’ or ‘NA’.
-
#size_of_residues ⇒ Object
optional.
Instance Method Summary collapse
-
#initialize(hash = {}, get_size_of_residues = false) ⇒ SearchDatabase
constructor
takes a hash to fill in values.
-
#set_size_of_residues! ⇒ Object
returns self for chaining.
- #to_xml(builder) ⇒ Object
Methods included from Merge
Constructor Details
#initialize(hash = {}, get_size_of_residues = false) ⇒ SearchDatabase
takes a hash to fill in values
26 27 28 29 30 31 |
# File 'lib/ms/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 |
Instance Attribute Details
#database_name ⇒ Object
optional
15 16 17 |
# File 'lib/ms/ident/pepxml/search_database.rb', line 15 def database_name @database_name end |
#database_release_date ⇒ Object
optional
19 20 21 |
# File 'lib/ms/ident/pepxml/search_database.rb', line 19 def database_release_date @database_release_date end |
#database_release_identifier ⇒ Object
optional
21 22 23 |
# File 'lib/ms/ident/pepxml/search_database.rb', line 21 def database_release_identifier @database_release_identifier end |
#local_path ⇒ Object
required! the local, full path to the protein sequence database
10 11 12 |
# File 'lib/ms/ident/pepxml/search_database.rb', line 10 def local_path @local_path end |
#orig_database_url ⇒ Object
optional
17 18 19 |
# File 'lib/ms/ident/pepxml/search_database.rb', line 17 def orig_database_url @orig_database_url end |
#seq_type ⇒ Object
required! ‘AA’ or ‘NA’
12 13 14 |
# File 'lib/ms/ident/pepxml/search_database.rb', line 12 def seq_type @seq_type end |
#size_of_residues ⇒ Object
optional
23 24 25 |
# File 'lib/ms/ident/pepxml/search_database.rb', line 23 def size_of_residues @size_of_residues end |
Instance Method Details
#set_size_of_residues! ⇒ Object
returns self for chaining
34 35 36 37 38 39 40 |
# File 'lib/ms/ident/pepxml/search_database.rb', line 34 def set_size_of_residues! @size_of_residues = 0 Ms::Fasta.foreach(@local_path) do |entry| @size_of_residues += entry.sequence.size end self end |
#to_xml(builder) ⇒ Object
42 43 44 45 46 |
# File 'lib/ms/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 |