Entering edit mode
9.8 years ago
sebastianzeki0
▴
240
I can't quite figure this out.
I'd like to query a list of co-ordinates using biomart to find out interesting stuff about the co-ordinates and basically play around with this new toy I've discovered and see what it can do.
However I can't figure out how to add this list of genome co-ordinates (from a Grange list) to the query.
What I have so far is
library(GenomicRanges)
BEDfile = "/Normalized_countsbed.bed"
#Load the annotation and reduce it
BED <- import.gff(BEDfile, format="BED", genome="hg19", asRangedData=F)
library("biomaRt")
#List all the databases available
listMarts()
#Select the top level database
ensembl=useMart("ensembl")
#Select the dataset from ensembl database
listDatasets(ensembl)
listDatasets(ensembl)$dataset
ensembl = useMart("ensembl",dataset="hsapiens_gene_ensembl")
filters = listFilters(ensembl)
attributes = listAttributes(ensembl)
#Perform the query using the vignette example
affyids=c("202763_at","209310_s_at","207500_at")
getBM(attributes=c('affy_hg_u133_plus_2', 'entrezgene'), filters = 'affy_hg_u133_plus_2', values = BED, mart = ensembl)
but I get the error as follows:
Error in as.vector(x, mode = "character") : no method for coercing this S4 class to a vector
What to do?
OK. That's almost there. When I run that it gives me lots of output to the console but seems to write it as an xml document e.g.
I thought the output should be a dataframe but when I do .....
I get no error, but when I try to get the output from
mylovelylist
I getSo how do I convert this xml output to a dataframe? How come it doesn't output as a dataframe by default. I tried adding
output= "data.frame"
and it just gives my theerror: (output = "data.frame")
Please don't answer to your own question like this - use the comments system instead. The XML output is because in the example I added the option verbose=T. Just remove it and the output will be less dense. Your final output list is empty because the chromosome names should not contain the word "chr" (e.g. see the chromosome_name field in the XML output). Try using