1
$\begingroup$

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

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.

$\endgroup$
2
$\begingroup$

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)
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you so much. $\endgroup$ – raiora May 20 at 14:06
  • $\begingroup$ You can also subset your Seurat object within the call to FeatureScatter, such as FeatureScatter(subset(Seurat.data, idents = "2"), "gene_A", "gene_B") $\endgroup$ – Dave Ross Aug 11 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.