class Bio::GFFbrowser::Digest::InMemory

Attributes

sequencelist[R]

Public Class Methods

new(filename, options) click to toggle source
# File lib/bio/db/gff/digest/gffinmemory.rb, line 22
def initialize filename, options
  @options = options
  # Invoke the BioRuby in memory parser
  @gff = case @options[:parser]
    when :bioruby then
      Bio::GFF::GFF3.new(File.read(filename))
    else # line parser
      Bio::GFFbrowser::GFF3ParseFile.new(filename)
  end
end

Public Instance Methods

each_item(list) { |id, [rec], component| ... } click to toggle source
# File lib/bio/db/gff/digest/gffinmemory.rb, line 62
def each_item list
  list.each do | id, recs |
    seqid = recs[0].seqname
    component = find_component(recs[0])
    if @options[:no_assemble]
      recs.each do | rec |
        yield id, [rec], component
      end
    else
      yield id, recs, component
    end
  end
end
parse() click to toggle source

Digest mRNA from the GFFdb and store in Hash Next yield(id, seq) from Hash

# File lib/bio/db/gff/digest/gffinmemory.rb, line 35
def parse 
  info "---- Digest DB and store data in mRNA Hash"
  @count_ids          = Counter.new   # Count ids
  @count_seqnames     = Counter.new   # Count seqnames
  @componentlist      = {} # Store containers, like genes, contigs
  @orflist            = LinkedRecs.new
  @mrnalist           = LinkedRecs.new   # Store linked mRNA records
  @cdslist            = LinkedRecs.new
  @exonlist           = LinkedRecs.new
  @sequencelist       = {}
  @unrecognized_features = {}
  @gff.records.each do | rec |
    store_record(rec)
  end
  @gff.sequences.each do | bioseq |
    id = bioseq.entry_id
    @sequencelist[id] = bioseq.to_s # in Bio::Sequence with contained Bio::FastaFormat
  end
  validate_mrnas
  validate_cdss 
  show_unrecognized_features 
  @genelist      = @count_ids.keys 
  log_sys_info("After reading GFF")
  read_fasta
  log_sys_info("After reading FASTA")
end