Merge pull request #3330 from bgruening/hicbrowser

HiCBrowser as Galaxy IE
This commit is contained in:
Eric Rasche
2017-09-08 14:18:18 +02:00
committed by GitHub
5 changed files with 133 additions and 0 deletions
@@ -0,0 +1,11 @@
# This file lists acceptable images to allow runing.
#
# This allows you, the admin, to create multiple flavours
# for your users to run. E.g. maybe you need a specific branded flavour,
# you can create the image based on our default image and add the
# appropriate files.
---
-
image: bgruening/docker-hicbrowser
description: |
A simple web browser to visualize Hi-C and other genomic tracks
@@ -0,0 +1,46 @@
[main]
# Following options are ignored if using the Galaxy dynamic proxy but
# are useful if mapping a range of ports for environment consumption.
#password_auth = False
#ssl = False
[docker]
# Command to launch docker container. For example `sudo docker` or `docker-lxc`.
# If you need to use a command like `sg` you can do that here, just be sure to
# wrap all of the docker portion in single quotes. E.g. `sg 'docker' 'docker {docker_args}'`
#
# It is recommended that you use command_inject if you need to inject
# additional parameters. This command string is re-used for a `docker inspect`
# command and will likely cause errors if it is extensively modified, past the
# usual group/sudo changes.
#command = docker {docker_args}
# The image argument was moved to "allowed_images.yml.sample"
# Additional arguments that are passed to the `docker run` command.
command_inject = --sig-proxy=true -e DEBUG=false -e KILL_MODE=True -e DEFAULT_CONTAINER_RUNTIME=120
# URL to access the Galaxy API with from the spawn Docker containter, if empty
# this falls back to galaxy.ini's galaxy_infrastructure_url and finally to the
# Docker host of the spawned container if that is also not set.
#galaxy_url =
# The Docker hostname. It can be useful to run the Docker daemon on a different
# host than Galaxy.
#docker_hostname = localhost
# Try to set the tempdirectory to world execute - this can fix the issue
# where 'sudo docker' is not able to mount the folder otherwise.
# "finalize namespace chdir to /import permission denied"
#wx_tempdir = False
# Overwride the IE tempdirectory. This can be useful if you regular tempdir is
# located on an NFS share, which does not work well as Docker volume. In this case
# you can have a shared sshfs share which you can use as temporary directory to
# share data between the IE and Galaxy.
#docker_galaxy_temp_dir = None
# If your Docker container exposes more then one port, Galaxy needs to know to
# which ports it needs to connect. With this option you can specify the port number
# inside your container to which Galaxy should connect.
docker_connect_port = 80
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE interactive_environment SYSTEM "../../interactive_environments.dtd">
<interactive_environment name="HiCBrowser">
<data_sources>
<data_source>
<model_class>HistoryDatasetAssociation</model_class>
<test type="isinstance" test_attr="datatype" result_type="datatype">binary.CompressedArchive</test>
<to_param param_attr="id">dataset_id</to_param>
</data_source>
</data_sources>
<params>
<param type="dataset" var_name_in_template="hda" required="true">dataset_id</param>
</params>
<entry_point entry_point_type="mako">hicbrowser.mako</entry_point>
</interactive_environment>
@@ -0,0 +1,12 @@
// Load an interactive environment (IE) from a remote URL
// @param {String} hicexplorer_access_url: the URL embeded in the page and loaded
function load_hicexplorer(hicexplorer_access_url){
// When the page has completely loaded...
$( document ).ready(function() {
// Test if we can access the GIE, and if so, execute the function
// to load the GIE for the user.
test_ie_availability(hicexplorer_access_url, function(){
append_notebook(hicexplorer_access_url);
});
});
}
@@ -0,0 +1,49 @@
<%namespace name="ie" file="ie.mako" />
<%
# Sets ID and sets up a lot of other variables
ie_request.load_deploy_config()
# Define a volume that will be mounted into the container.
# This is a useful way to provide access to large files in the container,
# if the user knows ahead of time that they will need it.
import os
mount_path = hda.file_name
data_vol = ie_request.volume(mount_path, '/data/data_pack.tar.gz', how='rw')
# Add all environment variables collected from Galaxy's IE infrastructure
# Launch the IE.
ie_request.launch(
image = trans.request.params.get('image_tag', None),
additional_ids = trans.request.params.get('additional_dataset_ids', None),
volumes = [data_vol]
)
# Only once the container is launched can we template our URLs. The ie_request
# doesn't have all of the information needed until the container is running.
url = ie_request.url_template('${PROXY_URL}')
%>
<html>
<head>
${ ie.load_default_js() }
</head>
<body>
<script type="text/javascript">
${ ie.default_javascript_variables() }
var url = '${ url }';
${ ie.plugin_require_config() }
requirejs(['interactive_environments', 'plugin/hicbrowser'], function () {
load_hicexplorer(url);
});
</script>
<div id="main" width="100%" height="100%">
</div>
</body>
</html>