diff --git a/gfalibs b/gfalibs index f245b2d..17c1715 160000 --- a/gfalibs +++ b/gfalibs @@ -1 +1 @@ -Subproject commit f245b2d937d71d2d75f04fc6510b3e341d539a93 +Subproject commit 17c171501e9d9511782bcc6d6f43b247a42fcb3d diff --git a/include/kreeq.h b/include/kreeq.h index e001b9e..9fa1f68 100644 --- a/include/kreeq.h +++ b/include/kreeq.h @@ -99,8 +99,6 @@ class DBG : public Kmap { // CRTP bool mergeSubMaps(parallelMap* map1, parallelMap* map2, uint8_t subMapIndex, uint16_t m); - bool unionSum(parallelMap* map1, parallelMap* map2, uint16_t m); - bool mergeSubMaps(parallelMap32* map1, parallelMap32* map2, uint8_t subMapIndex); bool unionSum(parallelMap32* map1, parallelMap32* map2); diff --git a/src/graph-builder.cpp b/src/graph-builder.cpp index 1e7d629..b8a978b 100644 --- a/src/graph-builder.cpp +++ b/src/graph-builder.cpp @@ -246,9 +246,7 @@ bool DBG::reloadMap32(uint16_t m) { auto newPair = std::make_pair(pair.first, dbgkmer); map.insert(newPair); } - return true; - } bool DBG::summary(uint16_t m) { diff --git a/src/input.cpp b/src/input.cpp index 3a8f02f..7ae7330 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -116,64 +116,64 @@ void Input::read() { knav.cleanup(); // delete tmp files break; } -// case 1: { // union of multiple kmerdbs -// -// std::ifstream file; -// lg.verbose("Merging input databases."); -// unsigned int numFiles = userInput.kmerDB.size(); // number of input kmerdbs -// short unsigned int k = 0; -// -// for (unsigned int i = 0; i < numFiles; i++) { // reads the kmer length from the index files checking consistency between kmerdbs -// -// file.open(userInput.kmerDB[i] + "/.index"); -// std::string line; -// -// getline(file, line); -// file.close(); -// -// if (k == 0) -// k = stoi(line); -// -// if (k != stoi(line)) { -// fprintf(stderr, "Cannot merge databases with different kmer length.\n"); -// exit(1); -// } -// } -// if (k == 0 || k > 32) { -// fprintf(stderr, "Invalid kmer length.\n"); -// exit(1); -// } -// DBG knav(userInput); // a new empty kmerdb with the specified kmer length -// lg.verbose("DBG object generated. Merging."); -// knav.kunion(); // union set -// knav.report(); // output -// knav.cleanup(); // delete tmp files -// break; -// } -// case 2: { // subgraph -// -// loadGraph(); -// DBG knav(userInput); // navigational kmerdb -// knav.loadHighCopyKmers(); // reload high copy kmers for computation steps -// -// InSequencesDBG genome; // initialize sequence collection object -// if (!userInput.inSequence.empty()) { -// -// if (!userInput.inSequence.empty()) { -// lg.verbose("Loading input sequences"); -// loadGenome(genome); // read input genome -// lg.verbose("Sequences loaded"); -// } -// knav.loadGenome(&genome); -// } -// knav.subgraph(); -// knav.report(); // output -// knav.cleanup(); // delete tmp files -// break; -// } -// default: -// fprintf(stderr, "Invalid mode.\n"); -// exit(1); + case 1: { // union of multiple kmerdbs + + std::ifstream file; + lg.verbose("Merging input databases."); + unsigned int numFiles = userInput.kmerDB.size(); // number of input kmerdbs + short unsigned int k = 0; + + for (unsigned int i = 0; i < numFiles; i++) { // reads the kmer length from the index files checking consistency between kmerdbs + + file.open(userInput.kmerDB[i] + "/.index"); + std::string line; + + getline(file, line); + file.close(); + + if (k == 0) + k = stoi(line); + + if (k != stoi(line)) { + fprintf(stderr, "Cannot merge databases with different kmer length.\n"); + exit(1); + } + } + if (k == 0 || k > 32) { + fprintf(stderr, "Invalid kmer length.\n"); + exit(1); + } + DBG knav(userInput); // a new empty kmerdb with the specified kmer length + lg.verbose("DBG object generated. Merging."); + knav.kunion(); // union set + knav.report(); // output + knav.cleanup(); // delete tmp files + break; + } + case 2: { // subgraph + + loadGraph(); + DBG knav(userInput); // navigational kmerdb + knav.loadHighCopyKmers(); // reload high copy kmers for computation steps + + InSequencesDBG genome; // initialize sequence collection object + if (!userInput.inSequence.empty()) { + + if (!userInput.inSequence.empty()) { + lg.verbose("Loading input sequences"); + loadGenome(genome); // read input genome + lg.verbose("Sequences loaded"); + } + knav.loadGenome(&genome); + } + knav.subgraph(); + knav.report(); // output + knav.cleanup(); // delete tmp files + break; + } + default: + fprintf(stderr, "Invalid mode.\n"); + exit(1); } }