我正在尝试使用 bioconductor 的 getBM() 函数来检索某些基因的序列。这是我的脚本:
setwd(".")
options(stringsAsFactors = FALSE)
cat("\014")
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
listOfBiocPackages <- c("annotate", "GEOquery", "biomaRt")
bioCpackagesNotInstalled <- which( !listOfBiocPackages %in% rownames(installed.packages()) )
cat("package missing listOfBiocPackages[", bioCpackagesNotInstalled, "]: ", listOfBiocPackages[bioCpackagesNotInstalled], "\n", sep="")
# check there's still something left to install
if( length(bioCpackagesNotInstalled) ) {
BiocManager::install(listOfBiocPackages[bioCpackagesNotInstalled])
}
library("easypackages")
libraries(listOfBiocPackages)
mart <- useMart("ENSEMBL_MART_ENSEMBL")
mart <- useDataset("hsapiens_gene_ensembl", mart)
thisAnnotLookup <- getBM(mart=mart, attributes=c("affy_hg_u133a", "ensembl_gene_id", "gene_biotype", "external_gene_name", "gene_flank"), filter=c("affy_hg_u133a", "upstream_flank"), values=list(affyid=c("203423_at", "204088_at", "204511_at", "204911_s_at", "205234_at")), uniqueRows=TRUE, checkFilters=FALSE)
print(thisAnnotLookup)
这个脚本给了我以下错误:
'names' attribute [2] must be the same length as the vector [1]
我无法理解。
谁能帮我解决这个问题?谢谢!