diff --git a/axial/axial.py b/axial/axial.py index f8ff5f4..355e3f3 100644 --- a/axial/axial.py +++ b/axial/axial.py @@ -20,7 +20,7 @@ import networkx as nx from networkx.readwrite import json_graph as nx_json -import jinja2 +import pystache logger = logging.getLogger(__name__) @@ -53,13 +53,12 @@ def CDN_url(version): return f'https://unpkg.com/axialjs@{version}/' "https://unpkg.com/clone@2.1.2/clone.js", ] -templateEnv = jinja2.Environment(loader=jinja2.PackageLoader('axial', 'templates')) +renderer = pystache.Renderer(search_dirs=pkg_resources.resource_filename('axial', 'templates'), file_extension='html', partials=None) ############################################################################### ## Private Helper Methods - def _scripts_block(scripts, mode, output_dir): """ """ @@ -117,7 +116,6 @@ def _data_block(mode, names_and_jsons, output_dir, include_gene_sets=True, organ return data_block - def _verify_differential_df(df): """ """ @@ -155,6 +153,7 @@ def _sanitize(string): return string ## TODO def _quote(string): return '\"'+string+'\"' + ############################################################################### ## Public Methods @@ -361,6 +360,7 @@ def braid(genes_by_samples_matrix, sample_attributes, title='Axial Braid Plot', return (output_dir / filename).resolve() + def heatmap(genes_by_samples_matrix, sample_attributes, title='Axial Heatmap', scripts_mode="CDN", data_mode="directory", organism="human", separate_zscore_by=["system"], output_dir=".", filename="heatmap.html", version=this_version): @@ -426,7 +426,6 @@ def heatmap(genes_by_samples_matrix, sample_attributes, title='Axial Heatmap', s - def graph(networkx_graph, title='Axial Graph Visualization', scripts_mode="CDN", data_mode="directory", output_dir=".", filename="graph.html", version=this_version): """ diff --git a/axial/templates/bar.html.j2 b/axial/templates/bar.html similarity index 100% rename from axial/templates/bar.html.j2 rename to axial/templates/bar.html diff --git a/axial/templates/braid.html.j2 b/axial/templates/braid.html similarity index 100% rename from axial/templates/braid.html.j2 rename to axial/templates/braid.html diff --git a/axial/templates/graph.html.j2 b/axial/templates/graph.html similarity index 100% rename from axial/templates/graph.html.j2 rename to axial/templates/graph.html diff --git a/axial/templates/heatmap.html.j2 b/axial/templates/heatmap.html similarity index 100% rename from axial/templates/heatmap.html.j2 rename to axial/templates/heatmap.html diff --git a/axial/templates/volcano.html.j2 b/axial/templates/volcano.html similarity index 75% rename from axial/templates/volcano.html.j2 rename to axial/templates/volcano.html index bcec2ef..9963c6e 100644 --- a/axial/templates/volcano.html.j2 +++ b/axial/templates/volcano.html @@ -1,35 +1,47 @@ -{% extends 'base.html.j2' %} - -{% block head %} - - -