Class: Bio::DB
- Inherits:
-
Object
- Object
- Bio::DB
- Defined in:
- lib/bio/db.rb
Direct Known Subclasses
ClustalW::Report, EMBLDB, FANTOM::MaXML, FastaFormat, NBRF, NCBIDB
Class Method Summary collapse
Instance Method Summary collapse
-
#entry_id ⇒ Object
Returns an entry identifier as a String.
-
#exists?(tag) ⇒ Boolean
Returns true or false - wether the entry contains the field of the given tag name.
-
#fetch(tag, skip = 0) ⇒ Object
Similar to the get method, however, fetch returns the content of the field without its tag and any extra white spaces stripped.
-
#get(tag) ⇒ Object
Returns an intact field of the tag as a String.
-
#tags ⇒ Object
Returns a list of the top level tags of the entry as an Array of String.
Class Method Details
Instance Method Details
#entry_id ⇒ Object
Returns an entry identifier as a String. This method must be implemented in every database classes by overriding this method.
163 164 165 |
# File 'lib/bio/db.rb', line 163 def entry_id raise NotImplementedError end |
#exists?(tag) ⇒ Boolean
Returns true or false - wether the entry contains the field of the given tag name.
174 175 176 |
# File 'lib/bio/db.rb', line 174 def exists?(tag) @orig.include?(tag) end |
#fetch(tag, skip = 0) ⇒ Object
Similar to the get method, however, fetch returns the content of the field without its tag and any extra white spaces stripped.
185 186 187 188 |
# File 'lib/bio/db.rb', line 185 def fetch(tag, skip = 0) field = @orig[tag].split(/\n/, skip + 1).last.to_s truncate(field.gsub(/^.{0,#{@tagsize}}/,'')) end |
#get(tag) ⇒ Object
Returns an intact field of the tag as a String.
179 180 181 |
# File 'lib/bio/db.rb', line 179 def get(tag) @orig[tag] end |
#tags ⇒ Object
Returns a list of the top level tags of the entry as an Array of String.
168 169 170 |
# File 'lib/bio/db.rb', line 168 def @orig.keys end |