<p>Yes, this can be done, particularly if your concern is with the clustering / UMAP rather than the transformation process; I've done this recently with some Rhapsody single cell data that we generated. The main trick is adding <em>'return.only.var.genes = FALSE'</em>, as well as calculating a variable set that is a bit larger than the desired set. Depending on the number of cells, this will balloon the size of the resulting Seurat object pretty significantly.</p>
<p>Note that UMAP is a technique to place <em>cells</em>, rather than genes. If you have the information on where the cells should go, then plotting gene expression on top of that via FeaturePlot should work without any reprojection needed.</p>
<p>Here's what I did (with experiment-specific variables excluded):</p>
<pre><code>sct.data &lt;- SCTransform(sct.data, vars.to.regress=&quot;percent.mt&quot;,
                        variable.features.n = 3000 + length(genesToExclude),
                        return.only.var.genes = FALSE);


sct.data &lt;- RunPCA(sct.data, verbose = TRUE,
                   features=setdiff(VariableFeatures(sct.data), genesToExclude));
sct.data &lt;- RunUMAP(sct.data);
sct.data &lt;- FindNeighbors(sct.data);
sct.data &lt;- FindClusters(sct.data);
</code></pre>
<p>All transformed genes should be available for querying in the results.</p>

CC BY-SA 4.0
2021-04-21T06:04:42.217Z
2022-05-17T05:20:04.350Z
2022-05-17T05:20:04.350Z
gringer
<p>My data consists of two groups control and stim. I'm concerned that my clustering in the stim group is dominated by the unregulated genes. I can remove these genes and recluster but is there a way to then project the removed genes onto the new umap space so see if they are indeed all clustered together. They are no longer in the seurat object so I can't think of how to do this. I hope this makes sense.</p>

<r><seurat><clustering>
Clustering with Seurat
# Clustering with Seurat

(Asked by: username_0 on 2021-04-20)

My data consists of two groups control and stim. I'm concerned that my clustering in the stim group is dominated by the unregulated genes. I can remove these genes and recluster but is there a way to then project the removed genes onto the new umap space so see if they are indeed all clustered together. They are no longer in the seurat object so I can't think of how to do this. I hope this makes sense.

**Tags:** r, seurat, clustering

---

## 1 answers

### Answer by username_1 on 2021-04-21. Score: 1

Yes, this can be done, particularly if your concern is with the clustering / UMAP rather than the transformation process; I've done this recently with some Rhapsody single cell data that we generated. The main trick is adding 'return.only.var.genes = FALSE', as well as calculating a variable set that is a bit larger than the desired set. Depending on the number of cells, this will balloon the size of the resulting Seurat object pretty significantly.
Note that UMAP is a technique to place cells, rather than genes. If you have the information on where the cells should go, then plotting gene expression on top of that via FeaturePlot should work without any reprojection needed.
Here's what I did (with experiment-specific variables excluded):
sct.data <- SCTransform(sct.data, vars.to.regress="percent.mt",
                        variable.features.n = 3000 + length(genesToExclude),
                        return.only.var.genes = FALSE);


sct.data <- RunPCA(sct.data, verbose = TRUE,
                   features=setdiff(VariableFeatures(sct.data), genesToExclude));
sct.data <- RunUMAP(sct.data);
sct.data <- FindNeighbors(sct.data);
sct.data <- FindClusters(sct.data);

All transformed genes should be available for querying in the results.


---

