How to use the bioblend.galaxy function in bioblend

To help you get started, we’ve selected a few bioblend 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 galaxyproject / galaxy / test / manual / gen_history_export_test_artifacts.py View on Github external
def _gi(args):
    gi = galaxy.GalaxyInstance(args.host, key=args.api_key)
    name = "histexport-user-%d" % random.randint(0, 1000000)

    user = gi.users.create_local_user(name, "%s@galaxytesting.dev" % name, "pass123")
    user_id = user["id"]
    api_key = gi.users.create_user_apikey(user_id)
    user_gi = galaxy.GalaxyInstance(args.host, api_key)
    return user_gi
github refinery-platform / refinery-platform / refinery / galaxy_connector / tests.py View on Github external
def setUp(self):
        self.GALAXY_HISTORY_ID = str(uuid.uuid4())
        self.GALAXY_DATASET_ID = str(uuid.uuid4())
        self.GALAXY_DATASET_FILESIZE = 1024
        self.MISCELLANEOUS_STRING = "Coffee is tasty"

        self.galaxy_instance = GalaxyInstanceFactory(api_key=str(uuid.uuid4()))
        self.show_history_mock = mock.patch.object(
            galaxy.histories.HistoryClient, "show_history"
        ).start()
        self.show_dataset_mock = mock.patch.object(
            galaxy.histories.HistoryClient, "show_dataset"
        ).start()

        self.history_content_entry = {
            "name": "Test History Content Entry",
            "url": "www.example.com/history_content_entry",
            "type": "file",
            "id": self.GALAXY_DATASET_ID
        }
github BackofenLab / GraphClust-2 / import_workflows.py View on Github external
#!/usr/bin/env python

import os
from bioblend import galaxy
admin_email = os.environ.get('GALAXY_DEFAULT_ADMIN_USER', 'admin@galaxy.org')
admin_pass = os.environ.get('GALAXY_DEFAULT_ADMIN_PASSWORD', 'admin')
url = "http://localhost:8080"
gi = galaxy.GalaxyInstance(url=url, email=admin_email, password=admin_pass)

wf = galaxy.workflows.WorkflowClient(gi)

for filepath in os.listdir('/home/galaxy/'):
    if filepath.endswith('.ga'):
        wf.import_workflow_from_local_path( os.path.join('/home/galaxy/', filepath) )
github galaxyproject / galaxy / scripts / api / library_upload_dir.py View on Github external
def __init__(self, url, api, library_id, folder_id, should_link,
                 non_local):
        self.gi = galaxy.GalaxyInstance(url=url, key=api)
        self.library_id = library_id
        self.folder_id = folder_id
        self.should_link = should_link
        self.non_local = non_local

        self.memo_path = {}
        self.prepopulate_memo()
github galaxyproject / ephemeris / src / ephemeris / setup_data_libraries.py View on Github external
def setup_data_libraries(gi, data, training=False, legacy=False):
    """
    Load files into a Galaxy data library.
    By default all test-data tools from all installed tools
    will be linked into a data library.
    """

    log.info("Importing data libraries.")
    jc = galaxy.jobs.JobsClient(gi)
    config = galaxy.config.ConfigClient(gi)
    version = config.get_version()

    if legacy:
        create_func = create_legacy
    else:
        version_major = version.get("version_major", "16.01")
        create_func = create_batch_api if version_major >= "18.05" else create_legacy

    library_def = yaml.safe_load(data)

    def normalize_items(has_items):
        # Synchronize Galaxy batch format with older training material style.
        if "files" in has_items:
            items = has_items.pop("files")
            has_items["items"] = items
github refinery-platform / refinery-platform / refinery / galaxy_connector / models.py View on Github external
def galaxy_connection(self):
        return galaxy.GalaxyInstance(url=self.base_url, key=self.api_key)
github galaxyproject / ephemeris / src / ephemeris / setup_data_libraries.py View on Github external
def setup_data_libraries(gi, data, training=False, legacy=False):
    """
    Load files into a Galaxy data library.
    By default all test-data tools from all installed tools
    will be linked into a data library.
    """

    log.info("Importing data libraries.")
    jc = galaxy.jobs.JobsClient(gi)
    config = galaxy.config.ConfigClient(gi)
    version = config.get_version()

    if legacy:
        create_func = create_legacy
    else:
        version_major = version.get("version_major", "16.01")
        create_func = create_batch_api if version_major >= "18.05" else create_legacy

    library_def = yaml.safe_load(data)

    def normalize_items(has_items):
        # Synchronize Galaxy batch format with older training material style.
        if "files" in has_items:
            items = has_items.pop("files")
            has_items["items"] = items
github usegalaxy-eu / infrastructure-playbook / roles / hxr.simple-nagios / files / simple-galaxy.py View on Github external
#!/usr/bin/env python
from bioblend import galaxy
import json
import time

with open('/etc/gx-api-creds.json', 'r') as handle:
    secrets = json.load(handle)

api_key = secrets['api_key']
url = secrets['url']
handlers = secrets['handlers']

history_name = "Nagios Run %s" % time.time()
gi = galaxy.GalaxyInstance(url, api_key)
history = gi.histories.create_history(name=history_name)
history_id = history['id']

jobs = []

# Run all of the jobs.
try:
    for handler in handlers:
        job = gi.tools.run_tool(history_id, 'echo_main_' + handler, {'echo': handler})
        jobs.append({
            'handler': handler,
            'job': job,
            'started': time.time()
        })

    # Check all the jobs
github galaxyproject / ephemeris / src / ephemeris / __init__.py View on Github external
"""
    Return a Galaxy connection, given a user or an API key.
    If not given gets the arguments from the file.
    If either is missing raise ValueError.
    """
    if file:
        file_content = load_yaml_file(file)
    else:
        file_content = dict()

    url = args.galaxy or file_content.get('galaxy_instance')
    galaxy_url = check_url(url, log)
    api_key = args.api_key or file_content.get('api_key')

    if args.user and args.password:
        return galaxy.GalaxyInstance(url=galaxy_url, email=args.user, password=args.password)
    elif api_key:
        return galaxy.GalaxyInstance(url=galaxy_url, key=api_key)
    elif not login_required:
        return galaxy.GalaxyInstance(url=galaxy_url)
    else:
        raise ValueError("Missing api key or user & password combination, in order to make a galaxy connection.")