mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
add the initial IPython Integration
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE visualization SYSTEM "../../visualization.dtd">
|
||||
<visualization name="IPython">
|
||||
<data_sources>
|
||||
<data_source>
|
||||
<model_class>HistoryDatasetAssociation</model_class>
|
||||
<test type="isinstance" test_attr="datatype" result_type="datatype">tabular.Tabular</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>
|
||||
<template>ipython.mako</template>
|
||||
</visualization>
|
||||
@@ -0,0 +1,73 @@
|
||||
<%
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
empty_nb = """{
|
||||
"metadata": {
|
||||
"name": "",
|
||||
"signature": "sha256:201eaf53a7ca0a5b661e0c8925adc61714a91ac871471604c428cbda4a698239"
|
||||
},
|
||||
"nbformat": 3,
|
||||
"nbformat_minor": 0,
|
||||
"worksheets": [
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "heading",
|
||||
"level": 2,
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Welcome to the interactive Galaxy IPython Notebook."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"You can access your data via the dataset number. For example: handle = open('42', 'r')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"collapsed": false,
|
||||
"input": [],
|
||||
"language": "python",
|
||||
"metadata": {},
|
||||
"outputs": []
|
||||
}
|
||||
],
|
||||
"metadata": {}
|
||||
}
|
||||
]
|
||||
}"""
|
||||
|
||||
PORT = 7777
|
||||
|
||||
temp_dir = os.path.abspath( tempfile.mkdtemp() )
|
||||
new_dataset_path = os.path.join( temp_dir, str( hda.hid ) )
|
||||
shutil.copy( hda.file_name, new_dataset_path )
|
||||
|
||||
|
||||
empty_nb_path = os.path.join(temp_dir, 'ipython_galaxy_notebook.ipynb')
|
||||
with open( empty_nb_path, 'w+' ) as handle:
|
||||
handle.write( empty_nb )
|
||||
|
||||
docker_cmd = 'docker run -d -p %s:6789 -v "%s:/import/" bgruening/docker-ipython-notebook' % (PORT, temp_dir)
|
||||
|
||||
subprocess.call(docker_cmd, shell=True)
|
||||
|
||||
|
||||
%>
|
||||
<html>
|
||||
|
||||
|
||||
<body>
|
||||
<object data="http://localhost:${PORT}/notebooks/ipython_galaxy_notebook.ipynb" height="100%" width="100%">
|
||||
<embed src="http://localhost:${PORT}/notebooks/ipython_galaxy_notebook.ipynb" height="100%" width="100%">
|
||||
</embed>
|
||||
</object>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user