Is it possible to pass a custom embedding?
Hi MAGIC developers/maintainers,
as the title reads, I was wondering whether there is an option to pass a custom embedding that overrides the PCA computed while running magic.MAGIC.fit_transform. For example like the PCA computed by Harmony so that the imputation also follows the integration logic based on Harmony results. Thank you for the clarification
Vittorio
Update: going over the code I found that the methods of the Magic class (e.g., fit, transform, fit_transform) also have a graph argument to receive a precomputed graph in the format of graphtools. So what I did was the following:
import graphtools as gt
import magic
custom_knn = gt.Graph(embedding, n_pca=None)
magic_operator = magic.MAGIC(t=3)
magic_fit = magic_operator.fit(X=adata.X, graph=custom_knn)
magic_counts = magic_fit.transform(X=adata.X, genes=genes, t_max=3)
Everything runs fine without any warning or errors. At this point my updated question would be, is this the correct workflow meant for a user-defined graph in MAGIC?