papylio.Experiment#
- class papylio.Experiment(*args, **kwargs)#
- __init__(*args, **kwargs)#
Init method for the Experiment class
Loads config file if it locates one in the main directory, otherwise it exports the default config file to the main directory. Scans all directory in the main directory recursively and imports all found files (if import_all is set to True).
- Parameters:
main_path (
str) – Absolute path to the main experiment folderchannels (
listofstr) – Channels used in the experimentimport_all (
bool) – If true, then all files in the main folder are automatically imported.If false, then files are detected, but not imported.
Methods
__init__(*args, **kwargs)Init method for the Experiment class
Apply common image corrections to all movie objects.
add_files(paths[, test_duplicates])Find unique files in all subfolders and add them to the experiment
Boxplot of the number of molecules in each file
Determine and save flatfield and darkfield corrections for image shading.
Export the number of molecules in each file to an Excel spreadsheet.
files_with_sequencing_match([files])Find unique files in all subfolders and add them to the experiment
generate_tile_mappings(files_for_mapping[, ...])histogram([axis, bins, parameter, ...])FRET histogram of all molecules in the experiment or a specified selection
import_sequencing_data(file_path[, ...])import_sequencing_data_for_mapping(file_path)Load darkfield correction images from disk.
Load flatfield correction images from disk.
plot_trace([files, query])Plot molecule traces with interactive visualization.
Print a summary of all files in the experiment.
select()Simple method to look through all molecules in the experiment
sequencing_match_info_mean([distance_threshold])sequencing_matches([files])show_sequencing_matches([show_file_coordinates])Attributes
Path to the Analysis folder.
Channels used in the experiment.
List of relative file paths for all files in experiment
Mapping file object from the experiment, if one exists.
List of relative NetCDF file paths for all files in experiment
Number of channels used in the experiment (read-only)
List of channel pairs
List of selected files
- add_common_image_corrections_to_movies()#
Apply common image corrections to all movie objects.
Sets the common image corrections (flatfield, darkfield) to all movie objects in the experiment so they can be applied during image processing.
- add_files(paths, test_duplicates=True)#
Find unique files in all subfolders and add them to the experiment
Get all files in all subfolders of the main_path and remove their suffix (extensions), and add them to the experiment.
Note
Non-relevant files are excluded e.g. files with underscores or ‘Analysis’ in their name, or files with dat, db, ini, py and yml extensions.
Note
Since sifx files made using spooling are all called ‘Spooled files’ the parent folder is used as file instead of the sifx file
- property analysis_path#
Path to the Analysis folder.
Creates the Analysis folder in the main experiment directory if it does not exist, then returns the path.
- Type:
pathlib.Path
- boxplot_number_of_molecules()#
Boxplot of the number of molecules in each file
- property channels#
Channels used in the experiment.
Setting the channels will automatically update pairs.
- Type:
list of str
- determine_flatfield_and_darkfield_corrections(files, method='BaSiC', illumination_index=0, frame_index=0, estimate_darkfield=True, **kwargs)#
Determine and save flatfield and darkfield corrections for image shading.
Calculates spatial shading corrections using the specified method and saves them as TIFF files in the main experiment directory. Automatically loads the corrections into the experiment.
- Parameters:
files (
FileCollection) – Collection of files to use for determining correctionsmethod (
str, optional) – Correction method to use (default: ‘BaSiC’)illumination_index (
int, optional) – Index of the illumination pattern to correct (default: 0)frame_index (
int, optional) – Frame index to use for correction calculation (default: 0)estimate_darkfield (
bool, optional) – If True, also estimate and save darkfield correction (default: True)**kwargs – Additional keyword arguments passed to spatial_shading_correction
- export_number_of_molecules_per_file()#
Export the number of molecules in each file to an Excel spreadsheet.
Creates an Excel file containing a summary of the number of molecules detected in each file of the experiment. Missing files are marked with -1. The file is saved as ‘number_of_molecules.xlsx’ in the main experiment directory.
- property file_paths#
List of relative file paths for all files in experiment
- Type:
list of pathlib.Path
- files_with_sequencing_match(files=None)#
- find_file_paths_and_extensions(paths)#
Find unique files in all subfolders and add them to the experiment
Get all files in all subfolders of the main_path and remove their suffix (extensions), and add them to the experiment.
Note
Non-relevant files are excluded e.g. files with underscores or ‘Analysis’ in their name, or files with dat, db, ini, py and yml extensions.
Note
Since sifx files made using spooling are all called ‘Spooled files’ the parent folder is used as file instead of the sifx file
- generate_tile_mappings(files_for_mapping, mapping_sequence_name=None, surface=0, name='All files')#
- histogram(axis=None, bins=100, parameter='E', molecule_averaging=False, fileSelection=False, moleculeSelection=False, makeFit=False, export=False, **kwargs)#
FRET histogram of all molecules in the experiment or a specified selection
- Parameters:
axis (
matplotlib.axis) – Axis to use for histogram plottingbins (
int) – Number of binsparameter (
str) – Parameter to be used for histogram I or Emolecule_averaging (
bool) – If True an time average of the trace is usedfileSelection (
bool) – If True the histogram is made only using selected files.moleculeSelection (
bool) – If True the histogram is made only using selected molecules.makeFit (
bool) – If True perform Gaussian fitting.export (
bool) – If True the graph is exported.**kwargs – Arbitrary keyword arguments.
- import_sequencing_data(file_path, index1_file_path=None, remove_duplicates=True, add_aligned_sequence=True, extract_sequence_subset=False, chunksize=10000, store_relative_filepath=True)#
- import_sequencing_data_for_mapping(file_path, surface=0)#
- import_sequencing_data_old()#
- load_darkfield_correction()#
Load darkfield correction images from disk.
Searches for darkfield correction TIFF files in the main experiment directory. If found, loads them and adds them to the common image corrections dataset. Updates all movie objects with the loaded corrections.
- load_flatfield_correction()#
Load flatfield correction images from disk.
Searches for flatfield correction TIFF files in the main experiment directory. If found, loads them and adds them to the common image corrections dataset. Updates all movie objects with the loaded corrections.
- property mapping_file#
Mapping file object from the experiment, if one exists.
Returns the first file marked as a mapping file. Returns None if no mapping file is found.
- Type:
- property nc_file_paths#
List of relative NetCDF file paths for all files in experiment
- Type:
list of pathlib.Path
- property number_of_channels#
Number of channels used in the experiment (read-only)
- Type:
int
- property pairs#
List of channel pairs
- Type:
list of list of str
- plot_trace(files=None, query={}, **kwargs)#
Plot molecule traces with interactive visualization.
Opens an interactive window to visualize and inspect molecule traces from NetCDF files. Allows filtering of molecules using a query.
- Parameters:
files (
FileCollection, optional) – Files to plot traces from. If None, uses all files in experimentquery (
dict, optional) – Query dictionary to filter molecules (default: {})**kwargs – Additional keyword arguments passed to TracePlotWindow
- print_files()#
Print a summary of all files in the experiment.
Outputs a formatted representation of all files currently loaded in the experiment.
- select()#
Simple method to look through all molecules in the experiment
Plots a molecule. If enter is pressed the next molecule is shown.
- property selectedFiles#
List of selected files
- Type:
list of File
- sequencing_match_info_mean(distance_threshold=25)#
- sequencing_match_info_per_file()#
- sequencing_matches(files=None)#
- show_sequencing_matches(show_file_coordinates=False)#
- property tile_mappings#
- property tile_mappings_dict#
- transform_sequencing_to_single_molecule_coordinates()#