How to use the bioservices.BioMart function in bioservices

To help you get started, we’ve selected a few bioservices examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cokelaer / bioservices / test / test_biomart.py View on Github external
def biomart():
    biomart = BioMart(host='www.ensembl.org', verbose=False)
    biomart.mart_test = 'ENSEMBL_MART_ENSEMBL'
    return biomart
github cokelaer / bioservices / test / test_biomart.py View on Github external
def test_biomart_constructor():
    s = BioMart()
    try:
        s.registry()
    except:
        pass
    try:
        s.host = "dummy"
    except:
        pass
    s.host = "www.ensembl.org"
github cokelaer / bioservices / test / test_biomart.py View on Github external
def _test_reactome_example():
    # this is not working anymore...
    s = BioMart("reactome.org")
    s.lookfor("reactome")
    s.datasets("REACTOME")
    #['interaction', 'complex', 'reaction', 'pathway']
    s.new_query()
    s.add_dataset_to_xml("pathway")
    s.add_filter_to_xml("species_selection", "Homo sapiens")
    s.add_attribute_to_xml("pathway_db_id")
    s.add_attribute_to_xml("_displayname")
    xmlq = s.get_xml()
    res = s.query(xmlq)
github zqfang / GSEApy / gseapy / parser.py View on Github external
return 
    if database in ['Human', 'Mouse']: 
        database = 'Enrichr'
    else:
        database += 'Enrichr'
    lib_url='http://amp.pharm.mssm.edu/%s/datasetStatistics'%database
    response = requests.get(lib_url)
    if not response.ok:
        raise Exception("Error getting the Enrichr libraries")
    libs_json = json.loads(response.text)
    libs = [lib['libraryName'] for lib in libs_json['statistics']]

    return sorted(libs)


class Biomart(BioMart):
    """query from BioMart"""
    def __init__(self, host="www.ensembl.org", verbose=False):
        """A wrapper of BioMart() from bioseverices.

        How to query validated dataset, attributes, filters:
        example:
        >>> from gseapy.parser import Biomart 
        >>> bm = Biomart(verbose=False, host="asia.ensembl.org")
        >>> ## view validated marts
        >>> marts = bm.get_marts()
        >>> ## view validated dataset
        >>> datasets = bm.get_datasets(mart='ENSEMBL_MART_ENSEMBL')
        >>> ## view validated attributes
        >>> attrs = bm.get_attributes(dataset='hsapiens_gene_ensembl') 
        >>> ## view validated filters
        >>> filters = bm.get_filters(dataset='hsapiens_gene_ensembl')