Error when performing integration to correct for batch effects
0
0
Entering edit mode
14 months ago
Chris ▴ 260

Hi all,

Would you suggest why I got this error when running the code below:

obj.list <- SplitObject(merged_seurat, split.by = "condition")

for(i in 1:length(obj.list)){
  obj.list[[i]] <- NormalizeData(object = obj.list[[i]])
  obj.list[[i]] <- FindVariableFeatures(object = obj.list[[i]])

Error in FindVariableFeatures(object = obj.list[[i]]) : 
  object 'i' not found

Thank you so much!

integration • 622 views
ADD COMMENT
1
Entering edit mode

This is a basic R error. You probably have a copy paste error - check if you have the { after the for and if you do, ensure you don't have the corresponding } immediately after the NormalizeData call.

ADD REPLY
0
Entering edit mode

Hi Ram, I run that code in a chunk in Rmarkdown so I have used {} like this:

```{r}
for(i in 1:length(obj.list)){
  obj.list[[i]] <- NormalizeData(object = obj.list[[i]])
  obj.list[[i]] <- FindVariableFeatures(object = obj.list[[i]])
}
```

So how can I overcome this issue?

ADD REPLY
1
Entering edit mode

I think for debugging purposes, you should try running just the R code fragments one after another. If they all work fine, the problem is in the way the segments are added to the Rmd. If not, you'll run into problems while testing and that'll tell you what the underlying issue is.

ADD REPLY

Login before adding your answer.

Traffic: 2620 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6