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