Skip to content

Commit

Permalink
Add get_mutation_node_pairs API to Python (ordered by mutation)
Browse files Browse the repository at this point in the history
There are now two APIs for getting the node->mutation mapping:
1. get_node_mutation_pairs(): ordered by nodeID
2. get_mutation_node_pairs(): ordered by mutationID (which is
   ordered by (position, allele))

The latter is very helpful when looking at per-region or in-order
calculations on the graph.
  • Loading branch information
dcdehaas committed Oct 14, 2024
1 parent 578ca60 commit 253b167
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/python/_grgl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,20 @@ PYBIND11_MODULE(_grgl, m) {
Get a list of pairs (NodeID, MutationID). Each Mutation typically
is associated to a single Node, but rarely it can have more than one
Node, in which case it will show up in more than one pair.
Results are ordered by NodeID, ascending.
:return: A list of pairs of NodeID and MutationID.
:rtype: List[Tuple[int, int]]
)^")
.def("get_mutation_node_pairs", &grgl::GRG::getMutationsToNodeOrdered, R"^(
Get a list of pairs (MutationID, NodeID). Each Mutation typically
is associated to a single Node, but rarely it can have more than one
Node, in which case it will show up in more than one pair.
Results are ordered by MutationID, ascending.
:return: A list of pairs of MutationID and NodeID.
:rtype: List[Tuple[int, int]]
)^")
.def("get_mutations_for_node", &grgl::GRG::getMutationsForNode, py::arg("node_id"), R"^(
Get all the (zero or more) Mutations associated with the given NodeID.
Expand Down

0 comments on commit 253b167

Please sign in to comment.