Use TOSICA.pre() to annotate a query dataset using a trained model.
Important Requirement: The var_names (genes) of the ref_adata used during training and the query_adata used for prediction must be consistent and in the same order. You should align them using:
query_adata = query_adata[:, ref_adata.var_names]
Parameters:
query_adata: An AnnData object of the query dataset.model_weight_path: Path to the weights generated during training (e.g., './my_project/model-6.pth').project: The name of the project folder created during training.
Outputs (added to query_adata or saved to disk):
query_adata.X: The Attention matrixquery_adata.obs['Prediction']: Predicted labelsquery_adata.obs['Probability']: Probability of the predictionquery_adata.var['pathway_index']: Gene set for each column./<project>/gene2token_weights.csv: Weights matrix of genes to tokens
new_adata = TOSICA.pre(query_adata, model_weight_path=<path_to_weight>, project=<my_project>)