Method: Bio::DAS#get_types
- Defined in:
- lib/bio/io/das.rb
#get_types(dsn, segments = []) ⇒ Object
Returns a Bio::DAS::TYPES object. The ‘dsn’ can be a String or a Bio::DAS::DSN object. The ‘segments’ is optional and can be a Bio::DAS::SEGMENT object or an Array of Bio::DAS::SEGMENT
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 |
# File 'lib/bio/io/das.rb', line 173 def get_types(dsn, segments = []) # argument 'type' is deprecated types = TYPES.new dsn = dsn.source if dsn.instance_of?(DSN) segments = [segments] if segments.instance_of?(SEGMENT) opts = [] segments.each do |s| opts << "segment=#{s.entry_id}:#{s.start},#{s.stop}" end result = Bio::Command.post_form("#{@server}/das/#{dsn}/types", opts) doc = REXML::Document.new(result.body) doc.elements.each('/descendant::GFF') do |e| types.version = e.attributes['version'] types.href = e.attributes['href'] e.elements.each do |e| segment = SEGMENT.new segment.entry_id = e.attributes['id'] segment.start = e.attributes['start'] segment.stop = e.attributes['stop'] segment.version = e.attributes['version'] segment.label = e.attributes['label'] e.elements.each do |e| t = TYPE.new t.entry_id = e.attributes['id'] t.method = e.attributes['method'] t.category = e.attributes['category'] t.count = e.text.to_i segment.types << t end types.segments << segment end end types end |