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 in .rowNamesDF<-(x, value = value) : invalid 'row.names' length #8916

Open
Noralii opened this issue May 21, 2024 · 12 comments
Open

Error in .rowNamesDF<-(x, value = value) : invalid 'row.names' length #8916

Noralii opened this issue May 21, 2024 · 12 comments

Comments

@Noralii
Copy link

Noralii commented May 21, 2024

data_combined <- RunFastMNN(object.list = SplitObject(data_combined, split.by = "orig.ident"))
Computing 2000 integration features
Error in .rowNamesDF<-(x, value = value) : invalid 'row.names' length

@ZhangRuifen
Copy link

Hi! I have the same problem as you. But it is when I run IntegrateData(),this error appeared.
I don't know why ?

Epi_integrated <- IntegrateData(anchorset = integ_anchors,
                                normalization.method = "SCT")
Error in `.rowNamesDF<-`(x, value = value) : invalid 'row.names' length

My seurat version is V5.
I'm not sure if it has anything to do with the version of Seurat, because I ran this step with v4 before without any problems

@ZhangRuifen
Copy link

ZhangRuifen commented May 27, 2024

I've solved the question by the below codes:

filter_genes <- function(seurat_obj) {
  seurat_obj <- subset(seurat_obj, features = integ_features)
  return(seurat_obj)
}
filtered_seurat_list <- lapply(Epi.list, filter_genes)

As you see, I just make the rownames(Epi.list) = integ_features, after that Every thing become so smoothly like that:

integ_anchors <- FindIntegrationAnchors(object.list = Epi.list, anchor.features = integ_features, normalization.method = "SCT", reduction = "cca")

obj.combined <- IntegrateData(anchorset = integ_anchors, normalization.method = "SCT") 

So, the most important thing is to justify both of this two object's rownames are the same as each other.

@beazors
Copy link

beazors commented Jun 10, 2024

@ZhangRuifen Thanks for your code. I had the same issue as the OP, tried your code (which worked up until the last step), and ran into an issue at IntegrateData again:

>  pbmc.integrated <- IntegrateData(anchorset = integ_anchors,normalization.method="SCT")
[1] 1
Warning: Layer counts isn't present in the assay object; returning NULL
[1] 2
Warning: Layer counts isn't present in the assay object; returning NULL
[1] 3
Warning: Layer counts isn't present in the assay object; returning NULL
[1] 4
Warning: Layer counts isn't present in the assay object; returning NULL
[1] 5
Warning: Layer counts isn't present in the assay object; returning NULL
[1] 6
Warning: Layer counts isn't present in the assay object; returning NULL
[1] 7
Warning: Layer counts isn't present in the assay object; returning NULL
[1] 8
Warning: Layer counts isn't present in the assay object; returning NULL
[1] 9
Warning: Layer counts isn't present in the assay object; returning NULL
[1] 10
Warning: Layer counts isn't present in the assay object; returning NULL
Merging dataset 1 into 2
Extracting anchors for merged samples
Finding integration vectors
Finding integration vector weights
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Integrating data
Warning: Layer counts isn't present in the assay object; returning NULL
Merging dataset 7 into 5
Extracting anchors for merged samples
Finding integration vectors
Finding integration vector weights
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Integrating data
Warning: Layer counts isn't present in the assay object; returning NULL
Merging dataset 10 into 8
Extracting anchors for merged samples
Finding integration vectors
Finding integration vector weights
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
(...)
Integrating data
Warning: Layer counts isn't present in the assay object; returning NULL
Warning: Assay integrated changing from Assay to SCTAssay
Warning: Layer counts isn't present in the assay object; returning NULL
**************************************************|

Additionally, for anyone: I'm confused as to how this line of code (IntegrateData) knows to perform integration on the correct object (the list of datasets) if it is not fed into it. It looks like it's only the anchor set and normalization method that goes in.

@ZhangRuifen
Copy link

@beazors Hi! I'm not sure whether you have done with JoinLayers() to your Seurat object. And did you get your integrated object? It seems no errors but only warnings, you can check what you have got.

@beazors
Copy link

beazors commented Jun 11, 2024

@ZhangRuifen I did get an object, but I'm not sure how to evaluate if it's worked or what to do with the object next. Normally I have merged all my data first and run everything downstream of that (not in list form). EDIT - wait, I just found a possible lead for this - for anyone else it is [here].

After doing the steps in the above link, it worked, thanks!

@drroya
Copy link

drroya commented Jun 13, 2024

I think it might be something wrong with the newest seurat version (for me 5.1.0)??
Because I am running the same codes in a different computer without any error! The exact same code.

@Hannah-Doerpholz
Copy link

I had the same error message when trying to run SelectIntegrationFeatures on my split seurat object. I downgraded r-seurat (I'm working with conda) to 5.0.3, but that didn't solve the issue. I then also downgraded r-seuratobject to 5.0.1 and that solved the issue for me.

@drroya
Copy link

drroya commented Jun 13, 2024

@Hannah-Doerpholz

Thank you for sharing the solution.
Can you kindly share the code you use for downgrading. For me it weirdly doesn't work!

@Hannah-Doerpholz
Copy link

Hannah-Doerpholz commented Jun 13, 2024

@drroya Since I am doing everything in a conda environment I ran the following in the terminal:

conda activate seurat_env
conda install r-seurat=5.0.3
conda install r-seuratobject=5.0.1

I didn't need to remove the previous version for that as it just downgraded them.
If you don't use conda this should work for you if you do it with R:

install.packages("remotes")
library(remotes)
remotes::install_version("Seurat", version="5.0.3")
remotes::install_version("SeuratObject", version="5.0.1")

When prompted, I chose to not update anything else.
Maybe you might need to remove the old packages before, if you encounter some errors. For me it worked without removing anything:

remove.packages("Seurat")
remove.packages("SeuratObject")

Edit: If you run rstudio you should restart it after downgrading. If you run R in the terminal it's probably a good idea to restart the terminal too to make sure the changes took place.

@drroya
Copy link

drroya commented Jun 13, 2024

@Hannah-Doerpholz

Many thanks for your reply and the detailed codes!

@ZhangRuifen
Copy link

@beazors Sorry to reply late! I'm happy that you have sovle your question! But I see the link you mentioned, I don't think it's any different than our code, but it still solved the problem. It's made me a little confused.

@longmanz
Copy link
Contributor

Hi,
Thank you all for reporting this issue. Can anyone kindly provide us with a reproducible example + a small test dataset so that we can look into this? In addition, does this issue still persists if you switch to the Seurat V5 integration pipeline (IntegrateLayers)? Or it only occurs when you run IntegrateData() ?

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

6 participants