def datasetsBM(host=biomart_host): """ Lists BioMart datasets. :param host: address of the host server, default='http://www.ensembl.org/biomart' :returns: nothing """ stdout_ = sys.stdout #Keep track of the previous value. stream = StringIO() sys.stdout = stream server = BiomartServer(biomart_host) server.show_datasets() sys.stdout = stdout_ # restore the previous stdout. variable = stream.getvalue() v = variable.replace("{", " ") v = v.replace("}", " ") v = v.replace(": ", "\t") print(v)
#import BiomartServer from the #biomart module from biomart import BiomartServer #connect to the biomart server server = BiomartServer("http://www.biomart.org/biomart") #show all the server databases on the console server.show_databases() #show all the server datasets on the console server.show_datasets() #use the 'uniprot' dataset uniprot = server.datasets['uniprot'] #run a search with custom filters and attributes #such as searching for results with the #protein name "Dystrophin" #the UniProt accession number, #the protein name and the #gene name are give for #each search result response = uniprot.search({ 'filters': {
from biomart import BiomartServer server = BiomartServer( "http://useast.ensembl.org/biomart/martview/ec08e701a2d216b5bfcc4361a79f4156?VIRTUALSCHEMANAME=default&ATTRIBUTES=ggallus_gene_ensembl.default.feature_page.ensembl_gene_id|ggallus_gene_ensembl.default.feature_page.ensembl_transcript_id&FILTERS=&VISIBLEPANEL=mainpanel" ) print(server.show_datasets())