我想转换一组基因,我可以用生物技术来转换它们。
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)
}
它将只返回那些在数据库中,但不显示哪些不是。生物艺术中是否有不让数据重叠的功能?例如,在这种情况下,它应该为"STSRAAA1“返回空
例如,所需的输出应该如下所示
Hmmr
Tlx3
-
Cpeb4
发布于 2018-02-21 04:36:06
我认为最简单的解决方案是将鼠标基因符号存储在数据帧(而不是向量)中,其列名与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
https://stackoverflow.com/questions/48898031
复制相似问题