Answers.Body: <p>You can use the <code>cells</code> argument to only display the data for a specific subset of cells.  </p>
  
  <p>For example to extract the values for a cluster 2:</p>
  
  <pre><code># The cluster identity is stored in the meta.data
  # In this example there is a clustering column called "RNA_snn_res.0.7" 
  # but any metadata column can be used
  
  clust2.cells &lt;- rownames(Seurat.data@meta.data[Seurat.data$RNA_snn_res.0.7 == 2, ])
  
  FeatureScatter(Seurat.data, feature1 = "gene_A", feature2 = "gene_B", cells = clust2.cells)
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-20T14:06:06.673Z
Answers.Text: Thank you so much.
Answers.UserDisplayName: raiora
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-11T17:45:39.167Z
Answers.Text: You can also subset your Seurat object within the call to `FeatureScatter`, such as `FeatureScatter(subset(Seurat.data, idents = "2"), "gene_A", "gene_B")`
Answers.UserDisplayName: Dave Ross
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-20T12:36:11.130Z
Answers.LastActivityDate: 2020-05-20T14:26:02.863Z
Answers.LastEditDate: 2020-05-20T14:26:02.863Z
Answers.UserDisplayName: PPK
Body: <p>Nowadays, I am trying to calculate Pearson correlation values between two genes of my interest from single-cell RNA-data (features.tsv, barcodes.tsv, and matrix.mtx files) which are obtained from the 10xgenomics cellranger. </p>
  
  <p>FYI, The filtered_feature_bc_matrix includes an aggregated population of tumor-infiltrating immune cells that are derived from 6 different syngeneic mouse tumors (<a href="https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE121861" rel="nofollow noreferrer">https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE121861</a>). I downloaded fastq files and ran "cellranger count" and "cellranger aggr" commands to obtain combined data.</p>
  
  <p>My strategy includes the use of the "feature scatter" function deposited in the library(Seurat). Finally, I ended up getting results below. </p>
  
  <p><a href="https://i.sstatic.net/0OLyF.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/0OLyF.png" alt="FeatureScatter plot"></a></p>
  
  <p>My question is that can we select a specific cluster(s) or identity on this plot? For example, I want to see correlation values in cluster 2 only.
  The usage of Feature scatter is as follows. </p>
  
  <p>FeatureScatter(
    object,
    feature1,
    feature2,
    cells = NULL,
    group.by = NULL,
    cols = NULL,
    pt.size = 1,
    shape.by = NULL,
    span = NULL,
    smooth = FALSE,
    combine = TRUE,
    slot = "data"
  )</p>
  
  <p>Do you know how to get the Pearson correlation of my two genes using Seurat? This is the best I can do.</p>
  
  <p>Thank you.</p>
  
Tags: <seurat><correlation>
Title: How to specifically select cluster on Featurescatter on Seurat?
ThreadText: # How to specifically select cluster on Featurescatter on Seurat?
  
  (Asked by: username_0 on 2020-05-20)
  
  Nowadays, I am trying to calculate Pearson correlation values between two genes of my interest from single-cell RNA-data (features.tsv, barcodes.tsv, and matrix.mtx files) which are obtained from the 10xgenomics cellranger.
  
  FYI, The filtered\_feature\_bc\_matrix includes an aggregated population of tumor-infiltrating immune cells that are derived from 6 different syngeneic mouse tumors (<https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE121861>). I downloaded fastq files and ran "cellranger count" and "cellranger aggr" commands to obtain combined data.
  
  My strategy includes the use of the "feature scatter" function deposited in the library(Seurat). Finally, I ended up getting results below.
  
  [![FeatureScatter plot](https://i.sstatic.net/0OLyF.png)](https://i.sstatic.net/0OLyF.png)
  
  My question is that can we select a specific cluster(s) or identity on this plot? For example, I want to see correlation values in cluster 2 only.
  The usage of Feature scatter is as follows.
  
  FeatureScatter(
  object,
  feature1,
  feature2,
  cells = NULL,
  group.by = NULL,
  cols = NULL,
  pt.size = 1,
  shape.by = NULL,
  span = NULL,
  smooth = FALSE,
  combine = TRUE,
  slot = "data"
  )
  
  Do you know how to get the Pearson correlation of my two genes using Seurat? This is the best I can do.
  
  Thank you.
  
  **Tags:** seurat, correlation
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-05-20. Score: 3 | Accepted answer
  
  You can use the `cells` argument to only display the data for a specific subset of cells.
  
  For example to extract the values for a cluster 2:
  
  ```
  # The cluster identity is stored in the meta.data
  # In this example there is a clustering column called "RNA_snn_res.0.7" 
  # but any metadata column can be used
  
  clust2.cells <- rownames(Seurat.data@meta.data[Seurat.data$RNA_snn_res.0.7 == 2, ])
  
  FeatureScatter(Seurat.data, feature1 = "gene_A", feature2 = "gene_B", cells = clust2.cells)
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you so much.  
  > **username_2**: You can also subset your Seurat object within the call to `FeatureScatter`, such as `FeatureScatter(subset(Seurat.data, idents = "2"), "gene_A", "gene_B")`  
  
  ---
  
  