Method: Bio::Blat::Report::SegmentPair#initialize

Defined in:
lib/bio/appl/blat/report.rb

#initialize(query_len, target_len, strand, blksize, qstart, tstart, qseq, tseq, protein_flag) ⇒ SegmentPair

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



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# 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