Answers.Body: <p>Very old question, but recently modified, which means that someone might still be looking into this.</p>
  <p>I usually prefer to use <a href="https://github.com/carmonalab/UCell" rel="nofollow noreferrer">Ucell</a> as the signatures are calculated within cells, which makes comparisons a bit easier. In addition is allows the formulation of signatures with both <code>positive</code> and <code>negative</code> genes.</p>
  <pre><code>hladr_genes &lt;- grep(pattern = '^HLA-DR', x = rownames(x = pbmc_small), value = TRUE)
  signatures_list &lt;- list(MDSCs = c(&quot;CD14+&quot;,&quot;CD33+&quot;,&quot;ITGAM+&quot;,paste0(hladr_genes,&quot;-&quot;)))
  
  &gt; signatures_list
  $MDSCs
  [1] &quot;CD14+&quot;     &quot;CD33+&quot;     &quot;ITGAM+&quot;    &quot;HLA-DRA-&quot;  &quot;HLA-DRB5-&quot; &quot;HLA-DRB1-&quot;
  
  # calculate signature
  pbmc_small &lt;- AddModuleScore_UCell(pbmc_small,signatures_list,ncores = 8,name = &quot;&quot;)
  # perform smoothing
  pbmc_small &lt;- SmoothKNN(pbmc_small, signature.names = names(signatures_list), reduction=&quot;pca&quot;)
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-13T09:11:12.080Z
Answers.LastActivityDate: 2023-12-13T09:11:12.080Z
Answers.UserDisplayName: fra
Answers.Body: <p>You need to make a transformed variable to the gene sets of interest. I would rescale the data on a range of 0-1. Then you can make a log2 ratio of the sum(set1)/sum(set2). You could explore other transformations, but this will give contrasting values for high set1 and high set2, but neutral if the expression is similar between the sets.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-15T15:09:34.233Z
Answers.Text: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
Answers.UserDisplayName: Community
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-15T14:07:57.547Z
Answers.LastActivityDate: 2023-03-15T14:07:57.547Z
Answers.UserDisplayName: user17168
Body: <p>I want to identify <code>MDSCs</code> cells which don't not express <code>HLA-DRs</code> (HLA-DR negative) but express <code>CD14</code>, <code>CD33</code>, and <code>ITGAM</code></p>
  <p>For this, I firstly plotted a feature plot to locate <code>HLA-DR</code> by</p>
  <pre><code>cd.features &lt;- list(grep(pattern = '^HLA-DR', x = rownames(x = pbmc_small), value = TRUE))
  
  pbmc_small &lt;- AddModuleScore(object = pbmc_small, features = cd.features, ctrl = 5, name = 'CDFeatures')
  
  
  FeaturePlot(object = pbmc_small, features = 'CDFeatures1')&amp; 
  +     scale_colour_gradientn(colours = rev(brewer.pal(n = 11, name = &quot;RdBu&quot;)))
  </code></pre>
  <p>Which returned</p>
  <p><a href="https://i.sstatic.net/Lg704.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Lg704.png" alt="enter image description here" /></a></p>
  <p>For <code>CD14</code>, <code>CD33</code>, and <code>ITGAM</code> I done</p>
  <pre><code>&gt; cd.features=list(c(&quot;CD14&quot;, &quot;CD33&quot;,  &quot;ITGAM&quot;))
  &gt; pbmc_small &lt;- AddModuleScore(object = pbmc_small, features = cd.features, ctrl = 5, name = 'CDFeatures')
  &gt; FeaturePlot(object = pbmc_small, features = 'CDFeatures1')&amp; 
  +     scale_colour_gradientn(colours = rev(brewer.pal(n = 11, name = &quot;RdBu&quot;)))
  
  &gt; 
  </code></pre>
  <p>Which returned</p>
  <p><a href="https://i.sstatic.net/ZweUy.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ZweUy.png" alt="enter image description here" /></a></p>
  <p>By looking at these two plots I really can not say which part of plot is HLA-DR negative but expressing <code>CD14</code>, <code>CD33</code>, and <code>ITGAM</code></p>
  <p>Do you know a way to do this?</p>
  <p>Plotting options don't help because looking at the below plots you can not say which cells are HLA negative and CD14 positive</p>
  <p><a href="https://i.sstatic.net/98EZD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/98EZD.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.sstatic.net/sA5YD.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/sA5YD.png" alt="enter image description here" /></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-16T20:07:23.477Z
