我想转换一组基因,我可以用biomart转换它们
musGenes <- c("Hmmr", "Tlx3","STSRAAA1", "Cpeb4")
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])
return(humanx)
}
它将仅返回数据库中的那些但不显示哪些不存在。在biomart中是否有一项功能是不让它与数据重叠?例如,在这种情况下,它应该为&#34; STSRAAA1&#34;
返回空例如,所需的输出应该如下所示
Hmmr
Tlx3
-
Cpeb4
答案 0 :(得分:1)
我认为最简单的解决方案是将鼠标基因符号存储在数据框(而不是矢量)中,其名称与getLDS()
返回的列名相同。然后,您可以使用例如 merge()
加入输出。
library(biomaRt)
human <- useMart("ensembl", dataset = "hsapiens_gene_ensembl")
mouse <- useMart("ensembl", dataset = "mmusculus_gene_ensembl")
musGenes <- data.frame(MGI.symbol = c("Hmmr", "Tlx3","STSRAAA1", "Cpeb4"),
stringsAsFactors = FALSE)
genesV2 <- getLDS(attributes = c("mgi_symbol"),
filters = "mgi_symbol",
values = musGenes$MGI.symbol,
mart = mouse,
attributesL = c("hgnc_symbol"),
martL = human)
merge(musGenes, genesV2, all = TRUE)
MGI.symbol HGNC.symbol
1 Cpeb4 CPEB4
2 Hmmr HMMR
3 STSRAAA1 <NA>
4 Tlx3 TLX3