Skip to content

Commit

Permalink
refined function to print keys (strand:start-end)
Browse files Browse the repository at this point in the history
  • Loading branch information
riasc committed Nov 23, 2024
1 parent ecd7bc0 commit de65fc9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/genogrove/Node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ namespace genogrove {
void serialize(std::ostream& os);
static Node* deserialize(std::istream& is, int order);

/*
* @brief prints the keys of the node to an output stream
*/
void printKeys(std::ostream& os, std::string sep="\t");

private:
int order; // order of the Node
std::vector<Key> keys;
Expand Down
7 changes: 7 additions & 0 deletions src/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ namespace genogrove {
}
return node;
}

void Node::printKeys(std::ostream& os, std::string sep) {
for(auto& key : this->getKeys()) {
os << key.getStrand() << ":" << key.getInterval().toString() << sep;
}
os << "\n";
}
}


0 comments on commit de65fc9

Please sign in to comment.