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