Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when subsetting a joint Seuratobject #195

Open
moutazhelal opened this issue Apr 1, 2024 · 0 comments
Open

Error when subsetting a joint Seuratobject #195

moutazhelal opened this issue Apr 1, 2024 · 0 comments

Comments

@moutazhelal
Copy link

Thank you for getting to my issue

I'm encountering an issue while attempting to subset my Seurat object and subsequently splitting it. The error message I'm encountering is as follows

Splitting ‘counts’, ‘data’ layers. Not splitting ‘scale.data’. If you would like to split other layers, set in layers argument.
Error in split():
! The following layers are already split: ‘counts’, ‘data’ Please join before splitting
Run rlang::last_trace() to see where the error occurred.

When attempting to apply functions such as NormalizeData or ScaleData to the object, I consistently encounter this error, and the code never completes execution.

Normalizing layer: counts
Performing log-normalization
0% 10 20 30 40 50 60 70 80 90 100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Error in fn():
! Cannot add new cells with [[<-
Run rlang::last_trace() to see where the error occurred.

When I print the myeloid_cells object, I notice a reduction in the number of cells, indicating a focus on specific cell types or criteria.

An object of class Seurat
36620 features across 21912 samples within 2 assays
Active assay: RNA (36601 features, 2000 variable features)
3 layers present: data, counts, scale.data
1 other assay present: HTO
4 dimensional reductions calculated: pca, umap, harmony, umap.harmony

Upon investigation of my Seurat object, I discovered that myeloid_cells@assays[["RNA"]] contains the same number of cells as the original object, which was 45635

myeloid_cells@assays[["RNA"]]

Assay (v5) data with 36601 features for 45635 cells
Top 10 variable features:
IGHG1, IGHGP, GNLY, IGHG3, JCHAIN, IGKC, CXCL10, IGHA1, CXCL9, SPP1
Layers:
data, counts, scale.data

Upon inspecting the layers of the RNA assay, I observed that the data and counts layers contain a number of cells equal to the subsetted data. However, I noticed that the myeloid_cells@assays[["RNA"]]@cells section in the object still retains the original number

myeloid_cells@assays[["RNA"]]@cells

A logical map for 45635 values across 10 observations

When printing myeloid_cells@assays[["RNA"]]@cells as a matrix I encountered a matrix with scale.data.x columns where x is the same number as the objects I joined

maybe this why it we get this error however I am not sure how to resolve this.

Thank you very much for any help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant