gseapy/parser.py
def get_library_name(database='Human'):
    """return enrichr active enrichr library name. 
    :param str database: Select one from { 'Human', 'Mouse', 'Yeast', 'Fly', 'Fish', 'Worm' } 
    
    """

    # make a get request to get the gmt names and meta data from Enrichr

    # old code
    # response = requests.get('http://amp.pharm.mssm.edu/Enrichr/geneSetLibrary?mode=meta')
    # gmt_data = response.json()
    # # generate list of lib names
    # libs = []
    # # get library names
    # for inst_gmt in gmt_data['libraries']:
    #     # only include active gmts
    #     if inst_gmt['isActive'] == True:
    #         libs.append(inst_gmt['libraryName'])


    if database not in ['Human', 'Mouse', 'Yeast', 'Fly', 'Fish', 'Worm']:
        sys.stderr.write("""No supported database. Please input one of these:
                            'Human', 'Mouse', 'Yeast', 'Fly', 'Fish', 'Worm' """)
        return 
    if database in ['Human', 'Mouse']: database=''
    lib_url='http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics'%database
    libs_json = json.loads(requests.get(lib_url).text)
    libs = [lib['libraryName'] for lib in libs_json['statistics']]

    return sorted(libs)
def get_library_name(database='Human'):
    """return enrichr active enrichr library name. 
    :param str database: Select one from { 'Human', 'Mouse', 'Yeast', 'Fly', 'Fish', 'Worm' } 
    
    """

    # make a get request to get the gmt names and meta data from Enrichr

    # old code
    # response = requests.get('http://amp.pharm.mssm.edu/Enrichr/geneSetLibrary?mode=meta')
    # gmt_data = response.json()
    # # generate list of lib names
    # libs = []
    # # get library names
    # for inst_gmt in gmt_data['libraries']:
    #     # only include active gmts
    #     if inst_gmt['isActive'] == True:
    #         libs.append(inst_gmt['libraryName'])


    if database not in ['Human', 'Mouse', 'Yeast', 'Fly', 'Fish', 'Worm']:
        sys.stderr.write("""No supported database. Please input one of these:
                            'Human', 'Mouse', 'Yeast', 'Fly', 'Fish', 'Worm' """)
        return 
    if database in ['Human', 'Mouse']: database=''
    lib_url='http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics'%database
    libs_json = json.loads(requests.get(lib_url).text)
    libs = [lib['libraryName'] for lib in libs_json['statistics']]

    return sorted(libs)
def get_library_name ( database = 'Human' ) : # make a get request to get the gmt names and meta data from Enrichr # old code # response = requests.get('http://amp.pharm.mssm.edu/Enrichr/geneSetLibrary?mode=meta') # gmt_data = response.json() # # generate list of lib names # libs = [] # # get library names # for inst_gmt in gmt_data['libraries']: #     # only include active gmts #     if inst_gmt['isActive'] == True: #         libs.append(inst_gmt['libraryName']) if database not in [ 'Human' , 'Mouse' , 'Yeast' , 'Fly' , 'Fish' , 'Worm' ] : sys . stderr . write ( """No supported database. Please input one of these:
                            'Human', 'Mouse', 'Yeast', 'Fly', 'Fish', 'Worm' """ ) return if database in [ 'Human' , 'Mouse' ] : database = '' lib_url = 'http://amp.pharm.mssm.edu/%sEnrichr/datasetStatistics' % database libs_json = json . loads ( requests . get ( lib_url ) . text ) libs = [ lib [ 'libraryName' ] for lib in libs_json [ 'statistics' ] ] return sorted ( libs )
return enrichr active enrichr library name. 
    :param str database: Select one from { 'Human', 'Mouse', 'Yeast', 'Fly', 'Fish', 'Worm' }
return enrichr active enrichr library name . : param str database : Select one from { Human Mouse Yeast Fly Fish Worm }