# Help on R code to identify specific cells expressing lefty1 or lefty2

**URL:** <https://help.c-moor.org/t/help-on-r-code-to-identify-specific-cells-expressing-lefty1-or-lefty2/274>\
**Category:** Help\
**Tags:** R\
**Created:** [June 16, 2022, 9:38pm UTC](https://help.c-moor.org/t/help-on-r-code-to-identify-specific-cells-expressing-lefty1-or-lefty2/274 "2022-06-16T21:38:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yanethp](https://avatars.discourse-cdn.com/v4/letter/y/bbce88/32.png) [@yanethp](https://help.c-moor.org/u/yanethp)\
**Post date:** [June 16, 2022, 9:38pm UTC](https://help.c-moor.org/t/help-on-r-code-to-identify-specific-cells-expressing-lefty1-or-lefty2/274/1 "2022-06-16T21:38:50Z")

</div>

@mmccoy @LindsayHayes @cpozmanter  
Last semester I analyzed the gene expression of Lefty1 and Lefty2. I focused on the differential expression of each within celltypes and found that they were both expressed in the definitive endoderm and nascent mesoderm at one point during gastrulation. From there I wanted to focus on whether they were both expressed within the same cells, rather than the same cell_types_. I left off with this graph…

 ![Screen Shot 2022-06-16 at 2.28.33 PM](https://canada1.discourse-cdn.com/flex027/uploads/c_moor/original/1X/b3c2d809fafd82a72e8b625aecda5fca300c1216.jpeg)  
 ![Screen Shot 2022-06-16 at 2.32.28 PM](https://canada1.discourse-cdn.com/flex027/uploads/c_moor/original/1X/69c3d7e7e58ecedc192410dee0c77230e78672b5.jpeg)  
The dots on the y-axis are cells that only have Lefty2 and the dots on the X-axis are cells that only hold Lefty1. Everything in between are cells that have different expression levels of either gene. I’m now interested in finding a code that identifies these cells.  
I have a copy of my R notebook under the c\_moor\_ccc\_su22\_public folder.

---

<div class="post-metadata">

**Author:** ![mmccoy](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@mmccoy](https://help.c-moor.org/u/mmccoy)\
**Post date:** [June 17, 2022, 3:01pm UTC](https://help.c-moor.org/t/help-on-r-code-to-identify-specific-cells-expressing-lefty1-or-lefty2/274/2 "2022-06-17T15:01:59Z")

</div>

It’s great that you still want to keep working on this! You can filter the cells that express both Lefty1 and Lefty2. Here is one way to identify the cells:

```auto
data.df <- tibble(
    cell = sce$cell,
    geneA = logcounts(sce)[gene_A,], 
    geneB = logcounts(sce)[gene_B,]) %>% 
  filter(
    geneA > 0,
    geneB > 0)
coi <- colData(sce)$cell[colData(sce)$cell %in% data.df$cell]

```
