Class: Bio::FANTOM::MaXML::Annotations

Inherits:
Bio::FANTOM::MaXML show all
Includes:
Enumerable
Defined in:
lib/bio/db/fantom.rb

Overview

class MaXML::Sequence

Constant Summary collapse

Data_XPath =
nil

Constants inherited from Bio::FANTOM::MaXML

DELIMITER

Instance Attribute Summary

Attributes inherited from Bio::FANTOM::MaXML

#elem

Instance Method Summary collapse

Methods inherited from Bio::FANTOM::MaXML

#entry_id, #gsub_entities, #initialize, #to_s

Methods inherited from DB

#entry_id, #exists?, #fetch, #get, open, #tags

Constructor Details

This class inherits a constructor from Bio::FANTOM::MaXML

Instance Method Details

#[](*arg) ⇒ Object



302
303
304
305
306
307
308
# File 'lib/bio/db/fantom.rb', line 302

def [](*arg)
  if arg[0].is_a?(String) and arg.size == 1 then
    get_by_qualifier(arg[0])
  else
    to_a[*arg]
  end
end

#cds_startObject



310
311
312
313
314
315
316
# File 'lib/bio/db/fantom.rb', line 310

def cds_start
  unless defined?(@cds_start)
    e = get_by_qualifier('cds_start')
    @cds_start = e ? e.anntext.to_i : nil
  end
  @cds_start
end

#cds_stopObject



318
319
320
321
322
323
324
# File 'lib/bio/db/fantom.rb', line 318

def cds_stop
  unless defined?(@cds_stop)
    e = get_by_qualifier('cds_stop')
    @cds_stop = e ? e.anntext.to_i : nil
  end
  @cds_stop
end

#data_sourceObject



334
335
336
337
338
339
340
# File 'lib/bio/db/fantom.rb', line 334

def data_source
  unless defined?(@data_source)
    e = get_by_qualifier('gene_name')
    @data_source = e ? e.datasrc[0] : nil
  end
  @data_source
end

#eachObject



273
274
275
# File 'lib/bio/db/fantom.rb', line 273

def each
  to_a.each { |x| yield x }
end

#evidenceObject



342
343
344
345
346
347
348
# File 'lib/bio/db/fantom.rb', line 342

def evidence
  unless defined?(@evidence)
    e = get_by_qualifier('gene_name')
    @evidence = e ? e.evidence : nil
  end
  @evidence
end

#gene_nameObject



326
327
328
329
330
331
332
# File 'lib/bio/db/fantom.rb', line 326

def gene_name
  unless defined?(@gene_name)
    e = get_by_qualifier('gene_name')
    @gene_name = e ? e.anntext : nil
  end
  @gene_name
end

#get_all_by_qualifier(qstr) ⇒ Object



285
286
287
288
289
290
291
292
293
294
295
# File 'lib/bio/db/fantom.rb', line 285

def get_all_by_qualifier(qstr)
  unless defined?(@hash)
    @hash = {}
  end
  unless @hash.member?(qstr) then
    @hash[qstr] = self.find_all do |x|
      x.qualifier == qstr
    end
  end
  @hash[qstr]
end

#get_by_qualifier(qstr) ⇒ Object



297
298
299
300
# File 'lib/bio/db/fantom.rb', line 297

def get_by_qualifier(qstr)
  a = get_all_by_qualifier(qstr)
  a ? a[0] : nil
end

#to_aObject



277
278
279
280
281
282
283
# File 'lib/bio/db/fantom.rb', line 277

def to_a
  unless defined?(@a)
    @a = @elem.get_elements('annotation')
    @a.collect! { |e| MaXML::Annotation.new(e) }
  end
  @a
end