Class: Bio::FANTOM::MaXML::Sequences
Overview
Constant Summary
collapse
- Data_XPath =
'maxml-sequences'
DELIMITER
Instance Attribute Summary
#elem
Instance Method Summary
collapse
#entry_id, #gsub_entities, #initialize, #to_s
Methods inherited from DB
#entry_id, #exists?, #fetch, open, #tags
Instance Method Details
186
187
188
189
190
191
192
|
# File 'lib/bio/db/fantom.rb', line 186
def [](*arg)
if arg[0].is_a?(String) and arg.size == 1 then
get(arg[0])
else
to_a[*arg]
end
end
|
194
195
196
197
198
199
|
# File 'lib/bio/db/fantom.rb', line 194
def cloneids
unless defined?(@cloneids)
@cloneids = to_a.collect { |x| x.cloneid }
end
@cloneids
end
|
162
163
164
|
# File 'lib/bio/db/fantom.rb', line 162
def each
to_a.each { |x| yield x }
end
|
#get(idstr) ⇒ Object
174
175
176
177
178
179
180
181
182
183
184
|
# File 'lib/bio/db/fantom.rb', line 174
def get(idstr)
unless defined?(@hash)
@hash = {}
end
unless @hash.member?(idstr) then
@hash[idstr] = self.find do |x|
x.altid.values.index(idstr)
end
end
@hash[idstr]
end
|
#id_strings ⇒ Object
201
202
203
204
205
206
207
208
209
|
# File 'lib/bio/db/fantom.rb', line 201
def id_strings
unless defined?(@id_strings)
@id_strings = to_a.collect { |x| x.id_strings }
@id_strings.flatten!
@id_strings.sort!
@id_strings.uniq!
end
@id_strings
end
|
166
167
168
169
170
171
172
|
# File 'lib/bio/db/fantom.rb', line 166
def to_a
unless defined?(@sequences)
@sequences = @elem.get_elements('sequence')
@sequences.collect! { |e| MaXML::Sequence.new(e) }
end
@sequences
end
|