sarcasm.export
Classes
Class for multi-tif-file comparison of structure. |
|
Class for multi-LOI comparison. |
|
A class used to export structure and motion data from SarcAsM and Motion objects. |
Module Contents
- class sarcasm.export.MultiStructureAnalysis(list_files: list, folder: str, experiment: str = None, load_data: bool = False, **conditions)[source]
Class for multi-tif-file comparison of structure.
- Parameters:
list_files (list) – List of tif files.
folder (str) – Path to a folder to store data and results.
experiment (str, optional) – Name of the experiment (default is None).
load_data (bool, optional) – Whether to load the dataframe from previous analysis from the data folder (default is False).
**conditions (dict) – Keyword arguments with regex functions to extract information from the filename.
- folder
Path to the folder with data and results.
- Type:
str
- experiment
Name of the experiment.
- Type:
str
- files
List of tif files.
- Type:
list
- conditions
Keyword arguments with regex functions to extract information from the filename.
- Type:
dict
- data
DataFrame to store the structure data.
- Type:
pandas.DataFrame
- folder
- experiment = None
- files
- conditions
- data = None
- get_data(structure_keys=None, meta_keys=None)[source]
Iterate files and get structure data.
- Parameters:
structure_keys (list, optional) – List of keys to extract structure data (default is None).
meta_keys (list, optional) – List of keys to extract metadata (default is None).
- Return type:
None
- class sarcasm.export.MultiLOIAnalysis(list_lois, folder, load_data=False, **conditions)[source]
Class for multi-LOI comparison.
- Parameters:
list_lois (list) – List of tuples containing tif file paths and LOI names.
folder (str) – Path to a folder to store data and results.
load_data (bool, optional) – Whether to load the dataframe from previous analysis from the folder (default is False).
**conditions (dict) – Keyword arguments with regex functions to extract information from the filename.
- folder
Path to the folder with data and results.
- Type:
str
- lois
List of tuples containing tif file paths and LOI names.
- Type:
list
- conditions
Keyword arguments with regex functions to extract information from the filename.
- Type:
dict
- data
DataFrame to store the motion data.
- Type:
pandas.DataFrame
- folder
- lois
- conditions
- data = None
- get_data(loi_keys=None, meta_keys=None)[source]
Iterate files and get motion data.
- Parameters:
loi_keys (list, optional) – List of keys to extract motion data (default is None).
meta_keys (list, optional) – List of keys to extract metadata (default is None).
- Return type:
None
- class sarcasm.export.Export[source]
A class used to export structure and motion data from SarcAsM and Motion objects.
- meta_keys_default
Default metadata keys.
- Type:
list
- structure_keys_default
Default structure keys.
- Type:
list
- motion_keys_default
Default motion keys.
- Type:
list
- meta_keys_default = ['file_name', 'file_path', 'frames', 'size', 'pixelsize', 'timestamps', 'time', 'frametime']
- structure_keys_default = ['cell_mask_area', 'cell_mask_area_ratio', 'cell_mask_intensity', 'domain_area_mean',...
- motion_keys_default = ['beating_rate', 'beating_rate_variability', 'contr_max', 'contr_max_avg', 'elong_max',...
- static get_structure_dict(sarc_obj, meta_keys=None, structure_keys=None, **conditions)[source]
Create a dictionary of structure and metadata features from a SarcAsM object.
- Parameters:
sarc_obj (SarcAsM) – Object of SarcAsM class or Motion class.
meta_keys (list, optional) – List of metadata keys (default is None).
structure_keys (list, optional) – List of structure keys (default is None).
conditions (kwargs) – Keyword arguments to add information to the dictionary (e.g., “cell_line”= “wt”, “info_xyz”=42).
- Returns:
Dictionary containing selected metadata and structure features.
- Return type:
dict
- static export_structure_data(filepath, sarc_obj: sarcasm.structure.Structure | sarcasm.motion.Motion, meta_keys=None, structure_keys=None, remove_arrays=True, fileformat='.xlsx')[source]
Export structure data to a file.
- Parameters:
filepath (str) – Path to the output file.
sarc_obj (SarcAsM) – Object of SarcAsM class.
meta_keys (list, optional) – List of metadata keys (default is None).
structure_keys (list, optional) – List of structure keys (default is None).
remove_arrays (bool, optional) – If True, removes columns with array data (default is True).
fileformat (str, optional) – Format of the output file (default is ‘.xlsx’).
- static remove_arrays_dataframe(df)[source]
Remove columns with array data from a DataFrame.
- Parameters:
df (pandas.DataFrame) – Input DataFrame.
- Returns:
DataFrame with array columns removed.
- Return type:
pandas.DataFrame
- static get_motion_dict(motion_obj, meta_keys=None, loi_keys=None, concat=False, **conditions)[source]
Create a dictionary of motion features and metadata from a Motion object.
- Parameters:
motion_obj (Motion) – Object of Motion class for LOI analysis.
meta_keys (list, optional) – List of metadata keys (default is None).
loi_keys (list, optional) – List of LOI keys (default is None).
concat (bool, optional) – If True, all 2D arrays will be concatenated to 1D arrays (default is False).
conditions (kwargs) – Keyword arguments to add to the dictionary, can be any information, e.g., drug=’ABC’.
- Returns:
Dictionary containing selected metadata and motion features.
- Return type:
dict
- static export_motion_data(mot_obj: sarcasm.motion.Motion, filepath, meta_keys=None, motion_keys=None, remove_arrays=True, fileformat='.xlsx')[source]
Export motion data to a file.
- Parameters:
mot_obj (Motion) – Object of Motion class.
filepath (str) – Path to the output file.
meta_keys (list, optional) – List of metadata keys (default is None).
motion_keys (list, optional) – List of motion keys (default is None).
remove_arrays (bool, optional) – If True, removes columns with array data (default is True).
fileformat (str, optional) – Format of the output file (default is ‘.xlsx’).