class Bio::Blat::Report::SegmentPair

Sequence segment pair of BLAT result. Similar to Bio::Blast::Report::Hsp but lacks many methods.

Attributes

blocksize[R]

Returns block size (length) of the segment pair. This would be a Bio::Blat specific method.

hit_from[R]

Returns target (subject, hit) start position. CAUTION: In Blat’s raw result(psl format), first position is 0. To keep compatibility, the parser add 1 to the position.

hit_strand[R]

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

hit_to[R]

Returns target (subject, hit) end position. CAUTION: In Blat’s raw result(psl format), first position is 0. To keep compatibility, the parser add 1 to the position.

hseq[R]

Returns the target (subject, hit) sequence. If sequence data is not available, returns nil.

qseq[R]

Returns query sequence. If sequence data is not available, returns nil.

query_from[R]

Returns query start position. CAUTION: In Blat’s raw result(psl format), first position is 0. To keep compatibility, the parser add 1 to the position.

query_strand[R]

Returns strand information of the query. Returns ‘plus’ or ‘minus’.

query_to[R]

Returns query end position. CAUTION: In Blat’s raw result(psl format), first position is 0. To keep compatibility, the parser add 1 to the position.

Public Class Methods

new(query_len, target_len, strand, blksize, qstart, tstart, qseq, tseq, protein_flag) click to toggle source

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

    # File lib/bio/appl/blat/report.rb
199 def initialize(query_len, target_len, strand,
200                blksize, qstart, tstart, qseq, tseq,
201                protein_flag)
202   @blocksize  = blksize
203   @qseq       = qseq
204   @hseq       = hseq
205   @hit_strand   = 'plus'
206   w = (protein_flag ? 3 : 1) # 3 means query=protein target=dna
207   case strand
208   when '-'
209     # query is minus strand
210     @query_strand = 'minus'
211     # convert positions
212     @query_from = query_len - qstart
213     @query_to   = query_len - qstart - blksize + 1
214     # To keep compatibility, with other homology search programs,
215     # we add 1 to each position number.
216     @hit_from   = tstart + 1
217     @hit_to     = tstart + blksize * w # - 1 + 1
218   when '+-'
219     # hit is minus strand
220     @query_strand = 'plus'
221     @hit_strand = 'minus'
222     # To keep compatibility, with other homology search programs,
223     # we add 1 to each position number.
224     @query_from   = qstart + 1
225     @query_to     = qstart + blksize # - 1 + 1
226     # convert positions
227     @hit_from     = target_len - tstart
228     @hit_to       = target_len - tstart - blksize * w + 1
229   else #when '+', '++'
230     @query_strand = 'plus'
231     # To keep compatibility with other homology search programs,
232     # we add 1 to each position number.
233     @query_from = qstart + 1
234     @query_to   = qstart + blksize # - 1 + 1
235     @hit_from   = tstart + 1
236     @hit_to     = tstart + blksize * w # - 1 + 1
237   end
238 end

Public Instance Methods

align_len() click to toggle source

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

    # File lib/bio/appl/blat/report.rb
281 def align_len
282   @qseq ? @qseq.size : nil
283 end