<p>@swbarnes2 code is one correct way to find marker genes that differ between samples. You could also change the <code>Idents</code> slot and then just use <code>FindAllMarkers</code>.</p>
<p>It's not clear what you mean by accurate in your comment. If you look for marker genes between samples (orig.ident) without clustering, Seurat will use expression data from all the cells attributed to each sample to find sample-specific markers. This approach can be right or wrong depending on the question you are asking.</p>
<p>For example, <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5878932/" rel="nofollow noreferrer">this paper</a> asked which genes were unique to each patient's tumor (see Figure 2D). To recreate their analysis, you would restrict your Seurat object to only include tumor cells (removing other cell types like immune cells and fibroblasts) and then perform <code>FindMarkers</code> on sample origin. This answers which genes are specifically expressed on each patient's tumor cells, averaged over the different tumor cell subpopulations (in HNSC there are basal, differentiated, stressed, and pEMT subpopulations). This analysis could be a good idea if you are trying to find a sample-specific marker that is expressed on the majority of tumor cells in a sample. The downside to this approach is that it averages across tumor cell subpopulations. If there is a rare tumor subpopulation (say a set of cancer stem cells) that do not express the same markers as the majority of cells, the markers Seurat finds may not be expressed on this rare population.</p>
<p>It doesn't make sense to look for sample specific markers when your Seurat object includes several different types of cells (epithelial cells, immune cells, stromal cells etc). In other words, you should probably restrict your analysis to some major cell type before looking for marker genes. If you don't, your results will be analogous to a bulk RNA-Seq differential expression, and will be significantly influenced by the cell type composition between samples which defeats the purpose of doing single cell RNA-sequencing. In this case, one could consider the results inaccurate, as it will be difficult to attribute marker genes to one cell type.</p>
<p>Another way to interpret your question about accuracy is whether calling marker genes between samples provides accurate statistical inference (are the marker genes identified truly up/down in specific patients). If you are using single cell data to compare expression between conditions (normal vs tumor, control vs treated cells), it is advised to not use Seurat FindMarkers or similar tools when you have multiple samples. The problem is that FindMarkers treats each cell like its own sample, even though all cells from a sample are similar and thus correlated. This violates the IID assumption used by the Wilcox test and other methods used by FindMarkers and results in really low p-values and inflated false positive rates. In this scenario, recent studies suggest you should use a pseudo-bulk approach to prevent a high number of false positives. <a href="https://www.bioconductor.org/packages/release/bioc/html/muscat.html" rel="nofollow noreferrer">muscat</a> is one method that performs pseudo-bulk analysis, and its paper explains pseudo-bulk analysis in more detail.</p>
<p><strong>TL;DR</strong> If you are going to look for sample-specific (or other metadata-based) marker genes, it's probably a good idea to first restrict the analysis to a major cell type. If you are using single cell data to perform differential expression analysis comparing conditions, use pseudo-bulk approaches.</p>

CC BY-SA 4.0
2022-04-26T23:42:00.987Z
2022-04-26T23:42:00.987Z
Tomas Bencomo
<p>I'm not quite sure what you are asking, but you can use anything in the metadata as a grouping with FindMarkers.</p>
<pre><code>DefaultAssay(combined.all) &lt;- &quot;RNA&quot;
Idents(combined.all) &lt;- &quot;orig.ident&quot;


for (sample in unique(Idents(combined.all))) {
  clustermarkers &lt;- FindMarkers(combined.all, ident.1 = sample)
  print(paste(&quot;Cluster&quot;, sample))
  print(head(clustermarkers, n = 10))
}
</code></pre>

CC BY-SA 4.0
2020-07-29T21:42:30.703Z
thank you for the response! To be clear, when I use different grouping, is it accurate? or is the accuracy dependant on finding markers after clustering?
Najeha Mohamed
CC BY-SA 4.0
2020-07-28T21:53:49.453Z
2020-07-28T21:53:49.453Z
swbarnes2
<p>For the differentially expressed genes analysis, is it possible to check for DEGs based on the levels already identified in the object? For example, my dataset contains cells from 11 subjects, which are marked as so (orig.ident). I want to analyze the differentially expressed markers between them. Will it be accurate to do so? Or should I follow the clustering analysis in Seurat? I want to see the difference in genes between the cells according to the subjects but I'm afraid that may not be the right way to do so.</p>
<pre><code>  head(BC@meta.data)
         orig.ident nCount_RNA nFeature_RNA percent.mito
 BC01_02       BC01   998944.0         9189 0.2387108038
 BC01_03       BC01   999696.4         9548 0.2925345423
 BC01_04       BC01   999057.5         7440 0.0009893724
