R PPForest<L>::maxScore(const Algebra<R,L> &alg, size_type i, size_type j) const { R down, over; if(j==0) return 0; if(isLeave(i)) { over=maxScore(alg,rb(i),j-1); return alg.replace(label(i),0,label(i),over); } else { down=maxScore(alg,i+1,noc(i)); over=maxScore(alg,rb(i),j-1); return alg.replace(label(i),down,label(i),over); } }
R PPForest<L>::maxScore(const RNA_Algebra<R,L> &alg, Uint i, Uint j) const { R down, over; if(j==0) return 0; if(isLeave(i)) { over=maxScore(alg,rb(i),j-1); return alg.replace(label(i),0,label(i),over); } else { down=maxScore(alg,i+1+1,noc(i)-2); over=maxScore(alg,rb(i),j-1); return alg.replacepair(label(i+1),label(i+1),down,label(getRightmostBrotherIndex(i+1)),label(getRightmostBrotherIndex(i+1)),over); } }
void RNAProfileAlignment::getSeqAli(string &seq,Uint row, Uint i, Uint j) const { if(i==0 && j==getMaxLength(0)) seq=""; if(j==0) return; // basepair=internal node if(isPair(i)) { getSeqAli(seq,row,i+1,noc(i)); getSeqAli(seq,row,rb(i),j-1); } else { // base=leaf seq+=m_lb[i].columnStr[row]; getSeqAli(seq,row,rb(i),j-1); } }
int sc_main(int argc, char ** argv){ sc_report_handler::set_actions("/IEEE_Std_1666/deprecated", SC_DO_NOTHING); system("set SC_SIGNAL_WRITE_CHECK=\"DISABLE\""); printHeader(); for (int i = 1; i< argc; i++) { string args = string(argv[i]); if (args == "-f") { i++; if (i<argc && argv[i][0] !='-') ga_configPath = string(argv[i]); else { cout << "Argument to '-f' is missing" << endl; return 0; } } else if (args == "-e") { i++; if (i<argc && argv[i][0] !='-') ga_elfPath = string(argv[i]); else { cout << "Argument to '-e' is missing" << endl; return 0; } } else{ cout << args <<" Recognized option" << endl; return 0; } } char nirgamHomeTempStr[100]; g_nirgamHome = rwDirInLinuxStyl(string(getcwd(nirgamHomeTempStr, 100))); g_configHome = getDirOfFile(ga_configPath); if(loadConfig(ga_configPath) == false) return 1; if(checkConfig() == false) return 1; printConfig(cout); tryDir(gc_resultHome); g_clkPeriod = 1/gc_simFreq; g_simPeriod = g_clkPeriod * gc_simNum; g_clock = new sc_clock("NW_CLOCK",g_clkPeriod, SC_NS); g_a = analyze(gc_topoFile, cout); if(g_a == NULL){ cout << "Error occurred. Exit Simulation" << endl; return 1; } g_tileNum = g_a->nodeNum; if (gc_simMode == 1) initStandardMode(); else if (gc_simMode == 2) initDebugMode(); else if (gc_simMode == 3) initSelfcheckMode(); NoC noc("noc", g_a); noc.switch_cntrl(*g_clock); g_tracker = new Tracker(); g_tracker->addProbes(noc); g_tracker->printRouteTables(); ////////////////////////////////////////////////////////////////////////// // soclib tile #ifdef SL_TILE if (gc_tileType == 1){ cerr << "SLNIRGAM is used for soclib IP" << endl; return 1; } sc_start(sc_time(0, SC_NS)); g_resetN = false; sc_start(sc_time(1, SC_NS)); g_resetN = true; #else if (gc_tileType == 2){ cerr << "NIRGAM is used for generic IP" << endl; return 1; } #endif ////////////////////////////////////////////////////////////////////////// if (gc_simMode == 1) doStandardMode(); else if (gc_simMode == 2) doDebugMode(); else if (gc_simMode == 3) doSelfcheckMode(); if (gc_simMode == 1) finaStandardMode(); else if (gc_simMode == 2) finaDebugMode(); else if (gc_simMode == 3) finaSelfcheckMode(); }
void RNAProfileAlignment::getStructureAlignmentFromCSF(string &s, deque<double> &pairprob, double t,size_type i, size_type j) const { size_type h; double bestPairScore; // list<Uint> leftPairList; //list<Uint> rightPairList; //Uint bestLeftIndex,bestRightIndex; //Uint lastLeftIndex,lastRightIndex; // QWATCH(i); // QWATCH(j); if(j==0) return; if(isPair(i)) { // TRACE(DBG_GET_PROFILE_STRUCTURE,"Profile_RNA_Alignment_Forest::getStructureAlignmentFromCSF","basepair"); // WATCH(DBG_GET_PROFILE_STRUCTURE,"Profile_RNA_Alignment_Forest::getStructureAlignmentFromCSF",m_lb[i].p[ALPHA_BASEPAIR]); bestPairScore=bestPairs(i); // backtrack best pairs if(bestPairScore == bestPairs(i+1) + bestPairs(getRightmostBrotherIndex(i+1)) || m_lb[i].p[ALPHA_PRO_BASEPAIR] < t) { // i pairs not // cout << "unpaired" << endl; getStructureAlignmentFromCSF(s,pairprob,t,i+1,noc(i)); // cout << "back to:" << endl; // QWATCH(i); // QWATCH(j); } else { // cout << "paired" << endl; // i pairs s += '('; pairprob.push_back(m_lb[i].p[ALPHA_PRO_BASEPAIR]); // left path - righthand best pairs h=i+1; while(h < size() && isPair(h)) { // cout << "left" << endl; // QWATCH(h); assert((int)noc(h)-1>=0); getStructureAlignmentFromCSF(s,pairprob,t,rb(h+1),noc(h)-1); h=h+1; } assert((int)noc(i)-2>=0); getStructureAlignmentFromCSF(s,pairprob,t,rb(i+1),noc(i)-2); // cout << "back to:" << endl; // QWATCH(i); // QWATCH(j); // right path - lefthand best pairs h=getRightmostBrotherIndex(i+1); while(h < size() && isPair(h)) { // cout << "right" << endl; // QWATCH(h); assert((int)noc(h)-1>=0); getStructureAlignmentFromCSF(s,pairprob,t,h+1,noc(h)-1); //h=h+1; h=getRightmostBrotherIndex(h+1); } s += ')'; pairprob.push_back(m_lb[i].p[ALPHA_PRO_BASEPAIR]); } } else { s+= '.'; pairprob.push_back(m_lb[i].p[ALPHA_PRO_BASE]); } // right forest getStructureAlignmentFromCSF(s,pairprob,t,rb(i),j-1); }