Method: Bio::DAS#get_dna
- Defined in:
- lib/bio/io/das.rb
#get_dna(dsn, segments) ⇒ Object
Returns an Array of Bio::DAS::DNA. The ‘dsn’ can be a String or a Bio::DAS::DSN object. The ‘segments’ can be a Bio::DAS::SEGMENT object or an Array of Bio::DAS::SEGMENT
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/bio/io/das.rb', line 104 def get_dna(dsn, segments) ary = [] 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}/dna", opts) doc = REXML::Document.new(result.body) doc.elements.each('/descendant::SEQUENCE') do |e| sequence = DNA.new sequence.entry_id = e.attributes['id'] sequence.start = e.attributes['start'] sequence.stop = e.attributes['stop'] sequence.version = e.attributes['version'] e.elements.each do |e| sequence.sequence = Bio::Sequence::NA.new(e.text) sequence.length = e.attributes['length'].to_i end ary << sequence end ary end |