</code></pre>
<p>Is clustering analysis absolutely necessary to see the DEGs between them? or can I directly move to FindMarkers based on the levels (orig.ident)?</p>

<r><scrnaseq><seurat><differential-expression>
Differentially expressed genes analysis in Seurat
# Differentially expressed genes analysis in Seurat

(Asked by: username_0 on 2020-07-28)

For the differentially expressed genes analysis, is it possible to check for DEGs based on the levels already identified in the object? For example, my dataset contains cells from 11 subjects, which are marked as so (orig.ident). I want to analyze the differentially expressed markers between them. Will it be accurate to do so? Or should I follow the clustering analysis in Seurat? I want to see the difference in genes between the cells according to the subjects but I'm afraid that may not be the right way to do so.
  head(BC@meta.data)
         orig.ident nCount_RNA nFeature_RNA percent.mito
 BC01_02       BC01   998944.0         9189 0.2387108038
 BC01_03       BC01   999696.4         9548 0.2925345423
 BC01_04       BC01   999057.5         7440 0.0009893724

Is clustering analysis absolutely necessary to see the DEGs between them? or can I directly move to FindMarkers based on the levels (orig.ident)?

**Tags:** r, scrnaseq, seurat, differential-expression

---

## 2 answers

### Answer by username_1 on 2022-04-26. Score: 1

@swbarnes2 code is one correct way to find marker genes that differ between samples. You could also change the `Idents` slot and then just use `FindAllMarkers`.

It's not clear what you mean by accurate in your comment. If you look for marker genes between samples (orig.ident) without clustering, Seurat will use expression data from all the cells attributed to each sample to find sample-specific markers. This approach can be right or wrong depending on the question you are asking.

For example, [this paper](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5878932/) asked which genes were unique to each patient's tumor (see Figure 2D). To recreate their analysis, you would restrict your Seurat object to only include tumor cells (removing other cell types like immune cells and fibroblasts) and then perform `FindMarkers` on sample origin. This answers which genes are specifically expressed on each patient's tumor cells, averaged over the different tumor cell subpopulations (in HNSC there are basal, differentiated, stressed, and pEMT subpopulations). This analysis could be a good idea if you are trying to find a sample-specific marker that is expressed on the majority of tumor cells in a sample. The downside to this approach is that it averages across tumor cell subpopulations. If there is a rare tumor subpopulation (say a set of cancer stem cells) that do not express the same markers as the majority of cells, the markers Seurat finds may not be expressed on this rare population.

It doesn't make sense to look for sample specific markers when your Seurat object includes several different types of cells (epithelial cells, immune cells, stromal cells etc). In other words, you should probably restrict your analysis to some major cell type before looking for marker genes. If you don't, your results will be analogous to a bulk RNA-Seq differential expression, and will be significantly influenced by the cell type composition between samples which defeats the purpose of doing single cell RNA-sequencing. In this case, one could consider the results inaccurate, as it will be difficult to attribute marker genes to one cell type.

Another way to interpret your question about accuracy is whether calling marker genes between samples provides accurate statistical inference (are the marker genes identified truly up/down in specific patients). If you are using single cell data to compare expression between conditions (normal vs tumor, control vs treated cells), it is advised to not use Seurat FindMarkers or similar tools when you have multiple samples. The problem is that FindMarkers treats each cell like its own sample, even though all cells from a sample are similar and thus correlated. This violates the IID assumption used by the Wilcox test and other methods used by FindMarkers and results in really low p-values and inflated false positive rates. In this scenario, recent studies suggest you should use a pseudo-bulk approach to prevent a high number of false positives. [muscat](https://www.bioconductor.org/packages/release/bioc/html/muscat.html) is one method that performs pseudo-bulk analysis, and its paper explains pseudo-bulk analysis in more detail.

**TL;DR** If you are going to look for sample-specific (or other metadata-based) marker genes, it's probably a good idea to first restrict the analysis to a major cell type. If you are using single cell data to perform differential expression analysis comparing conditions, use pseudo-bulk approaches.


---

### Answer by username_2 on 2020-07-28. Score: 0

I'm not quite sure what you are asking, but you can use anything in the metadata as a grouping with FindMarkers.
DefaultAssay(combined.all) <- "RNA"
Idents(combined.all) <- "orig.ident"


for (sample in unique(Idents(combined.all))) {
  clustermarkers <- FindMarkers(combined.all, ident.1 = sample)
  print(paste("Cluster", sample))
  print(head(clustermarkers, n = 10))
}

> **Comments:**
> **username_0**: thank you for the response! To be clear, when I use different grouping, is it accurate? or is the accuracy dependant on finding markers after clustering?  

---

