class Bio::Spidey::Report::SegmentPair

Sequence segment pair of Spidey result. Similar to Bio::Blast::Report::Hsp but lacks many methods. For mRNA-genome mapping programs, unlike other homology search programs, the class is used not only for exons but also for introns. (Note that intron data would not be available according to run-time options of the program.)

Attributes

aaseqline[R]

Returns amino acide sequence in alignment. Returns String, because white spaces is also important. Returns nil if no alignment data are available.

align_len[R]

Returns alignment length of the segment pair. Returns nil if no alignment data are available.

gaps[R]

Returns gaps.

genomic[R]

Returns segment informations of the 'Genomic'. Returns a Bio::Spidey::Report::Segment object. This would be a Bio::Spidey specific method.

midline[R]

Returns the middle line of the alignment of the segment pair. Returns nil if no alignment data are available.

mismatch_count[R]

Returns mismatches.

mismatches[R]

Returns mismatches.

mrna[R]

Returns segment informations of the 'mRNA'. Returns a Bio::Spidey::Report::Segment object. This would be a Bio::Spidey specific method.

percent_identity[R]

Returns percent identity of the segment pair.

splice_site[R]

Returns splice site information. Returns a hash which contains :d and :a for keys and 0, 1, or nil for values. This would be a Bio::Spidey specific methods.

Public Class Methods

new(genomic, mrna, midline, aaseqline, percent_identity, mismatches, gaps, splice_site, align_len) click to toggle source

Creates a new SegmentPair object. It is designed to be called from Bio::Spidey::Report::* classes. Users shall not call it directly.

# File lib/bio/appl/spidey/report.rb, line 125
def initialize(genomic, mrna, midline, aaseqline,
               percent_identity, mismatches, gaps, splice_site,
               align_len)
  @genomic   = genomic
  @mrna      = mrna
  @midline   = midline
  @aaseqline = aaseqline
  @percent_identity = percent_identity
  @mismaches        = mismatches
  @gaps             = gaps
  @splice_site      = splice_site
  @align_len        = align_len
end
new_intron(from, to, strand, aln) click to toggle source

Creates a new SegmentPair object when the segment pair is an intron. It is designed to be called internally from Bio::Spidey::Report::* classes. Users shall not call it directly.

# File lib/bio/appl/spidey/report.rb, line 182
def self.new_intron(from, to, strand, aln)
  genomic   = Segment.new(from, to, strand, aln[0])
  mrna      = Segment.new(nil, nil, nil,    aln[2])
  midline   = aln[1]
  aaseqline = aln[3]
  self.new(genomic, mrna, midline, aaseqline,
           nil, nil, nil, nil, nil)
end
parse(str, strand, complement, aln) click to toggle source

Parses a piece of Spidey result text and creates a new SegmentPair object. It is designed to be called internally from Bio::Spidey::Report::* classes. Users shall not call it directly.

# File lib/bio/appl/spidey/report.rb, line 196
def self.parse(str, strand, complement, aln)
  /\AExon\s*\d+(\(\-\))?\:\s*(\d+)\-(\d+)\s*\(gen\)\s+(\d+)\-(\d+)\s*\(mRNA\)\s+id\s*([\d\.]+)\s*\%\s+mismatches\s+(\d+)\s+gaps\s+(\d+)\s+splice site\s*\(d +a\)\s*\:\s*(\d+)\s+(\d+)/ =~ str
  if strand == 'minus' then
    genomic = Segment.new($3, $2, strand, aln[0])
  else
    genomic = Segment.new($2, $3, 'plus', aln[0])
  end
  if complement then
    mrna    = Segment.new($4, $5, 'minus', aln[2])
  else
    mrna    = Segment.new($4, $5, 'plus',  aln[2])
  end
  percent_identity = $6
  mismatches = ($7 ? $7.to_i : nil)
  gaps = ($8 ? $8.to_i : nil)
  splice_site = {
    :d => ($9  ? $9.to_i  : nil),
    :a => ($10 ? $10.to_i : nil)
  }
  midline   = aln[1]
  aaseqline = aln[3]
  self.new(genomic, mrna, midline, aaseqline,
           percent_identity, mismatches, gaps, splice_site,
           (midline ? midline.length : nil))
end

Public Instance Methods

hit_from() click to toggle source

Returns start position of the genomic (target, hit) (the first position is 1).

# File lib/bio/appl/spidey/report.rb, line 243
def hit_from;     @genomic.from;    end
hit_strand() click to toggle source

Returns strand information of the genomic (target, hit). Returns 'plus', 'minus', or nil.

# File lib/bio/appl/spidey/report.rb, line 254
def hit_strand;   @genomic.strand;  end
hit_to() click to toggle source

Returns end position (including its position) of the genomic (target, hit).

# File lib/bio/appl/spidey/report.rb, line 247
def hit_to;       @genomic.to;      end
hseq() click to toggle source

Returns the sequence (with gaps) of the genomic (target, hit).

# File lib/bio/appl/spidey/report.rb, line 250
def hseq;         @genomic.seq;     end
qseq() click to toggle source

Returns the sequence (with gaps) of the mRNA (query).

# File lib/bio/appl/spidey/report.rb, line 235
def qseq;         @mrna.seq;        end
query_from() click to toggle source

Returns start position of the mRNA (query) (the first position is 1).

# File lib/bio/appl/spidey/report.rb, line 229
def query_from;   @mrna.from;       end
query_strand() click to toggle source

Returns strand information of the mRNA (query). Returns 'plus', 'minus', or nil.

# File lib/bio/appl/spidey/report.rb, line 239
def query_strand; @mrna.strand;     end
query_to() click to toggle source

Returns end position (including its position) of the mRNA (query).

# File lib/bio/appl/spidey/report.rb, line 232
def query_to;     @mrna.to;         end