int32_t checkLinkPairCandidate(const BamAlignment& al, const RefVector& refs, const int32_t critTail) { int32_t tail = readTail(al, refs); return abs(tail) <= critTail ? tail : 0; }
bool processReadPair(const BamAlignment& al1, const BamAlignment& al2, const RefVector& refs, const int32_t totalTail, const int32_t critTail, const bool diff_ref) { if ((al1.IsFirstMate() && al2.IsFirstMate()) || (al1.IsSecondMate() && al2.IsSecondMate())) { cerr << "Incompatible mate orders: name1 = " << al1.Name << " is1stmate " << al1.IsFirstMate() << " is2ndmate " << al1.IsSecondMate() << " name2 = " << al2.Name << " is1stmate " << al2.IsFirstMate() << " is2ndmate " << al2.IsSecondMate() << endl; exit(1); } int32_t total_tail = -1; if (! (total_tail = checkLinkPair(al1, al2, refs, totalTail, critTail, diff_ref))) { return false; // reject all but link pairs // continue; } if (critTail && ! checkLinkPairCandidate(al1, refs, critTail) && ! checkLinkPairCandidate(al2, refs, critTail)) { return false; // neither read was a link pair candidate } if (debug_processReadPair) cout << "---------------------------------" << endl; int32_t lpc_tail1 = checkLinkPairCandidate(al1, refs, critTail); int32_t lpc_tail2 = checkLinkPairCandidate(al2, refs, critTail); if (debug_processReadPair) { printAlignmentInfo(al1, refs); if (lpc_tail1) { cout << "LINK PAIR CANDIDATE "; cout << ((lpc_tail1 > 0) ? "--->" : "<---") << " " << lpc_tail1 << endl; } printAlignmentInfo(al2, refs); if (lpc_tail2) { cout << "LINK PAIR CANDIDATE "; cout << ((lpc_tail2 > 0) ? "--->" : "<---") << " " << lpc_tail2 << endl; } cout << "TOTAL TAIL " << (abs(readTail(al1, refs)) + abs(readTail(al2, refs))) << endl; } return true; }
void readIpc (unsigned char* bufferedData) { // fix the data length so if the interrupt adds data // during execution of this block, it will be read // until the next readIpc unsigned int tmpLen = getLength(protBuffer); unsigned int i=0; unsigned int availBytes = 0, sendMore = 0; unsigned char failureTrue = 0; //static unsigned long long timeStamp = 0; // Set the output size accordingly bufferedData[0] = (tmpLen > MAXLOGLEN)? MAXLOGLEN: tmpLen; // TODO: Remove debugging info from readIPC //if ((timeStamp % 1000)== 0){ // printToUart2("T: %6.0f\n\r\0",(float) timeStamp*0.01); //} //timeStamp++; // write the data for(i = 1; i <= bufferedData[0]; i += 1 ) { bufferedData[i] = readFront(protBuffer); } if (getOverflow(protBuffer)>0) { // disable the SPI module SPI1STATbits.SPIEN = 0; // Disable the interrupts IEC0bits.SPI1IE = 0; IFS0bits.SPI1IF = 0; printToUart2("\n=== %s =====\n\r\n\r\n\r", "BEGIN DUMP "); //printToUart2("Ts: %f\n\r\0",(float) timeStamp*0.01); printToUart2("Ovrflw: %d\n\r", getOverflow(protBuffer)); printToUart2("Head: %d\n\r", readHead(protBuffer)); printToUart2("Tail: %d\n\r", readTail(protBuffer)); printToUart2("Len: %d\n\r", getLength(protBuffer)); printToUart2("Siz: %d\n\r", protBuffer->size); for(i = 0; i <BSIZE; i ++ ) { printToUart2("%d ", protBuffer->buffer[i]); } printToUart2("\n=== %s =====\n\r\n\r\n\r", "END "); // Empty the buffer makeEmpty(protBuffer); // Enable the interrupts IFS0bits.SPI1IF = 0; IEC0bits.SPI1IE = 1; // Enable the SPI module SPI1STATbits.SPIEN = 1; } }