Sha256: e209bfee4d17b3ffb48e3ca3dec8b9eba248b1fbf5593f2bdde430c5271cbfa8

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

module BioInterchange::Genomics

class GVFReader < GFF3Reader

  # Creates a new instance of a Genome Variation Format (GVF) reader.
  #
  # +name+:: Optional name of the person who generated the GVF file.
  # +name_uri+:: Optional e-mail address of the person who generated the GVF file.
  # +date+:: Optional date of when the GVF file was produced.
  def initialize(name = nil, name_uri = nil, date = nil, batch_size = nil)
    # Remember: calling super without brackets passes all arguments of initialize!
    super
  end

protected

  def create_feature_set
    BioInterchange::Genomics::GVFFeatureSet.new()
  end

  def add_pragma(feature_set, line)
    line.chomp!
    name, value = line[2..-1].split(/\s/, 2)
    value.strip!

    # Interpret pragmas, and if not known, delegate to GFF3Reader (in alphabetical order):
    if name == 'attribute-method' or name == 'data-source' or name == 'score-method' or name == 'source-method' or name == 'technology-platform' then
      attributes = split_attributes(value)
      structured_attributes = feature_set.pragma(name)
      structured_attributes = { name => [] } unless structured_attributes
      structured_attributes[name] << attributes
      feature_set.set_pragma(name, structured_attributes)
    elsif name == 'gvf-version' then
      feature_set.set_pragma(name, { name => value.to_f })
    else
      super(feature_set, line)
    end
  end

end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
biointerchange-0.2.2 lib/biointerchange/genomics/gvf_reader.rb
biointerchange-0.2.1 lib/biointerchange/genomics/gvf_reader.rb
biointerchange-0.2.0 lib/biointerchange/genomics/gvf_reader.rb