Class: BioInterchange::Genomics::GFF3Reader

Inherits:
Reader
  • Object
show all
Defined in:
lib/biointerchange/genomics/gff3_reader.rb

Direct Known Subclasses

GVFReader, VCFReader

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, name_uri = nil, date = nil, batch_size = nil) ⇒ GFF3Reader

Creates a new instance of a Generic Feature Format Version 3 (GFF3) reader.

The reader supports batch processing.

name

Optional name of the person who generated the GFF3 file.

name_uri

Optional e-mail address of the person who generated the GFF3 file.

date

Optional date of when the GFF3 file was produced.

batch_size

Optional integer that determines that number of features that

should be processed in one go.



30
31
32
33
34
35
36
# File 'lib/biointerchange/genomics/gff3_reader.rb', line 30

def initialize(name = nil, name_uri = nil, date = nil, batch_size = nil)
  @name = name
  @name_uri = name_uri
  @date = date
  @batch_size = batch_size
  @linenumber = 0
end

Instance Method Details

#deserialize(inputstream) ⇒ Object

Reads a GFF3 file from the input stream and returns an associated model.

If this method is called when postponed? returns true, then the reading will continue from where it has been interrupted beforehand.

inputstream

an instance of class IO or String that holds the contents of a GFF3 file



44
45
46
47
48
49
50
51
52
# File 'lib/biointerchange/genomics/gff3_reader.rb', line 44

def deserialize(inputstream)
  if inputstream.kind_of?(IO)
    create_model(inputstream)
  elsif inputstream.kind_of?(String) then
    create_model(StringIO.new(inputstream))
  else
    raise BioInterchange::Exceptions::ImplementationReaderError, 'The provided input stream needs to be either of type IO or String.'
  end
end

#postponed?Boolean

Returns true if the reading of the input was postponed due to a full batch.

Returns:

  • (Boolean)


55
56
57
# File 'lib/biointerchange/genomics/gff3_reader.rb', line 55

def postponed?
  @postponed
end