Class | Bio::Spidey::Report::SegmentPair
In: | lib/bio/appl/spidey/report.rb
Parent: | Object

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.)

### Methods

hit_from hit_strand hit_to hseq new new_intron parse qseq query_from query_strand query_to

### External Aliases

mismatches | -> | mismatch_count

### 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.
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)

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

[Source]

         # File lib/bio/appl/spidey/report.rb, line 125
    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)

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.

[Source]

         # File lib/bio/appl/spidey/report.rb, line 182
    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)

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.

[Source]

         # File lib/bio/appl/spidey/report.rb, line 196
    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()

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

[Source]

         # File lib/bio/appl/spidey/report.rb, line 243
    243:         def hit_from;     @genomic.from;    end

hit_strand()

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

[Source]

         # File lib/bio/appl/spidey/report.rb, line 254
    254:         def hit_strand;   @genomic.strand;  end

hit_to()

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

[Source]

         # File lib/bio/appl/spidey/report.rb, line 247
    247:         def hit_to;       @genomic.to;      end

hseq()

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

[Source]

         # File lib/bio/appl/spidey/report.rb, line 250
    250:         def hseq;         @genomic.seq;     end

qseq()

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

[Source]

         # File lib/bio/appl/spidey/report.rb, line 235
    235:         def qseq;         @mrna.seq;        end

query_from()

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

[Source]

         # File lib/bio/appl/spidey/report.rb, line 229
    229:         def query_from;   @mrna.from;       end

query_strand()

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

[Source]

         # File lib/bio/appl/spidey/report.rb, line 239
    239:         def query_strand; @mrna.strand;     end

query_to()

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

[Source]

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

[Validate]