Class: Bio::FlatFile::Splitter::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/bio/io/flatfile/splitter.rb

Overview

This is a template of splitter.

Direct Known Subclasses

Blast::RPSBlast::RPSBlastSplitter, Bio::Fasta::Report::FastaFormat10Splitter, Default, LineOriented

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Template) initialize(klass, bstream)

Creates a new splitter.



30
31
32
33
34
# File 'lib/bio/io/flatfile/splitter.rb', line 30

def initialize(klass, bstream)
  @dbclass = klass
  @stream = bstream
  @entry_pos_flag = nil
end

Instance Attribute Details

- (Object) entry

the last entry string read from the stream (String)



63
64
65
# File 'lib/bio/io/flatfile/splitter.rb', line 63

def entry
  @entry
end

- (Object) entry_ended_pos

(end position of the entry) + 1



77
78
79
# File 'lib/bio/io/flatfile/splitter.rb', line 77

def entry_ended_pos
  @entry_ended_pos
end

- (Object) entry_pos_flag

a flag to write down entry start and end positions



71
72
73
# File 'lib/bio/io/flatfile/splitter.rb', line 71

def entry_pos_flag
  @entry_pos_flag
end

- (Object) entry_start_pos

start position of the entry



74
75
76
# File 'lib/bio/io/flatfile/splitter.rb', line 74

def entry_start_pos
  @entry_start_pos
end

- (Object) parsed_entry

The last parsed entry read from the stream (entry data class). Note that it is valid only after get_parsed_entry is called, and the get_entry may not affect the parsed_entry attribute.



68
69
70
# File 'lib/bio/io/flatfile/splitter.rb', line 68

def parsed_entry
  @parsed_entry
end

Instance Method Details

- (Object) get_entry

Gets entry as a string. (String)

Raises:

  • (NotImplementedError)


47
48
49
# File 'lib/bio/io/flatfile/splitter.rb', line 47

def get_entry
  raise NotImplementedError
end

- (Object) get_parsed_entry

Gets entry as a data class's object



52
53
54
55
56
57
58
59
60
# File 'lib/bio/io/flatfile/splitter.rb', line 52

def get_parsed_entry
  ent = get_entry
  if ent then
    self.parsed_entry = dbclass.new(ent)
  else
    self.parsed_entry = ent
  end
  parsed_entry
end

- (Object) rewind

rewind the stream



42
43
44
# File 'lib/bio/io/flatfile/splitter.rb', line 42

def rewind
  @stream.rewind
end

- (Object) skip_leader

skips leader of the entry.

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/bio/io/flatfile/splitter.rb', line 37

def skip_leader
  raise NotImplementedError
end