| 1 | #cxx . . $ `<file>/libsim4/sim4core/exon_cores.C`/include "sim4.H"cxx . . $ `<file>/libsim4/sim4core/sim4.H`/ |
| 2 | #include <math.h> |
| 3 | |
| 4 | // exon_cores() must have seq-1 passed in. search() offsets this. |
| 5 | |
| 6 | void |
| 7 | Sim4cxx . . $ Sim4#::exon_corescxx . . $ Sim4#exon_cores(e96565e350528f6c).(char *s1, |
| 8 | char *s2, |
| 9 | int l1, |
| 10 | int l2, |
| 11 | int offset1, |
| 12 | int offset2, |
| 13 | int flag, |
| 14 | mss_tcxx . . $ mss_t# MSS, |
| 15 | int K, |
| 16 | int type) { |
| 17 | |
| 18 | _mspManagercxx . . $ Sim4#_mspManager..clearcxx . . $ mspManager#clear(49f6e7a06ebc5aa8).(); |
| 19 | _mspManagercxx . . $ Sim4#_mspManager..clearDiagonalcxx . . $ mspManager#clearDiagonal(3e454b8ccf442868).(l1, l2); |
| 20 | _mspManagercxx . . $ Sim4#_mspManager..setScoreThresholdcxx . . $ mspManager#setScoreThreshold(3e454b8ccf442868).(K, globalParamscxx . . $ Sim4#globalParams.->_interspeciescxx . . $ sim4parameters#_interspecies.); |
| 21 | |
| 22 | //mss_t MSS = masks_shifts(seed); LLL DELETE |
| 23 | |
| 24 | bld_tablecxx . . $ Sim4#bld_table(d63ab20a994cedf1).(s2,l2,MSS,type); |
| 25 | searchcxx . . $ Sim4#search(7451b53ebf26694b).(s1,s2,l1,l2,MSS); |
| 26 | |
| 27 | // Cleaning up after the bld_table() is done at the next call, or |
| 28 | // in the destructor. |
| 29 | // |
| 30 | hashtablecxx . . $ Sim4#hashtable. = 0L; |
| 31 | |
| 32 | exon_listcxx . . $ Sim4#exon_list. = _mspManagercxx . . $ Sim4#_mspManager..doLinkingcxx . . $ mspManager#doLinking(7fc3f6b356247b5f).(DEFAULT_WEIGHTcxx . . $ `/build/tmp.xxI8Gm0qJM/package/libsim4/sim4core/sim4defines.H:18:10`!, DEFAULT_DRANGEcxx . . $ `/build/tmp.xxI8Gm0qJM/package/libsim4/sim4core/sim4defines.H:17:10`!, offset1, offset2, flag, false, s1, s2); |
| 33 | } |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | void |
| 39 | Sim4cxx . . $ Sim4#::searchcxx . . $ Sim4#search(7451b53ebf26694b).(char *s1, char *s2, int l1, int l2, mss_tcxx . . $ mss_t# MSS) { |
| 40 | struct hash_nodecxx . . $ Sim4#hash_node# *h; |
| 41 | char *t; |
| 42 | uint64cxx . . $ uint64# ecode; |
| 43 | int masked_ecode; |
| 44 | int i, p, j; |
| 45 | |
| 46 | // Too short? Abort! |
| 47 | // |
| 48 | if (l1 < MSS.seedLengthcxx . . $ mss_t#seedLength.) |
| 49 | return; |
| 50 | |
| 51 | t = s1+1; |
| 52 | i = 0; |
| 53 | |
| 54 | int validEncoding = 1 - MSS.seedLengthcxx . . $ mss_t#seedLength.; |
| 55 | int pos1; |
| 56 | |
| 57 | ecode = uint64ZEROcxx . . $ `libutil/util.h:50:10`!; |
| 58 | |
| 59 | // 5% win (tested on on small examples) if we use t[] instead of *t below. |
| 60 | |
| 61 | // Scan from low to high position in the genomic sequence |
| 62 | // |
| 63 | if (MSS.typecxx . . $ mss_t#type. == CONTINUOUS_SEEDcxx . . $ `libsim4/sim4core/sim4b1_s.H:4:9`!) { |
| 64 | for (i=0; i < l1; i++) { |
| 65 | pos1 = (int)(t-s1) + i; |
| 66 | |
| 67 | if (encodingcxx . . $ Sim4#encoding.[(int)t[i]] >= 0) { |
| 68 | validEncoding++; |
| 69 | |
| 70 | ecode &= maskcxx . . $ Sim4#mask.; |
| 71 | ecode <<= 2; |
| 72 | ecode |= encodingcxx . . $ Sim4#encoding.[(int)t[i]]; |
| 73 | masked_ecode = (int)ecode; |
| 74 | |
| 75 | if (validEncoding > 0) { |
| 76 | for (h = hashtablecxx . . $ Sim4#hashtable.->tablecxx . . $ Sim4#hash_table#table.[masked_ecode & HASH_SIZEcxx . . $ `libsim4/sim4core/sim4.H:68:9`!]; h; h = h->linkcxx . . $ Sim4#hash_node#link.) { |
| 77 | if (h->ecodecxx . . $ Sim4#hash_node#ecode. == masked_ecode) { |
| 78 | |
| 79 | // These positions are from high to low (see table.C) |
| 80 | // |
| 81 | for (p = h->poscxx . . $ Sim4#hash_node#pos.; p >= 0; p = hashtablecxx . . $ Sim4#hashtable.->nextPoscxx . . $ Sim4#hash_table#nextPos.[p]) |
| 82 | _mspManagercxx . . $ Sim4#_mspManager..addHitcxx . . $ mspManager#addHit(9f5b6853d98719a6).(s1, s2, |
| 83 | l1, l2, |
| 84 | pos1, p, |
| 85 | MSS); |
| 86 | break; |
| 87 | } |
| 88 | } |
| 89 | } |
| 90 | } else { |
| 91 | validEncoding = 1 - MSS.seedLengthcxx . . $ mss_t#seedLength.; |
| 92 | } |
| 93 | } |
| 94 | } else { |
| 95 | /* SPACED_SEED */ |
| 96 | for (i=0; i < l1; i++) { |
| 97 | pos1 = (int)(t-s1) + i; |
| 98 | |
| 99 | if (encodingcxx . . $ Sim4#encoding.[(int)t[i]] >= 0) { |
| 100 | validEncoding++; |
| 101 | |
| 102 | ecode &= MSS.maskcxx . . $ mss_t#mask.; |
| 103 | ecode <<= 2; |
| 104 | ecode |= encodingcxx . . $ Sim4#encoding.[(int)t[i]]; |
| 105 | |
| 106 | #if 0 |
| 107 | masked_ecode = mask_shift(ecode,MSS); |
| 108 | #else |
| 109 | // 40% cheaper for cross-species, 53% cheaper for same species |
| 110 | for (j=masked_ecode=0; j<MSS.masknumcxx . . $ mss_t#masknum.; j++) |
| 111 | masked_ecode += (ecode & MSS.maskscxx . . $ mss_t#masks.[j]) >> MSS.shiftscxx . . $ mss_t#shifts.[j]; |
| 112 | #endif |
| 113 | |
| 114 | if (validEncoding > 0) { |
| 115 | for (h = hashtablecxx . . $ Sim4#hashtable.->tablecxx . . $ Sim4#hash_table#table.[masked_ecode & HASH_SIZEcxx . . $ `libsim4/sim4core/sim4.H:68:9`!]; h; h = h->linkcxx . . $ Sim4#hash_node#link.) { |
| 116 | if (h->ecodecxx . . $ Sim4#hash_node#ecode. == masked_ecode) { |
| 117 | |
| 118 | // These positions are from high to low (see table.C) |
| 119 | // |
| 120 | for (p = h->poscxx . . $ Sim4#hash_node#pos.; p >= 0; p = hashtablecxx . . $ Sim4#hashtable.->nextPoscxx . . $ Sim4#hash_table#nextPos.[p]) |
| 121 | _mspManagercxx . . $ Sim4#_mspManager..addHitcxx . . $ mspManager#addHit(9f5b6853d98719a6).(s1, s2, |
| 122 | l1, l2, |
| 123 | pos1, p, |
| 124 | MSS); |
| 125 | break; |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | } else { |
| 130 | validEncoding = 1 - MSS.seedLengthcxx . . $ mss_t#seedLength.; |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | } |