came.load_dpair_and_model

came.load_dpair_and_model(dirname: str | Path, subdir_model: str = '_models', ckpt: int | str | None = None)

Load the output results of CAME.

Parameters:
  • dirname – result directory of CAME

  • subdir_model – subdirectory where the model checkpoints are saved.

  • ckpt – specify which model checkpoint to load.

Returns:

  • dpair (AlignedDataPair or DataPair) – the datapair object that stores the features and graph

  • model (CGGCNet or CGCNet) – the graph neural network model

Examples

>>> dpair, model = came.load_dpair_and_model(came_resdir)

access the feature dict

>>> feat_dict = dpair.get_feature_dict(scale=True)

access the heterogrnrous cell-gene graph

>>> g = dpair.get_whole_net()

access the reference and query sample-ids

>>> obs_ids1, obs_ids2 = dpair.obs_ids1, dpair.obs_ids2

passing forward

>>> outputs = model(feat_dict, g)