Skip to content

Commit

Permalink
make including reference nodes optional
Browse files Browse the repository at this point in the history
  • Loading branch information
gf777 committed Jun 21, 2024
1 parent 2821592 commit a4c3fd8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct UserInputKreeq : UserInput {
uint8_t depth = 3, backtrackingSpan = 5;
uint64_t maxMem = 0;
// bool
int doNotCollapseNodes = 0;
int noCollapse = 0, noReference = 0;

};

Expand Down
2 changes: 1 addition & 1 deletion src/kreeq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ void DBG::DBGgraphToGFA() {
uint32_t idCounter = 0, seqPos = 0, edgeCounter = 0;
phmap::flat_hash_map<std::string, unsigned int>& headersToIds = *GFAsubgraph.getHash1();

if (!userInput.doNotCollapseNodes) {
if (!userInput.noCollapse) {

phmap::parallel_flat_hash_map<uint64_t, std::tuple<DBGkmer32,uint32_t,bool>> residualEdges; // hash, kmer, G' node

Expand Down
5 changes: 4 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ int main(int argc, char **argv) {
{"database", required_argument, 0, 'd'},
{"input-sequence", required_argument, 0, 'f'},
{"search-depth", required_argument, 0, 0},
{"do-not-collapse-nodes", no_argument, &userInput.doNotCollapseNodes, 1},
{"no-collapse", no_argument, &userInput.noCollapse, 1},
{"no-reference", no_argument, &userInput.noReference, 1},
{"out-format", required_argument, 0, 'o'},
{"input-positions", required_argument, 0, 'p'},

Expand Down Expand Up @@ -364,6 +365,8 @@ int main(int argc, char **argv) {
printf("\t-d --database DBG database.\n");
printf("\t-f --input-sequence sequence input file (fasta).\n");
printf("\t--search-depth the max depth for graph traversal (default: 3).\n");
printf("\t--no-collapse do not collapse linear nodes (default: false).\n");
printf("\t--no-reference do not include reference nodes (default: false).\n");
printf("\t-j --threads <n> numbers of threads (default: max).\n");
printf("\t-o --out-format generates various kinds of outputs (currently supported: .gfa1/2).\n");
printf("\t-p --input-positions BED coordinates of positions to extract kmers from.\n");
Expand Down
2 changes: 1 addition & 1 deletion src/subgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ bool DBG::DBGsubgraphFromSegment(InSegment *inSegment, std::array<uint16_t, 2> m
dbgKmer32color.color = 1;
segmentSubmap->insert(std::make_pair(got->first,dbgKmer32color));
}
}else{ // construct the kmer
}else if(!userInput.noReference){ // construct the kmer

DBGkmer32color dbgKmer32color;
dbgKmer32color.color = 2;
Expand Down
2 changes: 1 addition & 1 deletion validateFiles/test.39.tst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
kreeq subgraph -d testFiles/random5.kreeq -f testFiles/random5.fasta --do-not-collapse-nodes
kreeq subgraph -d testFiles/random5.kreeq -f testFiles/random5.fasta --no-collapse
embedded
Subgraph summary statistics:
Total kmers: 158
Expand Down
2 changes: 1 addition & 1 deletion validateFiles/test.44.tst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
kreeq subgraph -d testFiles/test1.kreeq -f testFiles/random1.fasta --search-depth 0 --do-not-collapse-nodes
kreeq subgraph -d testFiles/test1.kreeq -f testFiles/random1.fasta --search-depth 0 --no-collapse --no-reference
embedded
Subgraph summary statistics:
Total kmers: 979
Expand Down

0 comments on commit a4c3fd8

Please sign in to comment.