Comments.Text: Will the user who flagged for this post to be closed please add a comment stating why they think this post should be closed? I don't see any problem with it.
Comments.UserDisplayName: Ram RS
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-17T03:40:10.330Z
Comments.Text: My small comment, I'd simply use ggplot2 if I was using R (not hugely helpful). It is a lot more powerful though. @RamRS point: It is a very clear question, nicely presented on a good subject. I can make a good educated guess why someone did this, but its really for meta. Closing questions is a current topic there. It is unlikely the question will be closed - its just a vote. (For the record I upvoted.)
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-17T03:40:19.367Z
Comments.Text: @haci will know this, but will have to get into cellular immunology.
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-02-17T03:47:54.133Z
Comments.Text: Thinking about it you really want a third axis and a good viewing angle. Plotly might be a better option than featurePlot. Interesting but not my thing.
Comments.UserDisplayName: M__
Tags: <r><scrnaseq><seurat>
Title: Featureplot by co-expression of some genes
ThreadText: # Featureplot by co-expression of some genes
  
  (Asked by: username_0 on 2022-02-15)
  
  I want to identify `MDSCs` cells which don't not express `HLA-DRs` (HLA-DR negative) but express `CD14`, `CD33`, and `ITGAM`
  
  For this, I firstly plotted a feature plot to locate `HLA-DR` by
  
  ```
  cd.features <- list(grep(pattern = '^HLA-DR', x = rownames(x = pbmc_small), value = TRUE))
  
  pbmc_small <- AddModuleScore(object = pbmc_small, features = cd.features, ctrl = 5, name = 'CDFeatures')
  
  FeaturePlot(object = pbmc_small, features = 'CDFeatures1')& 
  +     scale_colour_gradientn(colours = rev(brewer.pal(n = 11, name = "RdBu")))
  
  ```
  
  Which returned
  
  [![enter image description here](https://i.sstatic.net/Lg704.png)](https://i.sstatic.net/Lg704.png)
  
  For `CD14`, `CD33`, and `ITGAM` I done
  
  ```
  > cd.features=list(c("CD14", "CD33",  "ITGAM"))
  > pbmc_small <- AddModuleScore(object = pbmc_small, features = cd.features, ctrl = 5, name = 'CDFeatures')
  > FeaturePlot(object = pbmc_small, features = 'CDFeatures1')& 
  +     scale_colour_gradientn(colours = rev(brewer.pal(n = 11, name = "RdBu")))
  
  > 
  
  ```
  
  Which returned
  
  [![enter image description here](https://i.sstatic.net/ZweUy.png)](https://i.sstatic.net/ZweUy.png)
  
  By looking at these two plots I really can not say which part of plot is HLA-DR negative but expressing `CD14`, `CD33`, and `ITGAM`
  
  Do you know a way to do this?
  
  Plotting options don't help because looking at the below plots you can not say which cells are HLA negative and CD14 positive
  
  [![enter image description here](https://i.sstatic.net/98EZD.png)](https://i.sstatic.net/98EZD.png)
  
  [![enter image description here](https://i.sstatic.net/sA5YD.png)](https://i.sstatic.net/sA5YD.png)
  
  **Tags:** r, scrnaseq, seurat
  
  > **Comments:**
  > **username_1**: Will the user who flagged for this post to be closed please add a comment stating why they think this post should be closed? I don't see any problem with it.  
  > **username_2**: My small comment, I'd simply use ggplot2 if I was using R (not hugely helpful). It is a lot more powerful though. @username_1 point: It is a very clear question, nicely presented on a good subject. I can make a good educated guess why someone did this, but its really for meta. Closing questions is a current topic there. It is unlikely the question will be closed - its just a vote. (For the record I upvoted.)  
  > **username_2**: @haci will know this, but will have to get into cellular immunology.  
  > **username_2**: Thinking about it you really want a third axis and a good viewing angle. Plotly might be a better option than featurePlot. Interesting but not my thing.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2023-12-13. Score: 2
  
  Very old question, but recently modified, which means that someone might still be looking into this.
  
  I usually prefer to use [Ucell](https://github.com/carmonalab/UCell) as the signatures are calculated within cells, which makes comparisons a bit easier. In addition is allows the formulation of signatures with both `positive` and `negative` genes.
  
  ```
  hladr_genes <- grep(pattern = '^HLA-DR', x = rownames(x = pbmc_small), value = TRUE)
  signatures_list <- list(MDSCs = c("CD14+","CD33+","ITGAM+",paste0(hladr_genes,"-")))
  
  > signatures_list
  $MDSCs
  [1] "CD14+"     "CD33+"     "ITGAM+"    "HLA-DRA-"  "HLA-DRB5-" "HLA-DRB1-"
  
  # calculate signature
  pbmc_small <- AddModuleScore_UCell(pbmc_small,signatures_list,ncores = 8,name = "")
  # perform smoothing
  pbmc_small <- SmoothKNN(pbmc_small, signature.names = names(signatures_list), reduction="pca")
  
  ```
  
  
  ---
  
  ### Answer by username_4 on 2023-03-15. Score: 1
  
  You need to make a transformed variable to the gene sets of interest. I would rescale the data on a range of 0-1. Then you can make a log2 ratio of the sum(set1)/sum(set2). You could explore other transformations, but this will give contrasting values for high set1 and high set2, but neutral if the expression is similar between the sets.
  
  > **Comments:**
  > **username_5**: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).  
  
  ---
  
  