error in mapIds function
1
0
Entering edit mode
Regina • 0
@8d8c4e65
Last seen 10 months ago
India

i had to find find the gene names of each probeset given in a leukemia dataset, and used the following code:

I have installed and loaded BiocManager and BioMaRt.


# define the biomart object for the human genome
mart <- useMart(biomart = "ensembl", dataset = "hsapiens_gene_ensembl")

# read the CSV file into a data frame
dat <- read.csv("full path", header = TRUE)

# extract the probe set IDs from columns 
probes <- colnames(dat)[3:ncol(dat)]

# get the gene symbols for the probe set IDs
symbols <- unlist(mapIds(mart, probes, "hgnc_symbol", "affy_hg_u133a"))

The last command gives the error:

Error in mapIds(mart, probes, "hgnc_symbol", "affy_hg_u133a") : 
  could not find function "mapIds"

The variables mart, dat and probes have values in them, which means the corresponding commands were executed correctly.

Could anyone figure out what is the error here with the mapIds function?

mapIds biomaRt • 1.0k views
ADD COMMENT
0
Entering edit mode
Mike Smith ★ 6.6k
@mike-smith
Last seen 21 hours ago
EMBL Heidelberg

I'm not sure where this code has come from, but I think it's mixing functions from two different packages. mapIds is not found in biomaRt, but rather AnnotationDbi, so you'll need to load that library too.

Even then, mapIDs doesn't expect to use the output from useMart(), so there's more that needs to be worked on here.

Maybe this will work for your case, but it's hard to say without some real examples of the values you're working with:

symbols <- getBM(
                 mart = mart, 
                 value = probes, 
                 attributes = c("hgnc_symbol", "affy_hg_u133a"),
                 filters  = "affy_hg_u133a"
                )

That should give you a two column data.frame containing the probe IDs and the gene symbols they map to.

ADD COMMENT

Login before adding your answer.

Traffic: 449 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6