Minor bug fixes.
This commit is contained in:
@@ -194,73 +194,6 @@ def construct_chart(df:pd.DataFrame, modes:list, ytitle:str|None=None) -> Figure
|
||||
fig.add_traces(bar.data)
|
||||
return generic_figure_markers(fig=fig, modes=modes, ytitle=ytitle)
|
||||
|
||||
# Below are the individual construction functions. They must be named "construct_{mode}_chart" and
|
||||
# take only json_in and mode to hook into the main processor.
|
||||
|
||||
# def construct_refseq_chart(df:pd.DataFrame, group_name:str, mode:str) -> Figure:
|
||||
# """
|
||||
# Constructs intial refseq chart for both contains and matches (depreciated).
|
||||
|
||||
# Args:
|
||||
# df (pd.DataFrame): dataframe containing all sample data for the group.
|
||||
# group_name (str): name of the group being processed.
|
||||
# mode (str): contains or matches, overwritten by hardcoding, so don't think about it too hard.
|
||||
|
||||
# Returns:
|
||||
# Figure: initial figure with contains and matches traces.
|
||||
# """
|
||||
# # This overwrites the mode from the signature, might get confusing.
|
||||
# fig = Figure()
|
||||
# modes = ['contains', 'matches']
|
||||
# for ii, mode in enumerate(modes):
|
||||
# bar = px.bar(df, x="submitted_date",
|
||||
# y=f"{mode}_ratio",
|
||||
# color="target",
|
||||
# title=f"{group_name}_{mode}",
|
||||
# barmode='stack',
|
||||
# hover_data=["genus", "name", f"{mode}_hashes"],
|
||||
# text="genera"
|
||||
# )
|
||||
# bar.update_traces(visible = ii == 0)
|
||||
# # Plotly express returns a full figure, so we have to use the data from that figure only.
|
||||
# fig.add_traces(bar.data)
|
||||
# # sys.exit(f"number of traces={len(fig.data)}")
|
||||
# return generic_figure_markers(fig=fig, modes=modes)
|
||||
|
||||
# def construct_kraken_chart(settings:dict, df:pd.DataFrame, group_name:str, mode:str) -> Figure:
|
||||
# """
|
||||
# Constructs intial refseq chart for each mode in the kraken config settings. (depreciated)
|
||||
|
||||
# Args:
|
||||
# settings (dict): settings passed down from click.
|
||||
# df (pd.DataFrame): dataframe containing all sample data for the group.
|
||||
# group_name (str): name of the group being processed.
|
||||
# mode (str): kraken modes retrieved from config file by setup.
|
||||
|
||||
# Returns:
|
||||
# Figure: initial figure with traces for modes
|
||||
# """
|
||||
# df[f'{mode}_count'] = pd.to_numeric(df[f'{mode}_count'],errors='coerce')
|
||||
# df = df.groupby('submitted_date')[f'{mode}_count'].nlargest(2)
|
||||
|
||||
# # The actual percentage from kraken was off due to exclusion of NaN, recalculating.
|
||||
# df[f'{mode}_percent'] = 100 * df[f'{mode}_count'] / df.groupby('submitted_date')[f'{mode}_count'].transform('sum')
|
||||
# modes = settings['modes'][mode]
|
||||
# # This overwrites the mode from the signature, might get confusing.
|
||||
# fig = Figure()
|
||||
# for ii, entry in enumerate(modes):
|
||||
# bar = px.bar(df, x="submitted_date",
|
||||
# y=entry,
|
||||
# color="genus",
|
||||
# title=f"{group_name}_{entry}",
|
||||
# barmode="stack",
|
||||
# hover_data=["genus", "name", "target"],
|
||||
# text="genera",
|
||||
# )
|
||||
# bar.update_traces(visible = ii == 0)
|
||||
# fig.add_traces(bar.data)
|
||||
# return generic_figure_markers(fig=fig, modes=modes)
|
||||
|
||||
def divide_chunks(input_list:list, chunk_count:int):
|
||||
"""
|
||||
Divides a list into {chunk_count} equal parts
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
import numpy as np
|
||||
from tools import check_if_app, jinja_template_loading
|
||||
import logging
|
||||
import logging, sys
|
||||
|
||||
logger = logging.getLogger(f"submissions.{__name__}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user