<p>I've come across the same error which seems to be a common issue when using the <code>subset()</code> 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.</p>
<p>Instead of using <code>subset()</code>, you can try the following:</p>
<pre><code>seurat_obj_subset &lt;- seurat_obj[, &lt;condition to be met&gt;]
</code></pre>
<p>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:</p>
<pre><code>pbmc = pbmc[, pbmc<span class="math-container">$nFeature &gt; 1000 &amp; pbmc$</span>nCount &gt; 4000]
</code></pre>

CC BY-SA 4.0
2023-06-28T23:34:57.817Z
2023-06-28T23:34:57.817Z
Hamid G
<p>From the steps in the <a href="https://satijalab.org/seurat/archive/v3.0/pbmc3k_tutorial.html" rel="nofollow noreferrer">PBMC_3k tutorial</a>, it looks like you need to suffix the name with the assay as well, separated by an underscore (in this case, <code>RNA</code>):</p>
<pre><code>pbmc &lt;- subset(pbmc, subset = (nFeature_RNA &gt; 1000) &amp; (nCount_RNA &gt; 4000))
</code></pre>

CC BY-SA 4.0
2022-08-13T11:08:38.133Z
2022-08-13T11:08:38.133Z
gringer
<blockquote>
<p>&quot;Error in FetchData.Seurat(object = object, vars = unique(x = expr.char[vars.use]), :
None of the requested variables were found:&quot;</p>
</blockquote>
<p>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.</p>

CC BY-SA 4.0
2022-08-13T12:07:55.640Z
2022-08-13T14:34:51.083Z
2022-08-13T14:34:51.083Z
Nitesh Shriwash
<p>I was trying to do subsetting via:</p>
<pre><code>pbmc = subset(pbmc, subset = nFeature &gt; 1000 &amp; nCount &gt; 4000)
</code></pre>
<p>R returns:</p>
<pre><code>Error in FetchData.Seurat(object = object, vars = unique(x = expr.char[vars.use]), :
None of the requested variables were found:
</code></pre>
<p>and then nothing, so it says cannot find requested variables and doesn't tell me what's missing...</p>
<p>I'm very confused. Thank you so much for your help!</p>

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

(Asked by: username_0 on 2022-08-12)

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!

**Tags:** r, seurat, subset

---

## 3 answers

### Answer by username_1 on 2023-06-28. Score: 1

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[, ]

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]


---

### Answer by username_2 on 2022-08-13. Score: 0

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))


---

### Answer by username_3 on 2022-08-13. Score: 0

> "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.


---

