Skip to content

Commit

Permalink
Adjust to load mouse_gene from file instead of biomaRt
Browse files Browse the repository at this point in the history
  • Loading branch information
nimarafati committed Mar 7, 2024
1 parent dab94f7 commit 4256a34
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lab_eda.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,18 @@ metadata <- read.csv("data/metadata_raw.csv",header=TRUE,stringsAsFactors=TRUE,r

A useful step is to convert ENSEMBL gene/transcript IDs into meaningful gene names. This can be done in many way using a gtf file or using the `biomaRt` function in R.

```{r}
download_data("data/mouse_genes.txt")
If the `biomaRt` did not work run the next chunk.
```{r biomart-download, echo = T, eval=FALSE}
mouse <- biomaRt::useMart(biomart="ensembl", dataset="mmusculus_gene_ensembl")
annot <- biomaRt::getBM(attributes = c("ensembl_gene_id","external_gene_name"),mart = mouse,useCache=FALSE)
gene_names <- as.character ( annot[match(rownames(data),annot[,"ensembl_gene_id"]),"external_gene_name"] )
gene_names[is.na(gene_names) ] <- ""
```


```{r}
download_data("data/mouse_genes.txt")
annot <- read.table('data/mouse_genes.txt', header = T, sep = '\t', fill = T, quote = '"')
gene_names <- as.character ( annot[match(rownames(data),annot[,"ensembl_gene_id"]),"external_gene_name"] )
gene_names[is.na(gene_names) ] <- ""
```
Expand Down

0 comments on commit 4256a34

Please sign in to comment.