Created
August 20, 2018 18:11
-
-
Save daskelly/0121e4494da3fdd7e06072cb2bf05dca to your computer and use it in GitHub Desktop.
code to filter genes to find those expressed on cell surface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(tidyverse) | |
library(biomaRt) | |
genes <- # FILL ME IN ... Should be a vector of gene names | |
markers <- # FILL ME IN ... Should be a data.frame with at least one column called mgi_symbol | |
ensembl <- useMart("ensembl", dataset="mmusculus_gene_ensembl") # Mouse | |
# GO:0009986 is cell surface | |
go_cellsurf <- "GO:0009986" | |
gene.data <- getBM(attributes=c("mgi_symbol", "ensembl_gene_id", "go_id"), | |
filters="go", values=go_cellsurf, mart=ensembl) %>% | |
dplyr::filter(go_id == go_cellsurf) | |
markers_cell_surface <- dplyr::filter(markers, gene %in% gene.data$mgi_symbol) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment