gpgraph.exceptions¶
A two-class hierarchy.
Hierarchy¶
GpgraphError¶
Raised by:
GenotypePhenotypeGraph.gpmwhen accessed on a graph that has no map attached.GenotypePhenotypeGraph.add_modelfor unknown model strings, unknown fitness columns.GenotypePhenotypeGraph.modelwhen called beforeadd_model.from_gpmwhen the input is not aGenotypePhenotypeMap.
NeighborError¶
Raised by gpgraph.neighbors.get_neighbors for invalid cutoffs (negative, non-integer) or unknown neighbor_function arguments.
Catching pattern¶
from gpgraph.exceptions import GpgraphError, NeighborError
try:
G = GenotypePhenotypeGraph.from_gpm(gpm, neighbor_function="unknown")
except NeighborError as e:
log.error("Neighbor kernel unavailable: %s", e)
except GpgraphError as e:
log.error("Graph construction failed: %s", e)
Library code that wants to swallow only gpgraph failures should catch GpgraphError (which covers NeighborError by subclass) and re-raise anything else.