Class: Bio::Blat::Report::SegmentPair
- Defined in:
- lib/bio/appl/blat/report.rb
Overview
Sequence segment pair of BLAT result. Similar to Bio::Blast::Report::Hsp but lacks many methods.
Instance Attribute Summary collapse
-
#blocksize ⇒ Object
readonly
Returns block size (length) of the segment pair.
-
#hit_from ⇒ Object
readonly
Returns target (subject, hit) start position.
-
#hit_strand ⇒ Object
readonly
Returns strand information of the target (subject, hit).
-
#hit_to ⇒ Object
readonly
Returns target (subject, hit) end position.
-
#hseq ⇒ Object
readonly
Returns the target (subject, hit) sequence.
-
#qseq ⇒ Object
readonly
Returns query sequence.
-
#query_from ⇒ Object
readonly
Returns query start position.
-
#query_strand ⇒ Object
readonly
Returns strand information of the query.
-
#query_to ⇒ Object
readonly
Returns query end position.
Instance Method Summary collapse
-
#align_len ⇒ Object
Returns alignment length of the segment pair.
-
#initialize(query_len, target_len, strand, blksize, qstart, tstart, qseq, tseq, protein_flag) ⇒ SegmentPair
constructor
Creates a new SegmentPair object.
Constructor Details
#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.
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
# File 'lib/bio/appl/blat/report.rb', line 158 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 |
Instance Attribute Details
#blocksize ⇒ Object (readonly)
Returns block size (length) of the segment pair. This would be a Bio::Blat specific method.
236 237 238 |
# File 'lib/bio/appl/blat/report.rb', line 236 def blocksize @blocksize end |
#hit_from ⇒ Object (readonly)
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.
219 220 221 |
# File 'lib/bio/appl/blat/report.rb', line 219 def hit_from @hit_from end |
#hit_strand ⇒ Object (readonly)
Returns strand information of the target (subject, hit). Returns ‘plus’ or ‘minus’.
232 233 234 |
# File 'lib/bio/appl/blat/report.rb', line 232 def hit_strand @hit_strand end |
#hit_to ⇒ Object (readonly)
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.
224 225 226 |
# File 'lib/bio/appl/blat/report.rb', line 224 def hit_to @hit_to end |
#hseq ⇒ Object (readonly)
Returns the target (subject, hit) sequence. If sequence data is not available, returns nil.
228 229 230 |
# File 'lib/bio/appl/blat/report.rb', line 228 def hseq @hseq end |
#qseq ⇒ Object (readonly)
Returns query sequence. If sequence data is not available, returns nil.
210 211 212 |
# File 'lib/bio/appl/blat/report.rb', line 210 def qseq @qseq end |
#query_from ⇒ Object (readonly)
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.
201 202 203 |
# File 'lib/bio/appl/blat/report.rb', line 201 def query_from @query_from end |
#query_strand ⇒ Object (readonly)
Returns strand information of the query. Returns ‘plus’ or ‘minus’.
214 215 216 |
# File 'lib/bio/appl/blat/report.rb', line 214 def query_strand @query_strand end |
#query_to ⇒ Object (readonly)
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.
206 207 208 |
# File 'lib/bio/appl/blat/report.rb', line 206 def query_to @query_to end |
Instance Method Details
#align_len ⇒ Object
Returns alignment length of the segment pair. Returns nil if no alignment data are available.
240 241 242 |
# File 'lib/bio/appl/blat/report.rb', line 240 def align_len @qseq ? @qseq.size : nil end |