Converting mouse Gene IDs to Human while keeping genes that don’t convert

Hi there,

I am using bioMart to convert some gene IDs from mouse to human for some data I generated through RNA-seq. I am currently mapping using the following function:

  convertMouseGeneList <- function(x){
  require("biomaRt")
  human = useMart("ensembl", dataset = "hsapiens_gene_ensembl")
  mouse = useMart("ensembl", dataset = "mmusculus_gene_ensembl")
  genesV2 = getLDS(attributes = c("mgi_symbol"), filters = "mgi_symbol", values = x , mart = mouse, attributesL = c("hgnc_symbol"), martL = human, uniqueRows=T)
  humanx <- unique(genesV2[, 2])
  # Print the first 6 genes found to the screen
  print(head(humanx))
  return(humanx)
}

This works, but doesn’t map everything. I currently have a dataframe of 53569 genes, and I want to map as many of the mouse to human genes (I want to put this through a bulk deconvolution package that has a human dataset). So I am currently pulling out the genes from the dataframe into a list, and attempting to convert that. However, only 18411 genes are returned. I would like to replace these genes with their orthologs, but keep the other genes in that same dataframe, how would I do that here?

Alternatively, I could also create a new dataframe with only the mapped genes, but I would like to map it to the original genes so that I can retain the expression counts from the samples for the right gene that has been mapped from mouse to human. Any ideas on how I can achieve that?

Thanks!

Tom

Source link