2
$\begingroup$

I was trying to do subsetting via:

pbmc = subset(pbmc, subset = nFeature > 1000 & nCount > 4000)

R returns:

Error in FetchData.Seurat(object = object, vars = unique(x = expr.char[vars.use]), :
None of the requested variables were found:

and then nothing, so it says cannot find requested variables and doesn't tell me what's missing...

I'm very confused. Thank you so much for your help!

$\endgroup$
0

3 Answers 3

1
$\begingroup$

I've come across the same error which seems to be a common issue when using the subset() function with Seurat objects. Sometimes, I encountered the same error and couldn't figure out the reason behind it, checking the variable's names was not a remedy in my case as I specified the exact same name for subsetting as to what I could see in my object metadata. However, I found a workaround to subset cells in a Seurat object using a different approach.

Instead of using subset(), you can try the following:

seurat_obj_subset <- seurat_obj[, <condition to be met>]

For example, if you want to subset a Seurat object called 'pbmc' based on conditions like having more than 1000 features and more than 4000 counts, you can use the following code:

pbmc = pbmc[, pbmc$nFeature > 1000 & pbmc$nCount > 4000]
$\endgroup$
0
$\begingroup$

From the steps in the PBMC_3k tutorial, it looks like you need to suffix the name with the assay as well, separated by an underscore (in this case, RNA):

pbmc <- subset(pbmc, subset = (nFeature_RNA > 1000) & (nCount_RNA > 4000))
$\endgroup$
0
$\begingroup$

"Error in FetchData.Seurat(object = object, vars = unique(x = expr.char[vars.use]), : None of the requested variables were found:"

As the error is pointing out here, you should check your variable names that you have used here. It must match the variable names in the pbmc object that you want to subset.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.