istringstream istr(cigar_string);
52 while(istr >>
len>> c) {
54 if(m_elements.empty()) {
58}
else if(c ==
'N') {
59 if(m_elements.empty()) {
63cigar_string = cigar_string.substr(clip_pos);
69clip_pos = (
int)istr.tellg();
76m_qfrom -= el.
m_len;
77m_sfrom -= el.
m_len;
78}
else if(el.
m_type==
'D')
79m_sfrom -= el.
m_len;
81m_qfrom -= el.
m_len;
83 if(m_elements.empty() || m_elements.front().m_type != el.
m_type)
84m_elements.push_front(el);
86m_elements.front().m_len += el.
m_len;
93}
else if(el.
m_type==
'D')
98 if(m_elements.empty() || m_elements.back().m_type != el.
m_type)
99m_elements.push_back(el);
101m_elements.back().m_len += el.
m_len;
106 ITERATE(list<SElement>,
i, m_elements)
109 intmissingstart = qstart+m_qfrom;
110 if(missingstart > 0)
112 intmissingend = qlen-1-m_qto-qstart;
124 ITERATE(list<SElement>,
i, m_elements) {
125 if(
i->m_type ==
'M') {
128 for(
int l= 0;
l<
i->m_len; ++
l) {
129 if((*(
query+qpos) == *(
subject+spos)) == is_match) {
134indels.push_back(indl);
136is_match = !is_match;
144indels.push_back(indl);
146}
else if(
i->m_type ==
'D') {
148indels.push_back(indl);
152indels.push_back(indl);
164 ITERATE(list<SElement>,
i, m_elements) {
165 if(
i->m_type ==
'M') {
168 for(
int l= 0;
l<
i->m_len; ++
l) {
173is_match = !is_match;
180}
else if(
i->m_type ==
'D') {
189 intmissingstart = qstart+m_qfrom;
190 if(missingstart > 0)
192 intmissingend = qlen-1-m_qto-qstart;
203 ITERATE(list<SElement>,
i, m_elements) {
204 if(
i->m_type ==
'M') {
205align.first.insert(align.first.end(),
query,
query+
i->m_len);
207align.second.insert(align.second.end(),
subject,
subject+
i->m_len);
209}
else if(
i->m_type ==
'D') {
210align.first.insert(align.first.end(),
i->m_len,
'-');
211align.second.insert(align.second.end(),
subject,
subject+
i->m_len);
214align.first.insert(align.first.end(),
query,
query+
i->m_len);
216align.second.insert(align.second.end(),
i->m_len,
'-');
227 ITERATE(list<SElement>,
i, m_elements) {
228 if(
i->m_type ==
'M') {
229 for(
int l= 0;
l<
i->m_len; ++
l) {
235}
else if(
i->m_type ==
'D') {
249 ITERATE(list<SElement>,
i, m_elements) {
250 if(
i->m_type ==
'M') {
251 for(
int l= 0;
l<
i->m_len; ++
l) {
257}
else if(
i->m_type ==
'D') {
274 ITERATE(list<SElement>,
i, m_elements) {
275 if(
i->m_type ==
'M') {
276 for(
int l= 0;
l<
i->m_len; ++
l) {
281}
else if(
i->m_type ==
'D') {
283score -= gopen+gapextend*
i->m_len;
286score -= gopen+gapextend*
i->m_len;
293 CCigar GlbAlign(
const char*
a,
intna,
const char*
b,
intnb,
intrho,
intsigma,
const char delta[256][256]) {
297 int* s =
new int[nb+1];
298 int* sm =
new int[nb+1];
299 int* gapb =
new int[nb+1];
300 char* mtrx =
new char[(na+1)*(nb+1)];
307 for(
int i= 2;
i<= nb; ++
i)
308sm[
i] = sm[
i-1]-sigma;
311 for(
int i= 0;
i<= nb; ++
i)
312gapb[
i] = bignegative;
314 enum{Agap = 1, Bgap = 2, Astart = 4, Bstart = 8};
317 for(
int i= 1;
i<= nb; ++
i) {
323 for(
int i= 0;
i< na; ++
i) {
324*(++m) = Bstart|Bgap;
326 intgapa = bignegative;
328 const char* matrix =
delta[ai];
330 for(
intj = 0; j < nb; ) {
332 intss = sm[j]+matrix[(
int)
b[j]];
340 int& gapbj = gapb[++j];
342 if(sm[j]-rs > gapbj) {
369m = mtrx+(na+1)*(nb+1)-1;
371 while(ia >= 0 || ib >= 0) {
374 while(!(*m&Astart)) {
381}
else if(*m&Bgap) {
383 while(!(*m&Bstart)) {
407 CCigar LclAlign(
const char*
a,
intna,
const char*
b,
intnb,
intrho,
intsigma,
const char delta[256][256]) {
411 int* s =
new int[nb+1];
412 int* sm =
new int[nb+1];
413 int* gapb =
new int[nb+1];
414 char* mtrx =
new char[(na+1)*(nb+1)];
418 enum{Agap = 1, Bgap = 2, Astart = 4, Bstart = 8, Zero = 16};
420 for(
int i= 0;
i<= nb; ++
i) {
428 char* max_ptr = mtrx;
431 for(
int i= 0;
i< na; ++
i) {
435 const char* matrix =
delta[ai];
437 for(
intj = 0; j < nb; ) {
439 intss = sm[j]+matrix[(
int)
b[j]];
447 int& gapbj = gapb[++j];
449 if(sm[j]-rs > gapbj) {
457 if(ss > max_score) {
468 if(ss > max_score) {
485 intia = (
int)(max_ptr-mtrx)/(nb+1)-1;
486 intib = (max_ptr-mtrx)%(nb+1)-1;
489 while((ia >= 0 || ib >= 0) && !(*m&Zero)) {
492 while(!(*m&Astart)) {
499}
else if(*m&Bgap) {
501 while(!(*m&Bstart)) {
525 CCigar LclAlign(
const char*
a,
intna,
const char*
b,
intnb,
intrho,
intsigma,
boolpinleft,
boolpinright,
const char delta[256][256]) {
529 int* s =
new int[nb+1];
530 int* sm =
new int[nb+1];
531 int* gapb =
new int[nb+1];
532 char* mtrx =
new char[(na+1)*(nb+1)];
537 enum{Agap = 1, Bgap = 2, Astart = 4, Bstart = 8, Zero = 16};
541gapb[0] = bignegative;
545mtrx[1] = Astart|Agap;
546gapb[1] = bignegative;
547 for(
int i= 2;
i<= nb; ++
i) {
548sm[
i] = sm[
i-1]-sigma;
550gapb[
i] = bignegative;
555 for(
int i= 1;
i<= nb; ++
i) {
558gapb[
i] = bignegative;
564 char* max_ptr = mtrx;
567 for(
int i= 0;
i< na; ++
i) {
568*(++m) = pinleft ? Bstart|Bgap : Zero;
569 intgapa = bignegative;
572 const char* matrix =
delta[ai];
574 for(
intj = 0; j < nb; ) {
576 intss = sm[j]+matrix[(
int)
b[j]];
584 int& gapbj = gapb[++j];
586 if(sm[j]-rs > gapbj) {
594 if(ss > max_score) {
605 if(ss > max_score) {
614 if(*sp <= 0 && !pinleft) {
630maxa = (
int)(max_ptr-mtrx)/(nb+1)-1;
631maxb = (max_ptr-mtrx)%(nb+1)-1;
637 while((ia >= 0 || ib >= 0) && !(*m&Zero)) {
640 while(!(*m&Astart)) {
647}
else if(*m&Bgap) {
649 while(!(*m&Bstart)) {
676 int* s =
new int[nb+1];
677 int* sm =
new int[nb+1];
678 int* gapb =
new int[nb+1];
679 char* mtrx =
new char[(na+1)*(nb+1)];
683 enum{Agap = 1, Bgap = 2, Astart = 4, Bstart = 8, Zero = 16};
685 for(
int i= 0;
i<= nb; ++
i) {
693 char* max_ptr = mtrx;
699 const char* matrix =
delta[ai];
701 intbleft = blimits->
GetFrom();
702 intbright = blimits->
GetTo();
708 for(
intj = bleft; j <= bright; ) {
710 intss = sm[j]+matrix[(
int)
b[j]];
718 int& gapbj = gapb[++j];
720 if(sm[j]-rs > gapbj) {
728 if(ss > max_score) {
739 if(ss > max_score) {
753 if(++blimits ==
last)
759 for( ; bright <
next-1; ++bright)
765 intia = (
int)(max_ptr-mtrx)/(nb+1)-1;
766 intib = (max_ptr-mtrx)%(nb+1)-1;
769 while((ia >= 0 || ib >= 0) && !(*m&Zero)) {
772 while(!(*m&Astart)) {
779}
else if(*m&Bgap) {
781 while(!(*m&Bstart)) {
807 for(
int i= 0;
i< 256; ++
i) {
809 for(
intj = 0; j < 256; ++j) {
811 elsematrix[
i][j] = -mismatch;
818 stringaa(
"ARNDCQEGHILKMFPSTWYVBZX*");
8204,-1,-2,-2, 0,-1,-1, 0,-2,-1,-1,-1,-1,-2,-1, 1, 0,-3,-2, 0,-2,-1, 0,-4,
821-1, 5, 0,-2,-3, 1, 0,-2, 0,-3,-2, 2,-1,-3,-2,-1,-1,-3,-2,-3,-1, 0,-1,-4,
822-2, 0, 6, 1,-3, 0, 0, 0, 1,-3,-3, 0,-2,-3,-2, 1, 0,-4,-2,-3, 3, 0,-1,-4,
823-2,-2, 1, 6,-3, 0, 2,-1,-1,-3,-4,-1,-3,-3,-1, 0,-1,-4,-3,-3, 4, 1,-1,-4,
8240,-3,-3,-3, 9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2,-4,
825-1, 1, 0, 0,-3, 5, 2,-2, 0,-3,-2, 1, 0,-3,-1,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,-1,-2,-2, 0,-3,-1, 4,-3,-2,-1,-4,
840-2,-1, 3, 4,-3, 0, 1,-1, 0,-3,-4, 0,-3,-3,-2, 0,-1,-4,-3,-3, 4, 1,-1,-4,
841-1, 0, 0, 1,-3, 3, 4,-2, 0,-3,-3, 1,-1,-3,-1, 0,-1,-3,-2,-2, 1, 4,-1,-4,
8420,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2, 0, 0,-2,-1,-1,-1,-1,-1,-4,
843-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4,-4, 1
846 for(
int i= 0;
i< 256; ++
i) {
847 for(
intj = 0; j < 256; ++j) {
852 intnum = (
int)aa.size();
853 for(
int i= 0;
i< num; ++
i) {
855 for(
intj = 0; j < num; ++j) {
856 intscore = scores[num*j+
i];
858matrix[(
int)c][(
int)d] = score;
860matrix[(
int)c][(
int)
tolower(d)] = score;
867 intlength = (
int)seq.size();
876 case 'A': tA += 1;
break;
877 case 'C': tC += 1;
break;
878 case 'G': tG += 1;
break;
879 case 'T': tT += 1;
break;
883 doubleentropy = -(tA*
log(tA/length)+tC*
log(tC/length)+tG*
log(tG/length)+tT*
log(tT/length))/(length*
log(4.));
void PushFront(const SElement &el)
TCharAlign ToAlign(const char *query, const char *subject) const
void PushBack(const SElement &el)
int Distance(const char *query, const char *subject) const
CCigar(int qto=-1, int sto=-1)
TInDels GetInDels(int sstart, const char *const query, const char *subject) const
string CigarString(int qstart, int qlen) const
int Score(const char *query, const char *subject, int gopen, int gapextend, const char delta[256][256]) const
string DetailedCigarString(int qstart, int qlen, const char *query, const char *subject) const
int Matches(const char *query, const char *subject) const
static DLIST_TYPE *DLIST_NAME() last(DLIST_LIST_TYPE *list)
static DLIST_TYPE *DLIST_NAME() next(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
double Entropy(const string &seq)
CCigar LclAlign(const char *a, int na, const char *b, int nb, int rho, int sigma, const char delta[256][256])
CCigar VariBandAlign(const char *a, int na, const char *b, int nb, int rho, int sigma, const char delta[256][256], const TSignedSeqRange *blimits)
CCigar GlbAlign(const char *a, int na, const char *b, int nb, int rho, int sigma, const char delta[256][256])
pair< string, string > TCharAlign
vector< CInDelInfo > TInDels
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
unsigned int
A callback function used to compare two keys in a database.
Magic spell ;-) needed for some weird compilers... very empiric.
Int4 delta(size_t dimension_, const Int4 *score_)
static int match(PCRE2_SPTR start_eptr, PCRE2_SPTR start_ecode, uint16_t top_bracket, PCRE2_SIZE frame_size, pcre2_match_data *match_data, match_block *mb)
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4