from shiny import render from shiny.express import input, ui import plotly.express as px import pandas as pd import matplotlib.pyplot as plt ui.page_opts(fillable=True) ui.panel_title("Kmer Analysis") with ui.layout_columns(): with ui.card(): ui.input_slider("slider", "Slider", 0, 10, 5) @render.plot def plot(): df = pd.read_csv('kmers.csv') k = input.slider() fig = None if k: df = df[df['k'] == k] fig, ax = plt.subplots() ax.bar(df['kmer'], df['count']) ax.set_title(f"Most common {k}-mers") ax.set_xlabel("K-mer") ax.set_ylabel("Count") ax.set_xticklabels(df['kmer'], rotation=90) return fig