Updated parsers and chart constructors.
This commit is contained in:
@@ -107,8 +107,8 @@ class SheetParser(object):
|
||||
"""
|
||||
for ii, row in df.iterrows():
|
||||
# skip positive control
|
||||
if ii == 11:
|
||||
continue
|
||||
# if ii == 12:
|
||||
# continue
|
||||
logger.debug(f"Running reagent parse for {row[1]} with type {type(row[1])} and value: {row[2]} with type {type(row[2])}")
|
||||
if not isinstance(row[2], float) and check_not_nan(row[1]):
|
||||
# must be prefixed with 'lot_' to be recognized by gui
|
||||
@@ -117,7 +117,10 @@ class SheetParser(object):
|
||||
except AttributeError:
|
||||
pass
|
||||
if reagent_type == "//":
|
||||
reagent_type = row[0].replace(' ', '_').lower().strip()
|
||||
if check_not_nan(row[2]):
|
||||
reagent_type = row[0].replace(' ', '_').lower().strip()
|
||||
else:
|
||||
continue
|
||||
try:
|
||||
output_var = row[2].upper()
|
||||
except AttributeError:
|
||||
@@ -142,10 +145,11 @@ class SheetParser(object):
|
||||
# reagents
|
||||
# must be prefixed with 'lot_' to be recognized by gui
|
||||
# Todo: find a more adaptable way to read reagents.
|
||||
reagent_range = submission_info.iloc[1:13, 4:8]
|
||||
reagent_range = submission_info.iloc[1:14, 4:8]
|
||||
logger.debug(reagent_range)
|
||||
parse_reagents(reagent_range)
|
||||
# get individual sample info
|
||||
sample_parser = SampleParser(submission_info.iloc[15:111])
|
||||
sample_parser = SampleParser(submission_info.iloc[16:112])
|
||||
sample_parse = getattr(sample_parser, f"parse_{self.sub['submission_type'].lower()}_samples")
|
||||
logger.debug(f"Parser result: {self.sub}")
|
||||
self.sub['samples'] = sample_parse()
|
||||
|
||||
@@ -9,6 +9,7 @@ import sys
|
||||
from pathlib import Path
|
||||
import re
|
||||
from tools import check_if_app
|
||||
import asyncio
|
||||
|
||||
logger = logging.getLogger(f"submissions.{__name__}")
|
||||
|
||||
@@ -109,9 +110,10 @@ def convert_data_list_to_df(ctx:dict, input:list[dict], subtype:str|None=None) -
|
||||
if column not in safe:
|
||||
if subtype != None and column != subtype:
|
||||
del df[column]
|
||||
# logger.debug(df)
|
||||
# move date of sample submitted on same date as previous ahead one.
|
||||
df = displace_date(df)
|
||||
df.sort_values('submitted_date').to_excel("controls.xlsx", engine="openpyxl")
|
||||
# df.sort_values('submitted_date').to_excel("controls.xlsx", engine="openpyxl")
|
||||
# ad hoc method to make data labels more accurate.
|
||||
df = df_column_renamer(df=df)
|
||||
return df
|
||||
@@ -131,8 +133,8 @@ def df_column_renamer(df:DataFrame) -> DataFrame:
|
||||
return df.rename(columns = {
|
||||
"contains_ratio":"contains_shared_hashes_ratio",
|
||||
"matches_ratio":"matches_shared_hashes_ratio",
|
||||
"kraken_count":"kraken2_read_count",
|
||||
"kraken_percent":"kraken2_read_percent"
|
||||
"kraken_count":"kraken2_read_count_(top_20)",
|
||||
"kraken_percent":"kraken2_read_percent_(top_20)"
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user