API documentation for interacting with the Galaxy Toolshed

ToolShedInstance

class bioblend.toolshed.ToolShedInstance(url, key=None, email=None, password=None, verify=True)[source]

A base representation of a connection to a ToolShed instance, identified by the ToolShed URL and user credentials.

After you have created a ToolShedInstance object, access various modules via the class fields. For example, to work with repositories and get a list of all public repositories, the following should be done:

from bioblend import toolshed

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

rl = ts.repositories.get_repositories()

tools = ts.tools.search_tools('fastq')
Parameters:
  • url (str) – A FQDN or IP for a given instance of ToolShed. For example: https://testtoolshed.g2.bx.psu.edu . If a ToolShed instance is served under a prefix (e.g. http://127.0.0.1:8080/toolshed/), supply the entire URL including the prefix (note that the prefix must end with a slash).
  • key (str) – If required, user’s API key for the given instance of ToolShed, obtained from the user preferences.
  • email (str) – ToolShed e-mail address corresponding to the user. Ignored if key is supplied directly.
  • password (str) – Password of ToolShed account corresponding to the above e-mail address. Ignored if key is supplied directly.
  • verify (boolean) – Whether to verify the server’s TLS certificate
__init__(url, key=None, email=None, password=None, verify=True)[source]

A base representation of a connection to a ToolShed instance, identified by the ToolShed URL and user credentials.

After you have created a ToolShedInstance object, access various modules via the class fields. For example, to work with repositories and get a list of all public repositories, the following should be done:

from bioblend import toolshed

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

rl = ts.repositories.get_repositories()

tools = ts.tools.search_tools('fastq')
Parameters:
  • url (str) – A FQDN or IP for a given instance of ToolShed. For example: https://testtoolshed.g2.bx.psu.edu . If a ToolShed instance is served under a prefix (e.g. http://127.0.0.1:8080/toolshed/), supply the entire URL including the prefix (note that the prefix must end with a slash).
  • key (str) – If required, user’s API key for the given instance of ToolShed, obtained from the user preferences.
  • email (str) – ToolShed e-mail address corresponding to the user. Ignored if key is supplied directly.
  • password (str) – Password of ToolShed account corresponding to the above e-mail address. Ignored if key is supplied directly.
  • verify (boolean) – Whether to verify the server’s TLS certificate

Categories

Interaction with a Tool Shed instance categories

class bioblend.toolshed.categories.ToolShedCategoryClient(toolshed_instance)[source]
get_categories(deleted=False)[source]

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

Parameters:deleted (bool) – whether to show deleted categories
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.

show_category(category_id)[source]

Get details of a given category.

Parameters:category_id (str) – Encoded category ID
Return type:dict
Returns:details of the given category

Repositories

Interaction with a Tool Shed instance repositories

class bioblend.toolshed.repositories.ToolShedRepositoryClient(toolshed_instance)[source]
create_repository(name, synopsis, description=None, type='unrestricted', remote_repository_url=None, homepage_url=None, category_ids=None)[source]

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_ordered_installable_revisions(name, owner)[source]

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 (str) – the name of the repository
  • owner (str) – the owner of the repository
Return type:

list

Returns:

List of changeset revision hash strings from oldest to newest

get_repositories()[source]

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'category_ids': [u'c1df3132f6334b0e', u'f6d7b0037d901d9b'],
  u'deleted': False,
  u'deprecated': False,
  u'description': u'Order Contigs',
  u'homepage_url': u'',
  u'id': u'287bd69f724b99ce',
  u'name': u'best_tool_ever',
  u'owner': u'billybob',
  u'private': False,
  u'remote_repository_url': u'',
  u'times_downloaded': 0,
  u'type': u'unrestricted',
  u'url': u'/api/repositories/287bd69f724b99ce',
  u'user_id': u'5cefd48bc04af6d4'}]

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)[source]

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

Parameters:
  • name (str) – the name of the repository
  • owner (str) – the owner of the repository
  • changeset_revision (str) – the changeset_revision of the RepositoryMetadata object associated with the repository
Return type:

List of dictionaries

Returns:

Returns a list of the following dictionaries:

  1. a dictionary defining the repository
  2. a dictionary defining the repository revision (RepositoryMetadata)
  3. a dictionary including the additional information required to install the repository

For example:

