Giter Club home page Giter Club logo

q2templates's Introduction

q2templates

HTML templates for QIIME 2 Visualizations. For details on QIIME 2, see https://qiime2.org.

q2templates's People

Contributors

andrewsanchez avatar chriskeefe avatar david-rod avatar ebolyen avatar gregcaporaso avatar hagenjp avatar jairideout avatar jakereps avatar lizgehret avatar oddant1 avatar q2d2 avatar thermokarst avatar turanoo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

q2templates's Issues

Test suite issue with pandas 1.5

Bug Description
Debian wants to upgrade pandas to version 1.5. In connection with this pandas version the test suite of q2templates throws an error. This is documented in a bug report.

Steps to reproduce the behavior
You can install the prerequisites (specifically pandas 1.5) as we used in the full build log. This ends with the following error:

=================================== FAILURES ===================================
______________________ TestDataFrameToHTML.test_defaults _______________________

self = <q2templates.tests.test_util.TestDataFrameToHTML testMethod=test_defaults>

    def test_defaults(self):
        df = pd.DataFrame({'col1': ['foo', 'bar', 'baz'], 'col2': [1, 2, 4.2]})

        obs = df_to_html(df)

>       self.assertIn('border="0"', obs)
E       AssertionError: 'border="0"' not found in '<table class="dataframe table table-striped table-hover">\n  <thead>\n    <tr style="text-align: right;">\n      <th></th>\n      <th>col1</th>\n      <th>col2</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>foo</td>\n      <td>1.0</td>\n    </tr>\n    <tr>\n      <th>1</th>\n        <td>bar</td>\n      <td>2.0</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>baz</td>\n      <td>4.2</td>\n    </tr>\n  </tbody>\n</table>'

q2templates/tests/test_util.py:33: AssertionError
=========================== short test summary info ============================
FAILED q2templates/tests/test_util.py::TestDataFrameToHTML::test_defaults - A...
========================= 1 failed, 2 passed in 0.33s ==========================

Expected behavior
Passing the test suite as with previous pandas version.

Computation Environment

  • OS: Debian (unstable + python3-pandas from experimental)
  • QIIME 2 Release: 2022.8.0

Kind regards, Andreas.

Tabs break on iframe navigation

Navigation through the history while in a summarize tab will break the overall tab controller. If you're on a tab, go to a second, and navigate back the iframe will change location but the tab for your previous location will still be highlighted.

Moved from qiime2/q2-feature-table/issues/79 as tab handling moved here since that issue was created.

Initial thoughts

Thoughts on how this package could work.

A simple plugin method:

# plugin/plugin_viz.py
TEMPLATE_DIR = pkg_resources.resource_filename('q2_plugin', 'assets')

def cool_viz(output_dir: str, data: pd.Series) -> None:
    processed_data = foo(data)
    plugin_template = os.path.join(TEMPLATE_DIR, 'index.html')
    outfile = os.path.join(output_dir, 'index.html')
    template_cxt = {'processed_data', processed_data}
    q2design.render(plugin_template, 'plugin_base', outfile, template_cxt)
{# plugin/assets/index.html #}
{% extends base_template %}

{% block title %}The coolest viz!{% endblock title %}
{% block content %}
<h1>A really cool viz</h1>
<ul>
    {% for obj in processed_data %}
    <li>{{ obj.attr_a }} - {{ obj.attr_b }}<li>
    {% endfor %}
</ul>
{% endblock content %}

There should be blocks for a plugin dev to provide their own CSS and JS assets. In the call to q2design.render, the first arg is the input template, the second arg is the base template to use (provided by q2design, the third arg is where to write the resulting file, and the fourth arg is the template context.

Fix padding

The body padding is pushing the content off of the page by 10px. Change to pad all sides.

Pandas 1.0 Options API Tweaks

Bug Description
df_to_html sets the display.max_colwidth parameter to -1 to disable truncating the cell values. This parameter value (-1) is no longer supported, and should be replaced with None to opt into the same behavior

Steps to reproduce the behavior

  1. Install pandas 1.0: conda install -c conda-forge -c bioconda pandas=1.0
import pandas as pd
from q2templates import df_to_html

df = pd.DataFrame([])
df_to_html(df)
  1. Observe the following error: Value must be a nonnegative integer or None

Expected behavior
No error.

References

  1. Busywork.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.