Run the assembly state machine for the controller (rank = 0). */
| 455 | |
| 456 | /** Run the assembly state machine for the controller (rank = 0). */ |
| 457 | void NetworkSequenceCollection::runControl() |
| 458 | { |
| 459 | unsigned prunedSum = 0; |
| 460 | unsigned erosionSum = 0; |
| 461 | unsigned finalAmbg = 0; |
| 462 | SetState(NAS_LOADING); |
| 463 | size_t temp; |
| 464 | while (m_state != NAS_DONE) { |
| 465 | switch (m_state) { |
| 466 | case NAS_LOADING: |
| 467 | { |
| 468 | loadSequences(); |
| 469 | EndState(); |
| 470 | |
| 471 | m_numReachedCheckpoint++; |
| 472 | while (!checkpointReached()) |
| 473 | pumpNetwork(); |
| 474 | |
| 475 | SetState(NAS_LOAD_COMPLETE); |
| 476 | m_comm.sendControlMessage(APC_SET_STATE, |
| 477 | NAS_LOAD_COMPLETE); |
| 478 | m_comm.barrier(); |
| 479 | pumpNetwork(); |
| 480 | logger(0) << "Loaded " << m_data.size() |
| 481 | << " k-mer.\n"; |
| 482 | assert(!m_data.empty() || opt::numProc >= DEDICATE_CONTROL_AT); |
| 483 | m_data.setDeletedKey(); |
| 484 | m_data.shrink(); |
| 485 | size_t numLoaded = m_comm.reduce(m_data.size()); |
| 486 | cout << "Loaded " << numLoaded << " k-mer. " |
| 487 | "At least " |
| 488 | << toSI(numLoaded * sizeof (value_type)) |
| 489 | << "B of RAM is required.\n"; |
| 490 | |
| 491 | if (!opt::db.empty()) |
| 492 | AssemblyAlgorithms::addToDb("loadedKmer", numLoaded); |
| 493 | |
| 494 | Histogram myh |
| 495 | = AssemblyAlgorithms::coverageHistogram(m_data); |
| 496 | Histogram h(m_comm.reduce(myh.toVector())); |
| 497 | AssemblyAlgorithms::setCoverageParameters(h); |
| 498 | |
| 499 | /* |
| 500 | * If we have loaded the k-mer hash table from disk, then |
| 501 | * the adjacency data for each k-mer has already been computed |
| 502 | * in the hash table. |
| 503 | * |
| 504 | * `applyKmerCoverageThreshold` would not work correctly |
| 505 | * in this case because it removes k-mer records from |
| 506 | * the hash table without attempting to update the adjacency |
| 507 | * info of neighbouring k-mers. |
| 508 | */ |
| 509 | if (!m_data.isAdjacencyLoaded() && opt::kc > 0) { |
| 510 | cout << "Minimum k-mer multiplicity kc is " |
| 511 | << opt::kc << '\n'; |
| 512 | cout << "Removing low multiplicity k-mers..." << std::endl; |
| 513 | m_comm.barrier(); |
| 514 | size_t removed = AssemblyAlgorithms::applyKmerCoverageThreshold(m_data, opt::kc); |
no test coverage detected