[{u'deleted': False,
  u'deprecated': False,
  u'description': u'Galaxy Freebayes Bayesian genetic variant detector tool',
  u'homepage_url': u'',
  u'id': u'491b7a3fddf9366f',
  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'name': u'freebayes',
  u'owner': u'devteam',
  u'private': False,
  u'remote_repository_url': u'',
  u'times_downloaded': 269,
  u'type': u'unrestricted',
  u'url': u'/api/repositories/491b7a3fddf9366f',
  u'user_id': u'1de29d50c3c44272'},
 {u'changeset_revision': u'd291dc763c4c',
  u'do_not_test': False,
  u'downloadable': True,
  u'has_repository_dependencies': False,
  u'id': u'504be8aaa652c154',
  u'includes_datatypes': False,
  u'includes_tool_dependencies': True,
  u'includes_tools': True,
  u'includes_tools_for_display_in_tool_panel': True,
  u'includes_workflows': False,
  u'malicious': False,
  u'repository_id': u'491b7a3fddf9366f',
  u'url': u'/api/repository_revisions/504be8aaa652c154'},
 {u'freebayes': [u'Galaxy Freebayes Bayesian genetic variant detector tool',
   u'http://testtoolshed.g2.bx.psu.edu/repos/devteam/freebayes',
   u'd291dc763c4c',
   u'9',
   u'devteam',
   {},
   {u'freebayes/0.9.6_9608597d12e127c847ae03aa03440ab63992fedf': {u'changeset_revision': u'd291dc763c4c',
     u'name': u'freebayes',
     u'repository_name': u'freebayes',
     u'repository_owner': u'devteam',
     u'type': u'package',
     u'version': u'0.9.6_9608597d12e127c847ae03aa03440ab63992fedf'},
    u'samtools/0.1.18': {u'changeset_revision': u'd291dc763c4c',
     u'name': u'samtools',
     u'repository_name': u'freebayes',
     u'repository_owner': u'devteam',
     u'type': u'package',
     u'version': u'0.1.18'}}]}]

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)[source]

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 (bool) – Can the tool be downloaded
  • malicious (bool) –
  • tools_functionally_correct (bool) –
  • missing_test_components (bool) –
  • do_not_test (bool) –
  • includes_tools (bool) –
  • test_install_error (bool) –
  • skip_tool_test (bool) –
Return type:

List of dictionaries

Returns:

Returns a (possibly filtered) list of dictionaries that include information about all repository revisions. For example:

[{u'changeset_revision': u'6e26c5a48e9a',
  u'do_not_test': False,
  u'downloadable': True,
  u'has_repository_dependencies': False,
  u'id': u'92250afff777a169',
  u'includes_datatypes': False,
  u'includes_tool_dependencies': False,
  u'includes_tools': True,
  u'includes_tools_for_display_in_tool_panel': True,
  u'includes_workflows': False,
  u'malicious': False,
  u'missing_test_components': False,
  u'repository_id': u'78f2604ff5e65707',
  u'test_install_error': False,
  u'time_last_tested': None,
  u'tools_functionally_correct': False,
  u'url': u'/api/repository_revisions/92250afff777a169'},
 {u'changeset_revision': u'15a54fa11ad7',
  u'do_not_test': False,
  u'downloadable': True,
  u'has_repository_dependencies': False,
  u'id': u'd3823c748ae2205d',
  u'includes_datatypes': False,
  u'includes_tool_dependencies': False,
  u'includes_tools': True,
  u'includes_tools_for_display_in_tool_panel': True,
  u'includes_workflows': False,
  u'malicious': False,
  u'missing_test_components': False,
  u'repository_id': u'f9662009da7bfce0',
  u'test_install_error': False,
  u'time_last_tested': None,
  u'tools_functionally_correct': False,
  u'url': u'/api/repository_revisions/d3823c748ae2205d'}]

search_repositories(q, page=1, page_size=10)[source]

Search for repositories in a Galaxy Tool Shed.

Parameters:
  • q (str) – query string for searching purposes
  • page (int) – page requested
  • page_size (int) – page size requested
Return type:

dict

Returns:

dictionary containing search hits as well as metadata for the search. For example:

