class Bio::SangerChromatogram

Description

This is the Superclass for the Abif and Scf classes that allow importing of the common scf and abi sequence chromatogram formats The following attributes are Common to both the Abif and Scf subclasses

Usage

filename = "path/to/sequence_chromatogram_file"

for Abif files

chromatogram_ff = Bio::Abif.open(filename)

for Scf files

chromatogram_ff = Bio::Scf.open(filename)

chromatogram = chromatogram_ff.next_entry
chromatogram.to_seq # => returns a Bio::Sequence object
chromatogram.sequence # => returns the sequence contained within the chromatogram as a string
chromatogram.qualities # => returns an array of quality values for each base
chromatogram.atrace # => returns an array of the a trace y positions

Attributes

atrace[RW]

An array of 'y' positions (see description) for the 'A' trace from the chromatogram (Array

chromatogram_type[RW]

The type of chromatogram file .scf for Scf files and ABIF doe Abif files

ctrace[RW]

An array of 'y' positions (see description) for the 'C' trace from the chromatogram (Array

dye_mobility[RW]

The mobility of the dye used when sequencing (String)

gtrace[RW]

An array of 'y' positions (see description) for the 'G' trace from the chromatogram (Array

peak_indices[RW]

An array 'x' positions (see description) on the trace where the bases occur/have been called (Array)

qualities[RW]

An array of quality scores for each base in the sequence (Array)

sequence[RW]

The sequence contained within the chromatogram (String)

ttrace[RW]

An array of 'y' positions (see description) for the 'T' trace from the chromatogram (Array

version[RW]

The Version of the Scf or Abif file (String)

Public Class Methods

open(filename) click to toggle source
# File lib/bio/db/sanger_chromatogram/chromatogram.rb, line 73
def self.open(filename)
  Bio::FlatFile.open(self, filename)
end

Public Instance Methods

complement() click to toggle source

Returns a new chromatogram object of the appropriate subclass (scf or abi) where the sequence, traces and qualities have all been revesed and complemented

# File lib/bio/db/sanger_chromatogram/chromatogram.rb, line 126
def complement
  chromatogram = self.dup
  chromatogram.complement!
  return chromatogram
end
complement!() click to toggle source

Reverses and complements the current chromatogram object including its sequence, traces and qualities

# File lib/bio/db/sanger_chromatogram/chromatogram.rb, line 95
def complement!
  # reverse traces
  tmp_trace = @atrace
  @atrace = @ttrace.reverse
  @ttrace = tmp_trace.reverse
  tmp_trace = @ctrace
  @ctrace = @gtrace.reverse
  @gtrace = tmp_trace.reverse

  # reverse base qualities
  if (defined? @aqual) && @aqual # if qualities exist
    tmp_qual = @aqual
    @aqual = @tqual.reverse
    @tqual = tmp_qual.reverse
    tmp_qual = @cqual
    @cqual = @gqual.reverse
    @gqual = tmp_qual.reverse
  end

  #reverse qualities
  @qualities = @qualities.reverse

  #reverse peak indices
  @peak_indices = @peak_indices.map{|index| @atrace.size - index}
  @peak_indices.reverse!

  # reverse sequence
  @sequence = @sequence.reverse.tr('atgcnrykmswbvdh','tacgnyrmkswvbhd')
end
seq() click to toggle source

Returns a Bio::Sequence::NA object based on the sequence from the chromatogram

# File lib/bio/db/sanger_chromatogram/chromatogram.rb, line 78
def seq
  Bio::Sequence::NA.new(@sequence)
end
sequence_string() click to toggle source

Returns the sequence from the chromatogram as a string

# File lib/bio/db/sanger_chromatogram/chromatogram.rb, line 89
def sequence_string
  @sequence
end
to_biosequence() click to toggle source

Returns a Bio::Sequence object based on the sequence from the chromatogram

# File lib/bio/db/sanger_chromatogram/chromatogram.rb, line 83
def to_biosequence
  Bio::Sequence.adapter(self, Bio::Sequence::Adapter::SangerChromatogram)
end
Also aliased as: to_seq
to_seq()
Alias for: to_biosequence