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

Sequence segment pair of the sim4 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

align_len both_intron hit_from hit_to hseq new parse qseq query_from query_to seq1_intron seq2_intron

### Attributes

direction | [R] | Returns directions of mapping. Maybe one of "->", "<-", "==" or "" or nil. This would be a Bio::Sim4 specific method.
midline | [R] | Returns the "midline" of the segment pair. Returns nil if no alignment data are available.
percent_identity | [R] | Returns percent identity of the segment pair.
seq1 | [R] | Returns segment informations of ‘seq1’. Returns a Bio::Sim4::Report::Segment object. These would be Bio::Sim4 specific methods.
seq2 | [R] | Returns segment informations of ‘seq2’. Returns a Bio::Sim4::Report::Segment object. These would be Bio::Sim4 specific methods.

### Public Class methods

both_intron(prev_e, e, aln)

Parses part of sim4 result text and creates a new SegmentPair object for regions which can not be aligned correctly. It is designed to be called internally from Bio::Sim4::Report::Hit class. Users shall not use it directly.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 206
    206:         def self.both_intron(prev_e, e, aln)
    207:           self.new(Segment.new(prev_e.seq1.to+1, e.seq1.from-1, aln[0]),
    208:                    Segment.new(prev_e.seq2.to+1, e.seq2.from-1, aln[2]),
    209:                    aln[1])
    210:         end

new(seq1, seq2, midline = nil, percent_identity = nil, direction = nil)

Creates a new SegmentPair object. It is designed to be called internally from Bio::Sim4::Report::Hit object. Users shall not use it directly.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 139
    139:         def initialize(seq1, seq2, midline = nil,
    140:                        percent_identity = nil, direction = nil)
    141:           @seq1 = seq1
    142:           @seq2 = seq2
    143:           @midline = midline
    144:           @percent_identity = percent_identity
    145:           @direction = direction
    146:         end

parse(str, aln)

Parses part of sim4 result text and creates a new SegmentPair object. It is designed to be called internally from Bio::Sim4::Report::Hit class. Users shall not use it directly.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 172
    172:         def self.parse(str, aln)
    173:           /^(\d+)\-(\d+)\s*\((\d+)\-(\d+)\)\s*([\d\.]+)\%\s*([\-\<\>\=]*)/ =~ str
    174:           self.new(Segment.new($1, $2, aln[0]),
    175:                    Segment.new($3, $4, aln[2]),
    176:                    aln[1], $5, $6)
    177:         end

seq1_intron(prev_e, e, aln)

Parses part of sim4 result text and creates a new SegmentPair object when the seq1 is a intron. It is designed to be called internally from Bio::Sim4::Report::Hit class. Users shall not use it directly.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 184
    184:         def self.seq1_intron(prev_e, e, aln)
    185:           self.new(Segment.new(prev_e.seq1.to+1, e.seq1.from-1, aln[0]),
    186:                    Segment.new(nil, nil, aln[2]),
    187:                    aln[1])
    188:         end

seq2_intron(prev_e, e, aln)

Parses part of sim4 result text and creates a new SegmentPair object when seq2 is a intron. It is designed to be called internally from Bio::Sim4::Report::Hit class. Users shall not use it directly.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 195
    195:         def self.seq2_intron(prev_e, e, aln)
    196:           self.new(Segment.new(nil, nil, aln[0]),
    197:                    Segment.new(prev_e.seq2.to+1, e.seq2.from-1, aln[2]),
    198:                    aln[1])
    199:         end

### Public Instance methods

align_len()

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

[Source]

         # File lib/bio/appl/sim4/report.rb, line 238
    238:         def align_len
    239:           (@midline and @seq1.seq and @seq2.seq) ? @midline.length : nil
    240:         end

hit_from()

start position of the hit(target) (the first position is 1)

[Source]

         # File lib/bio/appl/sim4/report.rb, line 227
    227:         def hit_from;   @seq2.from; end

hit_to()

end position of the hit(target) (including its position)

[Source]

         # File lib/bio/appl/sim4/report.rb, line 230
    230:         def hit_to;     @seq2.to;   end

hseq()

hit(target) sequence (with gaps) of the alignment of the segment pair.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 234
    234:         def hseq;       @seq2.seq;  end

qseq()

query sequence (with gaps) of the alignment of the segment pair.

[Source]

         # File lib/bio/appl/sim4/report.rb, line 224
    224:         def qseq;       @seq1.seq;  end

query_from()

start position of the query (the first position is 1)

[Source]

         # File lib/bio/appl/sim4/report.rb, line 218
    218:         def query_from; @seq1.from; end

query_to()

end position of the query (including its position)

[Source]

         # File lib/bio/appl/sim4/report.rb, line 221
    221:         def query_to;   @seq1.to;   end

[Validate]