{u'hits': [{u'matched_terms': [],
   u'repository': {u'approved': u'no',
    u'description': u'Convert export file to fastq',
    u'full_last_updated': u'2015-01-18 09:48 AM',
    u'homepage_url': u'',
    u'id': u'bdfa208f0cf6504e',
    u'last_updated': u'less than a year',
    u'long_description': u'This is a simple too to convert Solexas Export files to FASTQ files.',
    u'name': u'export_to_fastq',
    u'remote_repository_url': u'',
    u'repo_owner_username': u'louise',
    u'times_downloaded': 164},
   u'score': 4.92},
  {u'matched_terms': [],
   u'repository': {u'approved': u'no',
    u'description': u'Convert BAM file to fastq',
    u'full_last_updated': u'2015-04-07 11:57 AM',
    u'homepage_url': u'',
    u'id': u'175812cd7caaf439',
    u'last_updated': u'less than a month',
    u'long_description': u'Use Picards SamToFastq to convert a BAM file to fastq. Useful for storing reads as BAM in Galaxy and converting to fastq when needed for analysis.',
    u'name': u'bam_to_fastq',
    u'remote_repository_url': u'',
    u'repo_owner_username': u'brad-chapman',
    u'times_downloaded': 138},
   u'score': 4.14}],
 u'hostname': u'https://testtoolshed.g2.bx.psu.edu/',
 u'page': u'1',
 u'page_size': u'2',
 u'total_results': u'64'}

show_repository(toolShed_id)[source]

Display information of a repository from Tool Shed

Parameters:toolShed_id (str) – Encoded Tool Shed ID
Return type:dict
Returns:Information about the tool. For example:
{u'category_ids': [u'c1df3132f6334b0e', u'f6d7b0037d901d9b'],
 u'deleted': False,
 u'deprecated': False,
 u'description': u'Order Contigs',
 u'homepage_url': u'',
 u'id': u'287bd69f724b99ce',
 u'long_description': u'',
 u'name': u'best_tool_ever',
 u'owner': u'billybob',
 u'private': False,
 u'remote_repository_url': u'',
 u'times_downloaded': 0,
 u'type': u'unrestricted',
 u'url': u'/api/repositories/287bd69f724b99ce',
 u'user_id': u'5cefd48bc04af6d4'}

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)[source]

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

Parameters:metadata_id (str) – Encoded repository metadata ID
Return type:dict
Returns:Returns a dictionary that includes information about a specified repository revision. For example:
{u'changeset_revision': u'7602de1e7f32',
 u'do_not_test': False,
 u'downloadable': True,
 u'has_repository_dependencies': False,
 u'id': u'504be8aaa652c154',
 u'includes_datatypes': False,
 u'includes_tool_dependencies': False,
 u'includes_tools': True,
 u'includes_tools_for_display_in_tool_panel': True,
 u'includes_workflows': False,
 u'malicious': False,
 u'missing_test_components': True,
 u'repository_id': u'491b7a3fddf9366f',
 u'test_install_error': False,
 u'time_last_tested': None,
 u'tool_test_results': {u'missing_test_components': []},
 u'tools_functionally_correct': False,
 u'url': u'/api/repository_revisions/504be8aaa652c154'}
update_repository(id, tar_ball_path, commit_message=None)[source]

Update the contents of a Tool Shed repository with specified tar ball.

Parameters:
  • id (str) – Encoded repository ID
  • tar_ball_path (str) – Path to file containing tar ball to upload.
  • commit_message (str) – Commit message used for the 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.

Tools

Interaction with a Tool Shed instance tools

class bioblend.toolshed.tools.ToolShedToolClient(toolshed_instance)[source]
search_tools(q, page=1, page_size=10)[source]

Search for tools in a Galaxy Tool Shed.

Parameters:
  • q (str) – query string for searching purposes
  • page (int) – page requested
  • page_size (int) – page size requested
Return type:

dict

Returns:

dictionary containing search hits as well as metadata for the search. For example:

{u'hits': [{u'matched_terms': [],
   u'score': 3.0,
   u'tool': {u'description': u'convert between various FASTQ quality formats',
    u'id': u'69819b84d55f521efda001e0926e7233',
    u'name': u'FASTQ Groomer',
    u'repo_name': None,
    u'repo_owner_username': u'devteam'}},
  {u'matched_terms': [],
   u'score': 3.0,
   u'tool': {u'description': u'converts a bam file to fastq files.',
    u'id': u'521e282770fd94537daff87adad2551b',
    u'name': u'Defuse BamFastq',
    u'repo_name': None,
    u'repo_owner_username': u'jjohnson'}}],
 u'hostname': u'https://testtoolshed.g2.bx.psu.edu/',
 u'page': u'1',
 u'page_size': u'2',
 u'total_results': u'118'}