-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add BAM iobio visualisation as Interactive Environment #1131
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,11 @@ | |
class InteractiveEnviornmentRequest(object): | ||
|
||
def __init__(self, trans, plugin): | ||
plugin_config = plugin.config | ||
|
||
self.trans = trans | ||
self.log = log | ||
|
||
self.attr = Bunch() | ||
self.attr.viz_id = plugin_config["name"].lower() | ||
self.attr.viz_id = plugin.name | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is throwing a travis error:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
self.attr.history_id = trans.security.encode_id( trans.history.id ) | ||
self.attr.galaxy_config = trans.app.config | ||
self.attr.galaxy_root_dir = os.path.abspath(self.attr.galaxy_config.root) | ||
|
@@ -95,7 +93,6 @@ def _boolean_option(option, default=False): | |
# we always assume use of Galaxy dynamic proxy? None of these need to be specified | ||
# if using the Galaxy dynamic proxy. | ||
self.attr.PASSWORD_AUTH = _boolean_option("password_auth") | ||
self.attr.APACHE_URLS = _boolean_option("apache_urls") | ||
self.attr.SSL_URLS = _boolean_option("ssl") | ||
|
||
def get_conf_dict(self): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this used? Just noticed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually it will work without, but this save one volume.