Closed LJK1991 closed 3 years ago
I believe your problem has to do with Seurat working with transposed data. You should get the data out of Seurat with
EB_assay <- t(GetAssayData(EB, slot = "count"))
before normalizing and sqrt.
To check this is right, you should confirm that the genes are on the columns.
"Kdr" %in% colnames(EB_assay)
that fixed it indeed. thanks!
Hello,
I'm playing around to get more familiar with MAGIC and PHATE but when i run this code i get an error.
`library(dplyr) library(Seurat) library(patchwork) library(phateR) library(ggplot2) library(readr) library(viridis) library(Rmagic)
wd_EB <- setwd("/home/lucas/Documents/Work/data_practice/GSE130146_RAW/EB/")
loading the dataset -- somtimes gets weird errors, dont know why
EB.data <- Read10X(data.dir = wd_EB)
initialize the Seurat object with the raw(non-normalized data).
EB <- CreateSeuratObject(counts = EB.data, project = "EB", min.cells = 3) EB[["percent.mt"]] <- PercentageFeatureSet(EB, pattern = "^mt-") EB <- subset(EB, subset = nFeature_RNA >= 2000 & percent.mt <= 5) EB_assay <- GetAssayData(EB, slot = "count")
EB_assay <- library.size.normalize(EB_assay) EB_assay <- sqrt(EB_assay)
may be fixed through transposing matrix
tEB_assay <- t(EB_assay)
running magic (can it be done on the whole library, it can)
tEB_magic <- magic(tEB_assay, t = "auto")`
The error is
Detailed traceback: File "/home/lucas/.local/lib/python3.7/site-packages/magic/magic.py", line 651, in fit_transform self.fit(X, graph=graph) File "/home/lucas/.local/lib/python3.7/site-packages/magic/magic.py", line 446, in fit random_state=self.random_state, File "/home/lucas/.local/lib/python3.7/site-packages/graphtools/api.py", line 288, in Graph return Graph(params) File "/home/lucas/.local/lib/python3.7/site-packages/graphtools/graphs.py", line 132, in init super().init(data, n_pca=n_pca, kwargs) File "/home/lucas/.local/lib/python3.7/site-packages/graphtools/base.py", line 1019, in init super().init(data, **kwargs) File "/home/lucas/.local/lib/python3.7/site-packages/graphtools/base.py", line 134, in init self.data_nu = self._reduce_data() File "/home/lucas/.local/lib/python3.7/site-packages/graphtools/base.py", line 254, i
I have also tried uninstalling the packages with pip and then installing with pip install --user magic-impute as described in this issue #https://github.com/KrishnaswamyLab/MAGIC/issues/144
when i run it across a few genes instead of the whole matrix it gives an additional error line of
Thank you in advance