error while using plant ensembl biomart
2
0
Entering edit mode
6.4 years ago
Medhat 9.7k

Hi, I am trying to extract gene ontology term from plant ensembl biomart using the following code:

from pybiomart import Server
server = Server(host='http://plants.ensembl.org')
#print server.list_marts() # available marts



mart = server['plants_mart'] # connecting   plants_mart 
  #print mart.list_datasets() # print available datasets

dataset = mart['zmays_eg_gene']

print dataset.query(attributes=['go'], filters={"transcript_id": ['Zm00001d000475_T001']})

but I have this error:

pybiomart.base.BiomartException: Query ERROR: caught BioMart::Exception::Usage: WITHIN Virtual Schema : default, Dataset zmays_eg_gene NOT FOUND

even though 'zmays_eg_gene was listed in mart.list_datasets()

software error gene ensembl biomart • 2.9k views
ADD COMMENT
2
Entering edit mode
6.4 years ago
Fabio Marroni ★ 3.0k

Hi, I don't know what's going on there, but you can install the bioconductor package biomaRt and then run the following commands.

library(biomaRt)
host="plants.ensembl.org"
mysets<-listDatasets(useMart("plants_mart", host = host))
myusemart <- useDataset("zmays_eg_gene", mart = useMart("plants_mart", host = host))
resultTable <- getBM(attributes=c("ensembl_gene_id","chromosome_name","start_position","end_position","go_id","goslim_goa_accession"), mart = myusemart)

The attributes of getBM can be changed (I usually get go and goslim), and then you can just use the write.table function to save the file if you want to get rid of R and work back in python.

ADD COMMENT
0
Entering edit mode

Thanks a lot, worked perfectly with no complications:

library(biomaRt)
host="plants.ensembl.org"
mysets<-listDatasets(useMart("plants_mart", host = host))
myusemart <- useDataset("zmays_eg_gene", mart = useMart("plants_mart", host = host))
resultTable <- getBM(attributes=c("go_id", "ensembl_gene_id"), mart = myusemart, filters = "ensembl_gene_id", values = c("Zm00001d002426"), uniqueRows=F)

#  to get more info about available attributes and filters
listFilters(mart = myusemart, what = c("name", "description"))
listAttributes(myusemart)

Thanks

ADD REPLY
0
Entering edit mode
2.7 years ago

In pybiomart even though you give the host as ''plants.ensembl.org'' the virtual schema is set to default. that's the reason why you can find any ''zmays_eg_gene". I'm not sure whether you can change the virtual schema in pybiomart but you can do the same using bioservices package in python

from bioservices import BioMart as biomart 
s = biomart('plants.ensembl.org')
services = [x for x in s.registry()]
pd.DataFrame(services)
dataset = 'zmays_eg_gene'
filt = 'transcript_id'
s.new_query()
s.add_dataset_to_xml(dataset)
s.add_filter_to_xml(filt, value = 'Zm00001d000475_T001')
s.add_attribute_to_xml('go')
xmlq = s.get_xml()
print(xmlq)
xmlq = xmlq.replace('virtualSchemaName = "default"',\
    'virtualSchemaName = "plants_mart"')
print(xmlq)
res = s.query(xmlq)
print(res)
ADD COMMENT

Login before adding your answer.

Traffic: 2234 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