|
Last change
on this file was
11060,
checked in by westram, 12 years ago
|
- reintegrates 'ptsfix' into 'trunk':
- adds:
- log:branches/ptsdump@8966:9000
- log:branches/ptsfix@8965:9012,9014:9017,9019:9023,9025:9046,9048:9089,9091:9114,9116:9132,9134:9139,9141:9145,9147:9151,9153:9158,9160:9379,9381:11059
- log:branches/ptsstartup@9160:9235,9237:9278,9280:9336,9339:9361,9363:9446
- log:branches/ptsundef@9061:9358
|
|
File size:
1.4 KB
|
| Line | |
|---|
| 1 | // ============================================================= // |
|---|
| 2 | // // |
|---|
| 3 | // File : PT_rangeCheck.cxx // |
|---|
| 4 | // Purpose : Check whether probe is inside region // |
|---|
| 5 | // // |
|---|
| 6 | // Coded by Ralf Westram (coder@reallysoft.de) in March 2011 // |
|---|
| 7 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 8 | // http://www.arb-home.de/ // |
|---|
| 9 | // // |
|---|
| 10 | // ============================================================= // |
|---|
| 11 | |
|---|
| 12 | #include "PT_rangeCheck.h" |
|---|
| 13 | #include "pt_prototypes.h" |
|---|
| 14 | |
|---|
| 15 | using namespace std; |
|---|
| 16 | |
|---|
| 17 | int Range::calc_max_abs_pos() const { |
|---|
| 18 | // returns the max abs startpos of a specific species, |
|---|
| 19 | // such that a probe of length 'probe_len' hits inside this Range. |
|---|
| 20 | // |
|---|
| 21 | // This check is expensive! |
|---|
| 22 | |
|---|
| 23 | const probe_input_data& pid = curr_match->get_pid(); |
|---|
| 24 | |
|---|
| 25 | pid.preload_rel2abs(); |
|---|
| 26 | |
|---|
| 27 | int rel_size = pid.get_size(); |
|---|
| 28 | int abs_size = pid.get_abspos(rel_size-1)+1; |
|---|
| 29 | |
|---|
| 30 | int max_wanted_abs = min(end, abs_size-1); |
|---|
| 31 | |
|---|
| 32 | for (int rel = 0; rel<rel_size; ++rel) { // @@@ brute forced |
|---|
| 33 | if (int(pid.get_abspos(rel))>max_wanted_abs) { |
|---|
| 34 | int max_rel = rel-probe_len; |
|---|
| 35 | return pid.get_abspos(max_rel); |
|---|
| 36 | } |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | return -1; |
|---|
| 40 | } |
|---|
| 41 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.