scripts.helpers#

Classes#

Functions#

apply_gating(data_df[, stain1, stain2, extra_stains])

button_style([font_size, padding, color, bck_col, ...])

create_file_path(output_dir, sample, name, extension)

Helper function to create file paths.

get_abs_path(relative_path)

Get absolute path to a resource, relative to the base directory.

get_app_dir()

Get absolute path relative to the executable location.

get_stains_from_panel(Panel)

Build Stain instances for the two main stain types of living/dead and cells/not cells cases.

load_model_from_files(trained_model_dir)

save_gating_results(gated_data_df, output_dir, sample, ...)

stain_sannity_check(df, label, channel, sign, threshold)

Checks if gating applied for a stain returns both True and False cases.

time_based_dir(prefix, base_path[, multiple_cocultures])

Module Contents#

class scripts.helpers.Stain#
channel: str#
label: str | None = None#
sign: str#
value: float#
scripts.helpers.apply_gating(data_df, stain1=None, stain2=None, extra_stains=None)#
scripts.helpers.button_style(font_size=12, padding=5, color='black', bck_col='#90EE90', bck_col_hov='#7FCF7F', bck_col_clicked='#72B572', radius=5)#
scripts.helpers.create_file_path(output_dir, sample, name, extension)#

Helper function to create file paths.

scripts.helpers.get_abs_path(relative_path)#

Get absolute path to a resource, relative to the base directory.

scripts.helpers.get_app_dir()#

Get absolute path relative to the executable location.

scripts.helpers.get_stains_from_panel(Panel)#

Build Stain instances for the two main stain types of living/dead and cells/not cells cases. In this case, no label is part of the Stain instance. Function to be used only in the GUI framework.

Arguments:

PredictionPanel:

Returns:

stain1 (Stain) stain2 (Stain)

scripts.helpers.load_model_from_files(trained_model_dir)#
scripts.helpers.save_gating_results(gated_data_df, output_dir, sample, x_axis, y_axis, z_axis, all_labels)#
scripts.helpers.stain_sannity_check(df, label, channel, sign, threshold)#

Checks if gating applied for a stain returns both True and False cases. If not, raises an error so the user refines their thresholds.

scripts.helpers.time_based_dir(prefix, base_path, multiple_cocultures=False)#