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
125 def initialize(genomic, mrna, midline, aaseqline,
126                percent_identity, mismatches, gaps, splice_site,
127                align_len)
128   @genomic   = genomic
129   @mrna      = mrna
130   @midline   = midline
131   @aaseqline = aaseqline
132   @percent_identity = percent_identity
133   @mismaches        = mismatches
134   @gaps             = gaps
135   @splice_site      = splice_site
136   @align_len        = align_len
137 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
182 def self.new_intron(from, to, strand, aln)
183   genomic   = Segment.new(from, to, strand, aln[0])
184   mrna      = Segment.new(nil, nil, nil,    aln[2])
185   midline   = aln[1]
186   aaseqline = aln[3]
187   self.new(genomic, mrna, midline, aaseqline,
188            nil, nil, nil, nil, nil)
189 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
196 def self.parse(str, strand, complement, aln)
197   /\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
198   if strand == 'minus' then
199     genomic = Segment.new($3, $2, strand, aln[0])
200   else
201     genomic = Segment.new($2, $3, 'plus', aln[0])
202   end
203   if complement then
204     mrna    = Segment.new($4, $5, 'minus', aln[2])
205   else
206     mrna    = Segment.new($4, $5, 'plus',  aln[2])
207   end
208   percent_identity = $6
209   mismatches = ($7 ? $7.to_i : nil)
210   gaps = ($8 ? $8.to_i : nil)
211   splice_site = {
212     :d => ($9  ? $9.to_i  : nil),
213     :a => ($10 ? $10.to_i : nil)
214   }
215   midline   = aln[1]
216   aaseqline = aln[3]
217   self.new(genomic, mrna, midline, aaseqline,
218            percent_identity, mismatches, gaps, splice_site,
219            (midline ? midline.length : nil))
220 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
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
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
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
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
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
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
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
232 def query_to;     @mrna.to;         end