class BioInterchange::Genomics::GVFReader

Public Class Methods

new(name = nil, name_uri = nil, date = nil, batch_size = nil) click to toggle source

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.

# File lib/biointerchange/genomics/gvf_reader.rb, line 24
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 Instance Methods

add_pragma(feature_set, line) click to toggle source
# File lib/biointerchange/genomics/gvf_reader.rb, line 35
def add_pragma(feature_set, line)
  line.chomp!
  name, value = line[2..-1].split(/\s/, 2)

  value.strip! if value

  # 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
create_feature_set() click to toggle source
# File lib/biointerchange/genomics/gvf_reader.rb, line 31
def create_feature_set
  BioInterchange::Genomics::GVFFeatureSet.new()
end