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, line 199
def initialize(query_len, target_len, strand,
               blksize, qstart, tstart, qseq, tseq,
               protein_flag)
  @blocksize  = blksize
  @qseq       = qseq
  @hseq       = hseq
  @hit_strand   = 'plus'
  w = (protein_flag ? 3 : 1) # 3 means query=protein target=dna
  case strand
  when '-'
    # query is minus strand
    @query_strand = 'minus'
    # convert positions
    @query_from = query_len - qstart
    @query_to   = query_len - qstart - blksize + 1
    # To keep compatibility, with other homology search programs,
    # we add 1 to each position number.
    @hit_from   = tstart + 1
    @hit_to     = tstart + blksize * w # - 1 + 1
  when '+-'
    # hit is minus strand
    @query_strand = 'plus'
    @hit_strand = 'minus'
    # To keep compatibility, with other homology search programs,
    # we add 1 to each position number.
    @query_from   = qstart + 1
    @query_to     = qstart + blksize # - 1 + 1
    # convert positions
    @hit_from     = target_len - tstart
    @hit_to       = target_len - tstart - blksize * w + 1
  else #when '+', '++'
    @query_strand = 'plus'
    # To keep compatibility with other homology search programs,
    # we add 1 to each position number.
    @query_from = qstart + 1
    @query_to   = qstart + blksize # - 1 + 1
    @hit_from   = tstart + 1
    @hit_to     = tstart + blksize * w # - 1 + 1
  end
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, line 281
def align_len
  @qseq ? @qseq.size : nil
end