Skip to content

Instantly share code, notes, and snippets.

View jmchilton's full-sized avatar

John Chilton jmchilton

  • Penn State University
  • Pittsburgh, PA
  • X @jmchilton
View GitHub Profile
from galaxy.util import topsort
def test_topsort_level_stability():
data = [
(0, 2),
(1, 2),
(2, 3),
(2, 4),
(3, 4),
@jmchilton
jmchilton / run_random_lines_bioblend_example.py
Created July 24, 2014 15:59
Example script that runs Galaxy's random lines tool using bioblend.
# Setup Galaxy instance and dataset for testing...
from bioblend import galaxy
gi = galaxy.GalaxyInstance("localhost:8080", "1957431058be3aa3c57ca312f4a05521")
history = gi.histories.create_history(name="TestRandomLines")
dataset_id = gi.tools.paste_content("1\n2\n3", history["id"])['outputs'][0]["id"]
# Prepare tool inputs.
from bioblend.galaxy.tools.inputs import inputs, dataset
random_lines_inputs = inputs().set("num_lines", 1).set("input", dataset(dataset_id))
@jmchilton
jmchilton / job_conf.xml
Created June 28, 2014 23:54
Simplest possible job_conf.xml to allow Galaxy to run tools in docker containers.
<?xml version="1.0"?>
<job_conf>
<plugins>
<plugin id="local" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="4"/>
</plugins>
<handlers>
<handler id="main"/>
</handlers>
<destinations>
<destination id="local" runner="local">
% sudo apt-get install curl git software-properties-common gawk g++ gcc make libc6-dev libreadline6-dev zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev
% \curl -L https://get.rvm.io | bash -s stable
% source /home/vagrant/.rvm/scripts/rvm
% rvm install ruby-2.0
% rvm gemset create fpm
% rvm use @fpm
% gem install fpm
Next login
Traceback (most recent call last):
File "/home/galaxy/shed_tools/toolshed.g2.bx.psu.edu/repos/devteam/data_manager_fetch_genome_all_fasta/2ebc856bce29/data_manager_fetch_genome_all_fasta/data_manager/data_manager_fetch_genome_all_fasta.py", line 350, in <module>
if __name__ == "__main__": main()
File "/home/galaxy/shed_tools/toolshed.g2.bx.psu.edu/repos/devteam/data_manager_fetch_genome_all_fasta/2ebc856bce29/data_manager_fetch_genome_all_fasta/data_manager/data_manager_fetch_genome_all_fasta.py", line 345, in main
REFERENCE_SOURCE_TO_DOWNLOAD[ params['param_dict']['reference_source']['reference_source_selector'] ]( data_manager_dict, params, target_directory, dbkey, sequence_id, sequence_name )
File "/home/galaxy/shed_tools/toolshed.g2.bx.psu.edu/repos/devteam/data_manager_fetch_genome_all_fasta/2ebc856bce29/data_manager_fetch_genome_all_fasta/data_manager/data_manager_fetch_genome_all_fasta.py", line 186, in download_from_ucsc
path_contents = _get_files_in_ftp_path( ftp, ucsc_path )
File
@jmchilton
jmchilton / job_conf.xml
Last active August 29, 2015 14:02
Exclusive Local Runners
<?xml version="1.0"?>
<!-- Example Galaxy job_conf.xml file that ensures a handful tools run one at a time.
-->
<job_conf>
<plugins>
<plugin id="local" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="2"/>
<plugin id="local_exclusive" type="runner" load="galaxy.jobs.runners.local:LocalJobRunner" workers="1"/>
</plugins>
<handlers>
<handler id="main"/>
@jmchilton
jmchilton / gist:fddaaac1df9af731dbab
Created June 18, 2014 06:42
Old (LWR) and New (Pulsar?) Routes...
## LWR Routes:
# Jobs (so much legacy cruft)
GET: [/managers/<manager_name>]/setup
GET: [/managers/<manager_name>]/clean?job_id=
GET: [/managers/<manager_name>]/launch?job_id=
GET: [/managers/<manager_name>]/check_complete?job_id=
GET: [/managers/<manager_name>]/kill?job_id=
GET: [/managers/<manager_name>]/input_path?job_id=
(venv)vagrant@mesos:~/mesos_example$ python test_framework.py 127.0.1.1:5050
/home/vagrant/mesos_example/venv/local/lib/python2.7/site-packages/pkg_resources.py:991: UserWarning: /home/vagrant/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
warnings.warn(msg, UserWarning)
I0614 20:42:54.441416 3420 sched.cpp:126] Version: 0.19.0
I0614 20:42:54.445785 3424 sched.cpp:222] New master detected at [email protected]:5050
I0614 20:42:54.446276 3424 sched.cpp:230] No credentials provided. Attempting to register without authentication
I0614 20:42:54.450227 3424 sched.cpp:397] Framework registered with 20140614-194745-16842879-5050-1216-0006
Registered with framework ID 20140614-194745-16842879-5050-1216-0006
Got 1 resource offers
Got resource offer 20140614-194745-16842879-5050-1216-610
@jmchilton
jmchilton / cool.py
Created June 10, 2014 19:59
Examples of determining recent usage in dynamic destinations
import logging
log = logging.getLogger( __name__ )
from datetime import timedelta
def cool_runner( rule_helper, user_email ):
job_count = rule_helper.job_count(
for_user_email=user_email,
created_in_last=timedelta(days=10),
@jmchilton
jmchilton / bowtie2.xml
Last active August 29, 2015 14:02
Modified tools from dataset collection presentation.
<tool id="bowtie2" name="Bowtie2" version="0.2">
<!-- Wrapper compatible with Bowtie version 2.0.0 -->
<description>is a short-read aligner</description>
<version_command>bowtie2 --version</version_command>
<requirements>
<requirement type="package" version="2.1.0">bowtie2</requirement>
<requirement type="package" version="0.1.18">samtools</requirement>
</requirements>
<command>