Question: biomaRt: using a list as values. confused...
8.5 years ago by
J.delasHeras@ed.ac.uk • 1.9k
J.delasHeras@ed.ac.uk • 1.9k wrote:
I'm trying to obtain information about genes within a number of regions defined by a chromosome name, start and end coordinates. I understand that the way to specify multiple filters to be used together (a set of chr+start+end) is to use a list for 'values'. This seems to work ok when I have more than one region (I tested it using two regions first, before doing the proper search for >1000), but if I were to specify just one region, it does not work... and I'm wondering how I would do it in that case. Example: library("biomaRt") ensembl = useMart("ENSEMBL_MART_ENSEMBL", dataset="hsapiens_gene_ensembl", host="www.ensembl.org") chrom<-c("1", "2") chr.start<-c(11401198, 86460656) chr.stop<-c(11694590, 86663869) attributes<-c("hgnc_symbol", "entrezgene", "chromosome_name", "start_position", "end_position", "strand", "band") # extract both regions at once: getBM(attributes=attributes, filters=c("chromosome_name","start","end"), values=list(chrom,chr.start,chr.stop),mart=ensembl) #this works, returning 1939 rows of data, the first 1198 with chr1 #corresponding to teh first region, and the rest with chr2 to teh second. Good. #but how does one retrieve the data for just ONE region? # try this: getBM(attributes=attributes, filters=c("chromosome_name","start","end"), values=list(chrom,chr.start,chr.stop),mart=ensembl) # it only returns one gene!!! (in two rows) so, when I just want to do a single search with multiple filters, how would I specify the values? Jose -- Dr. Jose I. de las Heras Email: J.delasHeras at ed.ac.uk The Wellcome Trust Centre for Cell Biology Phone: +44 (0)131 6507090 Institute for Cell & Molecular Biology Fax: +44 (0)131 6507360 Swann Building, Mayfield Road University of Edinburgh Edinburgh EH9 3JR UK -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
ADD COMMENT • link •