Class: Bio::FastaNumericFormat

Inherits:
FastaFormat show all
Defined in:
lib/bio/db/fasta.rb

Overview

Treats a FASTA formatted numerical entry, such as:

>id and/or some comments                    <== comment line
24 15 23 29 20 13 20 21 21 23 22 25 13      <== numerical data
22 17 15 25 27 32 26 32 29 29 25

The precedent ‘>’ can be omitted and the trailing ‘>’ will be removed automatically.

— Bio::FastaNumericFormat.new(entry)

Stores the comment and the list of the numerical data.

— Bio::FastaNumericFormat#definition

The comment line of the FASTA formatted data.

Constant Summary

Constants inherited from FastaFormat

Bio::FastaFormat::DELIMITER, Bio::FastaFormat::DELIMITER_OVERRUN

Instance Attribute Summary

Attributes inherited from FastaFormat

#definition, #entry_overrun

Instance Method Summary collapse

Methods inherited from FastaFormat

#aalen, #aaseq, #acc_version, #accession, #accessions, #comment, #entry, #entry_id, #gi, #identifiers, #initialize, #locus, #nalen, #naseq, #query, #seq, #to_biosequence

Methods inherited from DB

#entry_id, #exists?, #fetch, #get, open, #tags

Constructor Details

This class inherits a constructor from Bio::FastaFormat

Instance Method Details

#[](n) ⇒ Object

Returns the n-th element.



319
320
321
# File 'lib/bio/db/fasta.rb', line 319

def [](n)
  data[n]
end

#dataObject

Returns the list of the numerical data (typically the quality score of its corresponding sequence) as an Array.



299
300
301
302
303
304
# File 'lib/bio/db/fasta.rb', line 299

def data
  unless @list
    @list = @data.strip.split(/\s+/).map {|x| x.to_i}
  end
  @list
end

#eachObject

Yields on each elements of the numerical data.



312
313
314
315
316
# File 'lib/bio/db/fasta.rb', line 312

def each
  data.each do |x|
    yield x
  end
end

#lengthObject

Returns the number of elements in the numerical data.



307
308
309
# File 'lib/bio/db/fasta.rb', line 307

def length
  data.length
end