API documentation for interacting with the Galaxy Toolshed — BioBlend 0.5.4-dev documentation

# API documentation for interacting with the Galaxy Toolshed

## ToolShedInstance

class `bioblend.toolshed.` `ToolShedInstance`(url, key='', email=None, password=None)

  A base representation of an instance of ToolShed, identified by a URL and a user’s API key.

  After you have created an `ToolShed` object, access various modules via the class fields (see the source for the most up-to-date list): `repositories` are the minimum set supported. For example, to work with a repositories, and get a list of all the public repositories, the following should be done:

      from bioblend import toolshed

      ts = toolshed.ToolShedInstance(url='http://testtoolshed.g2.bx.psu.edu')

      rl = ts.repositories.get_repositories()

  Parameters: | url (string) – A FQDN or IP for a given instance of ToolShed. For example: http://testtoolshed.g2.bx.psu.edu key (string) – If required, user’s API key for the given instance of ToolShed, obtained from the user preferences.

  `__init__`(url, key='', email=None, password=None)

    A base representation of an instance of ToolShed, identified by a URL and a user’s API key.

    After you have created an `ToolShed` object, access various modules via the class fields (see the source for the most up-to-date list): `repositories` are the minimum set supported. For example, to work with a repositories, and get a list of all the public repositories, the following should be done:

        from bioblend import toolshed

        ts = toolshed.ToolShedInstance(url='http://testtoolshed.g2.bx.psu.edu')

        rl = ts.repositories.get_repositories()

    Parameters: | url (string) – A FQDN or IP for a given instance of ToolShed. For example: http://testtoolshed.g2.bx.psu.edu key (string) – If required, user’s API key for the given instance of ToolShed, obtained from the user preferences.

## Repositories

Interaction with a Tool Shed instance

