How to remove zero value of gene on FeatureScatter plot using Seurat? 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. I am interested in tumor-infiltrating Tregs. I downloaded fastq files from a published paper that describes tumor-infiltrating Tregs with IL10+IL35+ (https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE126184), and ran "cellranger count".

Yesterday, I learned how to get a Pearson correlation value from a kind guy. I made a graph below.


In general, Tregs are defined by CD4 and Foxp3 expression. As a trial, I want to find the correlation between two genes. The correlation value was 0.05, which might have been due to the presence of Tregs that have zero value of either CD4 or Foxp3. So, my question is that can we remove cells with 0 value of genes to get more high correlation value? My data looks like this.


&gt; Treg.data[c("Cd4", "Foxp3"), 1:30]

------------------------------------- # results

2 x 30 sparse Matrix of class "dgCMatrix"
   [[ suppressing 30 column names ‘AAACCTGAGAAACCAT-1’, ‘AAACCTGAGAAACCGC-1’, ‘AAACCTGAGAAACCTA-1’ ... ]]

Cd4   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Foxp3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .


------------------------------------- # results


Each dot represents 0 value. 

Meanwhile, I performed to standard pre-processing workflow, as suggested in Seural Tutorial. For example, 

&gt; Treg[["percent.mt"]] &lt;- PercentageFeatureSet(Treg, pattern = "^MT-")

&gt; Treg &lt;- subset(Treg, subset = nFeature_RNA &gt; 200 &amp; nFeature_RNA &lt; 2500 &amp; percent.mt &lt; 5)


Can you help me? Thank you very much.
It will not improve your correlation most likely, unless the zeros are not missing at random:

library(Seurat)
data &lt;- pbmc_small
data[["percent.mt"]] &lt;- PercentageFeatureSet(data, pattern = "^MT-")
data &lt;- NormalizeData(data)
genes &lt;-c("HLA-DRA","LYZ")
countdata = pbmc_small[["RNA"]]@data
countdata &lt;- t(as.matrix(countdata)[genes,])
plot(countdata)




Now you need to subset the matrix, and remove the rows where at least one of the entries is 0, you can use rowSums(..==0)==0, meaning no zeros in the rows:

plot(countdata[rowSums(countdata==0)==0,])




cor(countdata[rowSums(countdata==0)==0,])
          HLA-DRA       LYZ
HLA-DRA 1.0000000 0.2338371
LYZ     0.2338371 1.0000000