text: user14822: I've analyzed my scRNA-seq data and have a couple of Seurat clusters that show more than one cell type in each cluster. (for example, cluster 9 shows both NK and CD4 cells)
  How can I split a cluster into subclusters, based on the gene expression?
  
  user104: Increase the clustering resolution parameter to generate more (smaller) clusters, see FindClusters in the Seurat docs. Whether or not this will neatly, split your clusters into subclusters depends on your data, but normally one can easily separate CD4 and NK cells from PBMCs. See also the Clustree approach for determining the optimal resolution.
  Alternatively/additionally use a cell type annotation approach that does not require clustering, e.g. Seurat V4 permits reference mapping and there are many other methods too
  
  user73: I've done sub-clustering a few times on my Seurat data sets. The approach I take is to subset the clusters that need to be clustered (i.e. using subset), carry out a clustering of only those cells, then transfer the subcluster labels back to the original dataset. Here's some rough code, which will need to be modified for your specific situation and code preferences:
  data.sc[["main.cluster"]] <- Idents(data.sc);
  clusterToSubset <- "B cells";
  data.sub <- subset(data.sc, subset = main.cluster == clusterToSubset);
  ## ** [Cluster data.sub] **
  Idents(data.sc) <- "main.cluster";
  ## This should work as long as cell order (i.e. column names) isn't changed
  Idents(data.sc, cells=colnames(data.sc) %in% colnames(data.sub)) <- 
      paste0("Sub_", Idents(data.sub));
  data.sc[["merged.cluster"]] <- Idents(data.sc);
  
  This approach will work with multiple sub-clusters as well by changing the label that is pasted onto the sub-cluster idents:
  data.sc[["main.cluster"]] <- Idents(data.sc);
  clusterToSubset1 <- "B cells";
  data.sub.1 <- subset(data.sc, subset = main.cluster == clusterToSubset1);
  ## ** [Cluster data.sub.1] **
  clusterToSubset2 <- "T cells";
  data.sub.2 <- subset(data.sc, subset = main.cluster == clusterToSubset2);
  ## ** [Cluster data.sub.2] **
  Idents(data.sc) <- "main.cluster";
  ## This should work as long as cell order (i.e. column names) isn't changed
  Idents(data.sc, cells=colnames(data.sc) %in% colnames(data.sub.1)) <- 
      paste0("Sub1_", Idents(data.sub.1));
  Idents(data.sc, cells=colnames(data.sc) %in% colnames(data.sub.2)) <- 
      paste0("Sub2_", Idents(data.sub.2));
  data.sc[["merged.cluster"]] <- Idents(data.sc);
  
  
original_text: 14822: <p>I've analyzed my scRNA-seq data and have a couple of Seurat clusters that show more than one cell type in each cluster. (for example, cluster 9 shows both NK and CD4 cells)
  How can I split a cluster into subclusters, based on the gene expression?</p>
   104: <p>Increase the clustering <code>resolution</code> parameter to generate more (smaller) clusters, see <a href="https://satijalab.org/seurat/reference/findclusters" rel="nofollow noreferrer">FindClusters in the Seurat docs</a>. Whether or not this will neatly, split your clusters into subclusters depends on your data, but normally one can easily separate CD4 and NK cells from PBMCs. See also the <a href="https://lazappi.github.io/clustree/index.html" rel="nofollow noreferrer">Clustree</a> approach for determining the optimal resolution.</p>
  <p>Alternatively/additionally use a cell type annotation approach that does not require clustering, e.g. Seurat V4 permits <a href="https://satijalab.org/seurat/articles/multimodal_reference_mapping.html" rel="nofollow noreferrer">reference mapping</a> and there are many other methods too</p>
   73: <p>I've done sub-clustering a few times on my Seurat data sets. The approach I take is to subset the clusters that need to be clustered (i.e. using <code>subset</code>), carry out a clustering of only those cells, then transfer the subcluster labels back to the original dataset. Here's some rough code, which will need to be modified for your specific situation and code preferences:</p>
  <pre><code>data.sc[[&quot;main.cluster&quot;]] &lt;- Idents(data.sc);
  clusterToSubset &lt;- &quot;B cells&quot;;
  data.sub &lt;- subset(data.sc, subset = main.cluster == clusterToSubset);
  ## ** [Cluster data.sub] **
  Idents(data.sc) &lt;- &quot;main.cluster&quot;;
  ## This should work as long as cell order (i.e. column names) isn't changed
  Idents(data.sc, cells=colnames(data.sc) %in% colnames(data.sub)) &lt;- 
      paste0(&quot;Sub_&quot;, Idents(data.sub));
  data.sc[[&quot;merged.cluster&quot;]] &lt;- Idents(data.sc);
  </code></pre>
  <p>This approach will work with multiple sub-clusters as well by changing the label that is pasted onto the sub-cluster idents:</p>
  <pre><code>data.sc[[&quot;main.cluster&quot;]] &lt;- Idents(data.sc);
  clusterToSubset1 &lt;- &quot;B cells&quot;;
  data.sub.1 &lt;- subset(data.sc, subset = main.cluster == clusterToSubset1);
  ## ** [Cluster data.sub.1] **
  clusterToSubset2 &lt;- &quot;T cells&quot;;
  data.sub.2 &lt;- subset(data.sc, subset = main.cluster == clusterToSubset2);
  ## ** [Cluster data.sub.2] **
  Idents(data.sc) &lt;- &quot;main.cluster&quot;;
  ## This should work as long as cell order (i.e. column names) isn't changed
  Idents(data.sc, cells=colnames(data.sc) %in% colnames(data.sub.1)) &lt;- 
      paste0(&quot;Sub1_&quot;, Idents(data.sub.1));
  Idents(data.sc, cells=colnames(data.sc) %in% colnames(data.sub.2)) &lt;- 
      paste0(&quot;Sub2_&quot;, Idents(data.sub.2));
  data.sc[[&quot;merged.cluster&quot;]] &lt;- Idents(data.sc);
  </code></pre>
  