GAMR.prepare(*args, **kwargs)[source]

Prepare the model to be ready for fitting. This also removes the zero and negative weights and prepares the design matrix.

  • gene – Gene in anndata.AnnData.var_names.

  • lineage – Name of a lineage in anndata.AnnData.obsm ['{lineage_key}']. If None, all weights will be set to 1.

  • backward – Direction of the process.

  • time_range

    Specify start and end times:

    • If a tuple, it specifies the minimum and maximum pseudotime. Both values can be None, in which case the minimum is the earliest pseudotime and the maximum is automatically determined.

    • If a float, it specifies the maximum pseudotime.

  • data_key – Key in anndata.AnnData.layers or ‘X’ for anndata.AnnData.X. If use_raw = True, it’s always set to ‘X’.

  • time_key – Key in anndata.AnnData.obs where the pseudotime is stored.

  • use_raw – Whether to access anndata.AnnData.raw.

  • threshold – Consider only cells with weights > threshold when estimating the test endpoint. If None, use the median of the weights.

  • weight_threshold – Set all weights below weight_threshold to weight_threshold if a float, or to the second value, if a tuple.

  • filter_cells – Filter out all cells with expression values lower than this threshold.

  • n_test_points – Number of test points. If None, use the original points based on threshold.

Return type



Nothing, just updates the following fields:

  • x - Filtered independent variables of shape (n_filtered_cells, 1) used for fitting.

  • y - Filtered dependent variables of shape (n_filtered_cells, 1) used for fitting.

  • w - Filtered weights of shape (n_filtered_cells,) used for fitting.

  • x_all - Unfiltered independent variables of shape (n_cells, 1).

  • y_all - Unfiltered dependent variables of shape (n_cells, 1).

  • w_all - Unfiltered weights of shape (n_cells,).

  • x_test - Independent variables of shape (n_samples, 1) used for prediction.

  • prepared - Whether the model is prepared for fitting.