class `bioblend.toolshed.repositories.` `ToolShedClient`(toolshed_instance)
  `create_repository`(name, synopsis, description=None, type='unrestricted', remote_repository_url=None, homepage_url=None, category_ids=None)

    Create a new repository in a Tool Shed

    Parameters: | name (str) – Name of the repository synopsis (str) – Synopsis of the repository description (str) – Optional description of the repository type (str) – type of the repository. One of “unrestricted”, “repository_suite_definition”, or “tool_dependency_definition” remote_repository_url (str) – Remote URL (e.g. github/bitbucket repository) homepage_url (str) – Upstream’s homepage for the project. category_ids (list) – List of encoded category IDs
    Return type: | dict
    Returns: | a dictionary containing information about the new repository. For example:
        {
            "deleted": false,
            "deprecated": false,
            "description": "new_synopsis",
            "homepage_url": "https://github.com/galaxyproject/",
            "id": "8cf91205f2f737f4",
            "long_description": "this is some repository",
            "model_class": "Repository",
            "name": "new_repo_17",
            "owner": "qqqqqq",
            "private": false,
            "remote_repository_url": "https://github.com/galaxyproject/tools-devteam",
            "times_downloaded": 0,
            "type": "unrestricted",
            "user_id": "adb5f5c93f827949"
        }

  `get_categories`()

    Returns a list of dictionaries that contain descriptions of the repository categories found on the given Tool Shed instance.

    Return type: | list
    Returns: | A list of dictionaries containing information about repository categories present in the Tool Shed. For example:
        [{u'deleted': False,
          u'description': u'Tools for manipulating data',
          u'id': u'175812cd7caaf439',
          u'model_class': u'Category',
          u'name': u'Text Manipulation',
          u'url': u'/api/categories/175812cd7caaf439'},]

    New in version 0.5.2.

  `get_ordered_installable_revisions`(name, owner)

    Returns the ordered list of changeset revision hash strings that are associated with installable revisions. As in the changelog, the list is ordered oldest to newest.

    Parameters: | name (string) – the name of the repository owner (string) – the owner of the repository
    Return type: | list
    Returns: | List of changeset revision hash string from oldest to newest

  `get_repositories`()

    Get a list of all the repositories in a Galaxy Tool Shed

    Return type: | list
    Returns: | Returns a list of dictionaries containing information about repositories present in the Tool Shed. For example:
        [{u'times_downloaded': 0, u'user_id': u'5cefd48bc04af6d4',
        u'description': u'Order Contigs', u'deleted': False,
        u'deprecated': False, u'private': False,
        u'url': u'/api/repositories/287bd69f724b99ce',
        u'owner': u'billybob', u'id': u'287bd69f724b99ce',
        u'name': u'best_tool_ever'}]

    Changed in version 0.4.1: Changed method name from `get_tools` to `get_repositories` to better align with the Tool Shed concepts

  `get_repository_revision_install_info`(name, owner, changeset_revision)

    Return a list of dictionaries of metadata about a certain changeset revision for a single tool.

    Parameters: | name (string) – the name of the repository owner (string) – the owner of the repository changeset_revision (string) – the changset_revision of the RepositoryMetadata object associated with the repository
    Return type: | List of dictionaries
    Returns: | Returns a list of the following dictionaries: a dictionary defining the repository a dictionary defining the repository revision (RepositoryMetadata) a dictionary including the additional information required to install the repository For example:
        [{u'times_downloaded': 269, u'user_id': u'1de29d50c3c44272', u'description': u'Galaxy Freebayes Bayesian genetic variant detector tool', u'deleted': False, u'deprecated': False, u'private': False, u'long_description': u'Galaxy Freebayes Bayesian genetic variant detector tool originally included in the Galaxy code distribution but migrated to the tool shed.', u'url': u'/api/repositories/491b7a3fddf9366f', u'owner': u'devteam', u'id': u'491b7a3fddf9366f', u'name': u'freebayes'},
        {u'repository_id': u'491b7a3fddf9366f', u'has_repository_dependencies': False, u'includes_tools_for_display_in_tool_panel': True, u'url': u'/api/repository_revisions/504be8aaa652c154', u'malicious': False, u'includes_workflows': False, u'downloadable': True, u'includes_tools': True, u'changeset_revision': u'd291dc763c4c', u'id': u'504be8aaa652c154', u'includes_tool_dependencies': True, u'includes_datatypes': False}, {u'freebayes': [u'Galaxy Freebayes Bayesian genetic variant detector tool', u'http://takadonet@toolshed.g2.bx.psu.edu/repos/devteam/freebayes', u'd291dc763c4c', u'9', u'devteam', {},
        {u'freebayes/0.9.6_9608597d12e127c847ae03aa03440ab63992fedf': {u'repository_name': u'freebayes', u'name': u'freebayes', u'readme': u'FreeBayes requires g++ and the standard C and C++ development libraries. Additionally, cmake is required for building the BamTools API.', u'version': u'0.9.6_9608597d12e127c847ae03aa03440ab63992fedf', u'repository_owner': u'devteam', u'changeset_revision': u'd291dc763c4c', u'type': u'package'}, u'samtools/0.1.18': {u'repository_name': u'freebayes', u'name': u'samtools', u'readme': u'Compiling SAMtools requires the ncurses and zlib development libraries.', u'version': u'0.1.18', u'repository_owner': u'devteam', u'changeset_revision': u'd291dc763c4c', u'type': u'package'}}]}]

  `repository_revisions`(downloadable=None, malicious=None, tools_functionally_correct=None, missing_test_components=None, do_not_test=None, includes_tools=None, test_install_error=None, skip_tool_test=None)

    Returns a (possibly filtered) list of dictionaries that include information about all repository revisions. The following parameters can be used to filter the list.

    Parameters: | downloadable (Boolean) – Can the tool be downloaded malicious (Boolean) – tools_functionally_correct (Boolean) – missing_test_components (Boolean) – do_not_test (Boolean) – includes_tools (Boolean) – test_install_error (Boolean) – skip_tool_test (Boolean) –
    Return type: | List of dictionaries
    Returns: | Returns a (possibly filtered) list of dictionaries that include information about all repository revisions. For example:
        [{u'repository_id': u'78f2604ff5e65707', u'has_repository_dependencies': False, u'includes_tools_for_display_in_tool_panel': True, u'url': u'/api/repository_revisions/92250afff777a169', u'malicious': False, u'includes_workflows': False, u'downloadable': True, u'includes_tools': True, u'changeset_revision': u'6e26c5a48e9a', u'id': u'92250afff777a169', u'includes_tool_dependencies': False, u'includes_datatypes': False},
        {u'repository_id': u'f9662009da7bfce0', u'has_repository_dependencies': False, u'includes_tools_for_display_in_tool_panel': True, u'url': u'/api/repository_revisions/d3823c748ae2205d', u'malicious': False, u'includes_workflows': False, u'downloadable': True, u'includes_tools': True, u'changeset_revision': u'15a54fa11ad7', u'id': u'd3823c748ae2205d', u'includes_tool_dependencies': False, u'includes_datatypes': False}]

  `show_repository`(toolShed_id)

    Display information of a repository from Tool Shed

    Parameters: | toolShed_id (string) – Encoded toolShed ID
    Return type: | dictionary
    Returns: | Information about the tool For example:
        {{u'times_downloaded': 0, u'user_id': u'5cefd48bc04af6d4',
        u'description': u'Order Contigs', u'deleted': False,
        u'deprecated': False, u'private': False,
        u'url': u'/api/repositories/287bd69f724b99ce',
        u'owner': u'billybob', u'id': u'287bd69f724b99ce',
        u'name': u'best_tool_ever'}

    Changed in version 0.4.1: Changed method name from `show_tool` to `show_repository` to better align with the Tool Shed concepts

  `show_repository_revision`(metadata_id)

    Returns a dictionary that includes information about a specified repository revision.

    Parameters: | metadata_id (string) – Encoded repository metadata ID
    Return type: | dictionary
    Returns: | Returns a dictionary that includes information about a specified repository revision. For example:
        {u'repository_id': u'491b7a3fddf9366f',
         u'has_repository_dependencies': False,
         u'includes_tools_for_display_in_tool_panel': True,
         u'test_install_error': False,
         u'url': u'/api/repository_revisions/504be8aaa652c154',
         u'malicious': False,
         u'includes_workflows': False,
         u'id': u'504be8aaa652c154',
         u'do_not_test': False,
         u'downloadable': True,
         u'includes_tools': True,
         u'tool_test_results': {u'missing_test_components': [],,
         u'includes_datatypes': False}

  `update_repository`(id, tar_ball_path, commit_message=None)

    Update the contents of a tool shed repository with specified tar ball.

    Parameters: | id (string) – Encoded repository ID tar_ball_path (string) – Path to file containing tar ball to upload. commit_message (string) – Commit message used for underlying mercurial repository backing tool shed repository.
    Return type: | dict
    Returns: | Returns a dictionary that includes repository content warnings. Most valid uploads will result in no such warning and an exception will be raised generally if there are problems. For example a successful upload will look like:
        {u'content_alert': u'', u'message': u''}

    New in version 0.5.2.