Ejemplo n.º 1
0
def list_available_genomes(provider=None):
    """
    List all available genomes.

    Parameters
    ----------
    provider : str, optional
        List genomes from specific provider. Genomes from all
        providers will be returned if not specified.

    Returns
    -------
    list with genome names
    """
    if provider:
        providers = [ProviderBase.create(provider)]
    else:
        # if provider is not specified search all providers
        providers = [
            ProviderBase.create(p) for p in ProviderBase.list_providers()
        ]

    for p in providers:
        for row in p.list_available_genomes():
            yield [p.name] + list(row)
Ejemplo n.º 2
0
def search(term, provider=None):
    """
    Search for a genome.

     If provider is specified, search only that specific provider, else
     search all providers. Both the name and description are used for the
     search. Search term is case-insensitive.

    Parameters
    ----------
    term : str
        Search term, case-insensitive.

    provider : str , optional
        Provider name

    Yields
    ------
    tuple
        genome information (name/identfier and description)
    """
    if provider:
        providers = [ProviderBase.create(provider)]
    else:
        # if provider is not specified search all providers (except direct url)
        providers = [
            ProviderBase.create(p) for p in ProviderBase.list_providers()
            if p != "url"
        ]
    for p in providers:
        for row in p.search(term):
            yield [x.encode("latin-1") for x in [p.name] + list(row)]
Ejemplo n.º 3
0
def search(term, provider=None):
    """
    Search for a genome.

     If provider is specified, search only that specific provider, else 
     search all providers. Both the name and description are used for the 
     search. Seacrch term is case-insensitive.

    Parameters
    ----------
    term : str
        Search term, case-insensitive.
    
    provider : str , optional
        Provider name

    Yields
    ------
    tuple
        genome information (name/identfier and description)
    """
    if provider:
        providers = [ProviderBase.create(provider)]
    else:
        # if provider is not specified search all providers
        providers = [ProviderBase.create(p) for 
                        p in ProviderBase.list_providers()]

    for p in providers:
        for row in p.search(term):
            yield [x.encode('latin-1') for x in [p.name] + list(row)]
Ejemplo n.º 4
0
def list_available_providers():
    """
    List all available providers.

    Returns
    -------
    list with provider names
    """
    return ProviderBase.list_providers()
Ejemplo n.º 5
0
def _online_providers():
    """Return a list of online providers as objects"""
    providers = []
    for p in ProviderBase.list_providers():
        try:
            providers.append(ProviderBase.create(p))
        except ConnectionError as e:
            sys.stderr.write(str(e))
    return providers
Ejemplo n.º 6
0
def list_available_providers():
    """
    List all available providers.

    Returns
    -------
    list with provider names
    """
    return ProviderBase.list_providers()
Ejemplo n.º 7
0
def list_available_genomes(provider=None):
    """
    List all available genomes.

    Parameters
    ----------
    provider : str, optional
        List genomes from specific provider. Genomes from all
        providers will be returned if not specified.

    Returns
    -------
    list with genome names
    """
    if provider:
        providers = [ProviderBase.create(provider)]
    else:
        # if provider is not specified search all providers
        providers = [ProviderBase.create(p) for 
                        p in ProviderBase.list_providers()]

    for p in providers:
        for row in p.list_available_genomes():
            yield [p.name] + list(row)