Skip to content

Commit

Permalink
Merge pull request #4737 from xgaia/askomics-ie
Browse files Browse the repository at this point in the history
AskOmics Interactive Environment
  • Loading branch information
dannon committed Nov 15, 2017
2 parents e27a169 + 8d3c8c6 commit f34e6a1
Show file tree
Hide file tree
Showing 5 changed files with 132 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 geosciences flavour,
# you can create the image based on our default image and add the
# appropriate `apt-get/pip install` statements.
---
-
image: askomics/askomics-ie
description: |
AskOmics, a visual SPARQL query builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[main]
# Unused

[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

# 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 the UI.
docker_connect_port = 6543
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE interactive_environment SYSTEM "../../interactive_environments.dtd">
<interactive_environment name="AskOmics">
<data_sources>
<data_source>
<model_class>HistoryDatasetAssociation</model_class>
<test type="isinstance" test_attr="datatype" result_type="datatype">tabular.Tabular</test>
<test type="isinstance" test_attr="datatype" result_type="datatype">tabular.gff</test>
<test type="isinstance" test_attr="datatype" result_type="datatype">tabular.gff3</test>
<test type="isinstance" test_attr="datatype" result_type="datatype">tabular.bed</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">askomics.mako</entry_point>
</interactive_environment>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var IES = window.IES;

function load_askomics(url){
$( document ).ready(function() {
IES.test_ie_availability(url, function(){
IES.append_notebook(url);
});
});
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<%namespace name="ie" file="ie.mako" />
<%
import random
import string
# Sets ID and sets up a lot of other variables
ie_request.load_deploy_config()
# get an API key for AskOmics
askomics_api_key = ie_request.notebook_pw
# Get ids of selected datasets
additional_ids = trans.request.params.get('additional_dataset_ids', None)
if not additional_ids:
additional_ids = str(trans.security.encode_id( hda.id ) )
else:
additional_ids += "," + trans.security.encode_id( hda.id )
# Launch the IE. This builds and runs the docker command in the background.
ie_request.launch(
additional_ids=additional_ids if ie_request.use_volumes else None,
env_override={
'ASKO_load_url': 'http://localhost:6543',
'ASKOMICS_API_KEY': askomics_api_key,
'ASKO_files_dir': '/tmp/askomics-ie',
'VIRT_Parameters_NumberOfBuffers': 10000, # see https://github.com/xgaia/askomics-docker-compose/tree/master/virtuoso#virtuoso for this values
'VIRT_Parameters_MaxDirtyBuffers': 6000
}
)
# 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}/login_api_gie?key=' + askomics_api_key)
%>
<html>
<head>
${ ie.load_default_js() }
</head>
<body>
<script type="text/javascript">
${ ie.default_javascript_variables() }
var url = '${ url }';
${ ie.plugin_require_config() }
requirejs(['galaxy.interactive_environments', 'plugin/askomics'], function(IES){
window.IES = IES;
load_askomics(url);
});
</script>
<div id="main" width="100%" height="100%">
</div>
</body>
</html>

0 comments on commit f34e6a1

Please sign in to comment.