void getChainingA(Chains &chains, vector<Match_t> &matches, const long querylength, const SpliceOptions_t & spliceOptions) { int i = 0; //TODO: make sure the seeds in one cluster are from one chromosome int overlap; // length of the overlap between two consecutive seeds, // will be negative when there is a gap between the two seeds const int max_overlap = 17; // the maximum value two seeds can overlap and peeled back while (i < matches.size()) { Chain chain; //build new cluster chain.push_back(matches[i]); long coverage = matches[i].len; int j = i + 1; while (j < matches.size() ) { // Make sure the seeds are ordered on ref position as well if (matches[j].ref - chain.back().ref <= spliceOptions.maxSpliceLength && chain.back().ref + chain.back().len - matches[j].ref < 0) { // overlap in query: overlap = chain.back().query + chain.back().len - matches[j].query; // The seeds do not overlap, so they can be added without any adjustment if (overlap <= 0) { chain.push_back(matches[j]); coverage += matches[j].len; } // Do not allow an overlap of greater then max_overlap else if (overlap < max_overlap) { // peel back the two seeds a bit, so the overlap disappears if possible if(chain.back().len - overlap > 2 && matches[j].len - overlap > 2) { chain.back().len -= overlap; chain.push_back(matches[j]); chain.back().len -= overlap; chain.back().ref += overlap; chain.back().query += overlap; coverage += matches[j].len; } } } j++; } if ((coverage * 100) / querylength >= spliceOptions.minCoverage) { chains.push_back(chain); i = j + 1; } else { i++; } } }
void read(Chain &chain) { char c; read(chain.name, chain.type, chain.model_name, chain.m_cg); while (true) { read(c); if (c == 'c') { return; } else if (c == 'R') { chain.push_back(Residue{}); read(chain.back()); } else { throw "This is not a standard '.jn' file! Illegal " + c; } } }