[BioC] Help using biomaRt

john seers (IFR) john.seers at bbsrc.ac.uk
Mon Jan 26 14:08:14 CET 2009


Hi All

And thanks to all those that have helped.

My biomart query is now working fine and I can get what I want with two
queries, the second query using a different filter. 

But I still feel I built my query by trial and error rather than in an
intelligent way. I have used Steffen's suggestion to use listAttributes
to understand the attributes grouping/category but that does not seem to
help me much. 


So the question is how could I have avoided blundering into this error:

#1 Query ERROR: caught BioMart::Exception::Usage: Attributes from
multiple attribute pages are not allowed 


Here is an example of me going wrong:

library(biomaRt)


# Connect to the mart
mart<-useMart("ensembl")
# Update the mart connection to use this dataset
mart<-useDataset("mmusculus_gene_ensembl", mart=mart)

# Just select a couple of affyids for testing
affyids<-c("5325539", "5555964")


# Build vector of filters
filtnames<-"affy_moex_1_0_st_v1"
# Build vector of attributes
attnames<-c("affy_moex_1_0_st_v1", "ensembl_gene_id",
"canonical_transcript_stable_id")
# Submit biomart query
results1<-getBM(attnames, filters=filtnames, values=affyids, mart=mart)

# Great, that works. 
# But I would like to get some exon information as well
# Thinks - how?
# Check the attributes categories/groups:
#listAttributes(mart, showGroups = TRUE)[c(9, 17, 28, 30, 678, 682),]
#                              name                       description
group   category
#9              affy_moex_1_0_st_v1                         Affy MoEx
EXTERNAL:   Features
#17  canonical_transcript_stable_id Canonical transcript stable ID(s)
GENE:   Features
#28                 ensembl_gene_id                   Ensembl Gene ID
GENE:   Features
#30           ensembl_transcript_id             Ensembl Transcript ID
GENE:   Features
#678                ensembl_exon_id                   Ensembl Exon ID
EXON: Structures
#682                           rank           Exon Rank in Transcript
EXON: Structures

# Oh dear. Looks like exon information is in EXON: Structures
# I guess that will not work ...
# But I do not know what I am doing, so try adding exon rank anyway.

# Build vector of attributes
attnames<-c("affy_moex_1_0_st_v1", "ensembl_gene_id",
"canonical_transcript_stable_id", "rank")
# Submit biomart query
results2<-getBM(attnames, filters=filtnames, values=affyids, mart=mart)

# Great, that works! So add the exon id attribute. 

# Build vector of attributes
attnames<-c("affy_moex_1_0_st_v1", "ensembl_gene_id",
"canonical_transcript_stable_id", "rank", "ensembl_exon_id")
# Submit biomart query
results3<-getBM(attnames, filters=filtnames, values=affyids, mart=mart)

# Fails ....
# 
#
V1
#1 Query ERROR: caught BioMart::Exception::Usage: Attributes from
multiple attribute pages are not allowed
#Error in getBM(attnames, filters = filtnames, values = affyids, mart =
mart) : 
#  Number of columns in the query result doesn't equal number of
attributes in query.  This is probably an internal error, please report.



# Disconnect from biomart
martDisconnect(mart)

########################################################################
##############################################





########################################################################
#########################################

> sessionInfo()
R version 2.8.1 (2008-12-22) 
i386-pc-mingw32 

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
Kingdom.1252;LC_MONETARY=English_United
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base


other attached packages:
[1] biomaRt_1.16.0 RWinEdt_1.8-0 

loaded via a namespace (and not attached):
[1] RCurl_0.94-0 XML_1.99-0  
>


---



More information about the Bioconductor mailing list