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



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

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



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

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



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

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



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

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



275
276
277
# File 'lib/bio/db/fantom.rb', line 275

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

#evidenceObject



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

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

#gene_nameObject



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

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



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

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



299
300
301
302
# File 'lib/bio/db/fantom.rb', line 299

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

#to_aObject



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

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