-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1131 from bgruening/IE_iobio
Add BAM iobio visualisation as Interactive Environment
- Loading branch information
Showing
9 changed files
with
162 additions
and
8 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
config/plugins/interactive_environments/bam_iobio/config/bam_iobio.ini.sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[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 docker image name that should be started. | ||
image = qiaoy/iobio-bundle.bam-iobio:1.0-ondemand | ||
|
||
# Additional arguments that are passed to the `docker run` command. | ||
#command_inject = --sig-proxy=true -e DEBUG=false | ||
|
||
# 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 | ||
|
15 changes: 15 additions & 0 deletions
15
config/plugins/interactive_environments/bam_iobio/config/bam_iobio.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE interactive_environment SYSTEM "../../interactive_environments.dtd"> | ||
<interactive_environment name="BAM iobio"> | ||
<data_sources> | ||
<data_source> | ||
<model_class>HistoryDatasetAssociation</model_class> | ||
<test type="isinstance" test_attr="datatype" result_type="datatype">binary.Bam</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">bam_iobio.mako</entry_point> | ||
</interactive_environment> |
39 changes: 39 additions & 0 deletions
39
config/plugins/interactive_environments/bam_iobio/static/js/bam_iobio.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
function message_failed_auth(password){ | ||
toastr.info( | ||
"Automatic authorization failed.", | ||
"Please login manually", | ||
{'closeButton': true, 'timeOut': 100000, 'tapToDismiss': false} | ||
); | ||
} | ||
|
||
function message_failed_connection(){ | ||
toastr.error( | ||
"Could not connect to BAM iobio. Please contact your administrator.", | ||
"Security warning", | ||
{'closeButton': true, 'timeOut': 20000, 'tapToDismiss': true} | ||
); | ||
} | ||
|
||
/** | ||
* Load an interactive environment (IE) from a remote URL | ||
* @param {String} password: password used to authenticate to the remote resource | ||
* @param {String} notebook_login_url: URL that should be POSTed to for login | ||
* @param {String} notebook_access_url: the URL embeded in the page and loaded | ||
* | ||
*/ | ||
function load_notebook(notebook_access_url){ | ||
$( document ).ready(function() { | ||
// Test notebook_login_url for accessibility, executing the login+load function whenever | ||
// we've successfully connected to the IE. | ||
test_ie_availability(notebook_access_url, function(){ | ||
_handle_notebook_loading(notebook_access_url); | ||
}); | ||
}); | ||
} | ||
|
||
/** | ||
* Must be implemented by IEs | ||
*/ | ||
function _handle_notebook_loading(notebook_access_url){ | ||
append_notebook(notebook_access_url); | ||
} |
62 changes: 62 additions & 0 deletions
62
config/plugins/interactive_environments/bam_iobio/templates/bam_iobio.mako
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<%namespace name="ie" file="ie.mako" /> | ||
|
||
<% | ||
import subprocess | ||
from galaxy.util import sockets | ||
# Sets ID and sets up a lot of other variables | ||
ie_request.load_deploy_config() | ||
ie_request.attr.docker_port = 80 | ||
ie_request.attr.import_volume = False | ||
bam = ie_request.volume(hda.file_name, '/input/bamfile.bam', how='ro') | ||
bam_index = ie_request.volume(hda.metadata.bam_index.file_name, '/input/bamfile.bam.bai', how='ro') | ||
ie_request.launch(volumes=[bam, bam_index], env_override={ | ||
'PUB_HTTP_PORT': ie_request.attr.galaxy_config.dynamic_proxy_bind_port, | ||
'PUB_HOSTNAME': ie_request.attr.HOST, | ||
}) | ||
notebook_access_url = ie_request.url_template('${PROXY_URL}/?bam=http://localhost/tmp/bamfile.bam') | ||
root = h.url_for( '/' ) | ||
%> | ||
<html> | ||
<head> | ||
${ ie.load_default_js() } | ||
</head> | ||
<body> | ||
|
||
<script type="text/javascript"> | ||
${ ie.default_javascript_variables() } | ||
var notebook_access_url = '${ notebook_access_url }'; | ||
${ ie.plugin_require_config() } | ||
requirejs(['interactive_environments', 'plugin/bam_iobio'], function(){ | ||
display_spinner(); | ||
}); | ||
toastr.info( | ||
"BAM io.bio is starting up!", | ||
"transferring data ...", | ||
{'closeButton': true, 'timeOut': 5000, 'tapToDismiss': false} | ||
); | ||
var startup = function(){ | ||
// Load notebook | ||
requirejs(['interactive_environments', 'plugin/bam_iobio'], function(){ | ||
load_notebook(notebook_access_url); | ||
}); | ||
}; | ||
// sleep 5 seconds | ||
// this is currently needed to get the vis right | ||
// plans exists to move this spinner into the container | ||
setTimeout(startup, 5000); | ||
</script> | ||
<div id="main"> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
config/plugins/interactive_environments/ipython/config/ipython.ini.sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters