diff --git a/002_Automated_PPTX_PLA/app.py b/002_Automated_PPTX_PLA/app.py
index 47175a2..6144687 100644
--- a/002_Automated_PPTX_PLA/app.py
+++ b/002_Automated_PPTX_PLA/app.py
@@ -5,8 +5,8 @@
eduardo_reyes09@hotmail.com
App version:
- V04 (Nov 09, 2023): Fixed path handling so it works on / and \ systems. Improved download
- buttons so they do not dissapear anymore.
+ V05 (Dec 02, 2023): Customized the second and third app pages and reviewed their information.
+ Fixed path bug giving wrong slide titles.
'''
###################################################################################################
@@ -42,19 +42,21 @@
page_icon=":newspaper:",
layout="wide")
-st.title("Pptx generator for PLA results")
+st.markdown('''
+ # PPTX generator for PLA results
+ ''', unsafe_allow_html=True)
st.write("---")
# Make a menu of pages on the siderbar, since the app is simple but requires lots of specific details
with st.sidebar:
- selected_page = option_menu("Main Menu", ["Generate pptx", "How to use the app", "Info on pptx design"],
+ selected_page = option_menu("App Menu", ["Generate pptx", "How to use this app", "Info on pptx design"],
icons=["filetype-pptx", "patch-question-fill", "columns-gap"], menu_icon="cast", default_index=0)
# Check the selected app page and call the corresponding function to display its content
def change_pages():
if selected_page == "Generate pptx":
load_first_page()
- elif selected_page == "How to use the app":
+ elif selected_page == "How to use this app":
load_second_page()
else:
load_third_page()
@@ -92,7 +94,7 @@ def process_files():
exp_conditions_info = []
for csv_file in all_csv_files:
- csv_root_folder = os.path.normpath(csv_file.split("Data")[1].split("Quantification")[0])[1:]
+ csv_root_folder = os.path.normpath(csv_file).split(os.path.sep + "Data" + os.path.sep)[1].split(os.path.sep + "Quantification")[0]
exp_conditions_info.append([csv_root_folder, csv_file])
# We will store all the information of the images to insert to the ppt here
@@ -389,80 +391,152 @@ def load_first_page():
def load_second_page():
st.markdown('''
- ## Function of the notebook
-
- This notebook takes any number of Proximity Ligation Assay (PLA) images that were cropped
- and quantified, and prepares a summary Power Point presentation with the results of the
- experiment. In the presentation we will find:
-
- 1. Slides for each experimental condition / group (separated), and also separated based
- on the original image they were croped from (if big images were taken with multiple cells,
- the same condition will have multiple cells/ROIs originated from the same original image).
-
- 2. Each slide shows pairs of fluorescence images of the cells selected with their ROI name
- and next to it there is the corresponding image of the quantification of puncta for that
- ROI and the label corresponds to the number of puncta given by the method used (Find Maxima
- or Threshold).
-
- 3. The key is that we can quickly preview in one single file all the cell morphologies we
- picked to analyze, and verify the numbers match what we would expect just looking at the
- puncta in the cell by eye. If the cells look too bad in the fluorescence images, we can
- find the number that corresponds to that cell in the results file and discard it. Also, we
- can evaluate the work of the quantification methods since all the black noise in those
- quantification images correspond to ignored pixels (didn't meet the criteria) and only the
- coloured ones were quantified. Controls should have barely any black or coloured particles
- in the images (and thus low number P=), but the other conditions were we look for
- interactions may have or not more black noise, coloured puncta, and numbers that match with
- what our eyes can see.
-
- ''')
+ ## Purpose of this app
+
+
+
+ This app takes a compressed file with any number of **Proximity Ligation Assay (PLA)**
+ images that were cropped and quantified (see requirements), and prepares a summary
+ Power Point presentation with the results. The slides show for each image:
+
+
+ 1. The Fluorescence image used to quantify, with their name below.
+
+ 2. The Particle mask image obtained during the quantification, with their counts below.
+
+
+
+ The idea is that we can quickly preview in one single file all the cell morphologies we
+ picked to analyze, and verify whether the particle counts obtained match what we would
+ expect. This way, we can quickly identify when the selected parameters for quantification
+ produce more/less particles than what we observe in the original fluorescence image.
+
+ By using the PPTX, we can quickly review all the images and quantification results side
+ by side without having to open hundreds of individual images and trackig their names and
+ quantification results from the output Excel file.
+
+ In addition, we can compare two different quantification approaches (Thresholding vs Find
+ Maxima), and identify possible issues such as:
+
+ - Noisy fluorescent images.
+
+ - More particles identified than expected.
+
+ - Less particles identified than expected.
+
+ - Particles identified seem fine but there are several
+ black/not coloured (didn't meet criteria to be counted).
+
+ These and other problems can be easily identified with the help of the summary PPTX and
+ either lead to the selection of a quantification approach (Thresholding or Find Maxima),
+ or prompt the user to repeat the quantiication step with different parameters. The most
+ common fixes to these issues include changing: thresholding method, prominence value,
+ particle size + circularity, rolling radius of background subtraction, etc.
+
+
+ ''', unsafe_allow_html=True)
st.write("---")
st.markdown('''
- ## Requirements of the notebook
+ ## Requirements
+
+
- Since this notebook was created specifically to generate a results report for experiments of
- the author's PLA experiments, the requirements are just to upload a new pptx file with a
- blank slide (just empty), making sure to click in Power Point: Design-> Slide Size ->
- Widescreen (16:9), and the compressed zip file called "Data", which should contain all the
+ This app was created specifically to generate a result's report for experiments of the
+ author's PLA experiments, the only requirement is to upload a compressed zip file. The
+ file must not be heavier than 500 MB (if so, you can edit the config.toml file).
+ Alternatively, you can make multiple compressed files (all named "Data.zip") and run
+ the app for each of them separately.
+
+ The quantification is done using the following script for ImageJ/Fiji, which is part
+ of a workflow so it also requires specific image + folder structures:
+ [PLA Quantification Script](
+ https://github.com/EdRey05/Resources_for_Mulligan_Lab/blob/b80eaf75d35665aeb4b7e60ed85685f342d9f125/Tools%20for%20PLA%20quantification/PLA_quantification.py)
+
+ To create the zip file, it is recommended to first create a "Data" folder, then create
+ a subfolder for each experimental condition to include, transfer to each subfolder the
+ required files and finally compress the "Data" folder into a .zip file. This way, the
+ zip file will be called "Data" and contain a "Data" folder, which should contain the
following:
- 1. A folder called "Data" (1st level).
+
+
- 2. Any number of subfolders (2nd level) corresponding to each experimental condition that you
- want to include in the same summary presentation.
+ 1. Any number of subfolders corresponding to each experimental condition to include in
+ the PPTX.
- 3. Each 2nd level subfolder can have a unique name, but their content should have the same
- structure: 2 folders (3rd level), one called "Cropped cells", and the other "Quantification".
- Both of these were produced from the processed images by the author's script V03:
- https://github.com/EdRey05/Resources_for_Mulligan_Lab/blob/b80eaf75d35665aeb4b7e60ed85685f342d9f125/Tools%20for%20PLA%20quantification/PLA_quantification.py
+ 2. Each condition subfolder has a unique name, but they all should have the same
+ content: 1 folder called "Cropped cells", and 1 folder called "Quantification". Both
+ of these are produced by the quantification script.
- 4. The Cropped cells folder contains 3 folders (4th level) called "Fluorescence", "FM_Particles",
- and "T_Particles". They all have subfolders with the names Row_01_05... to Row_45_51 on the 5th
- level. The Fluorescence folder has ROIs (6th level) of cells in the form of "Number_2.jpg" and
- the other 2 folders "Number_1.jpg", which refer to the same cell (one ROI used to make the
- presentation, other to quantify).
+ 3. The "Cropped cells" folder should contain 3 folders: "Fluorescence", "FM_Particles",
+ and "T_Particles". Each of these should have subfolders with the names Row_01_05... to
+ Row_45_51. The "Fluorescence" folder contains ROIs for individual cells with an ID number
+ ("Number_2.jpg"). The "FM_Particles" and "T_Particles" folders have the same content of
+ a different set of ROIs with an ID number ("Number_1.jpg").
- 5. The Quantification folder (4th level) has only one csv file with the results of the
+ 4. The "Quantification" folder should only have a csv file with the results of the
quantification.
-
- ''')
+
+
+
+
+ Here you can find an example zip file that contains the folders and files mentioned above
+ for a few experimental conditions of a real PLA experiment (the download button is on the
+ right side, between the "Raw" button and the pencil button):
+ [Example zip file](
+ https://github.com/EdRey05/Resources_for_Mulligan_Lab/blob/caf95fc217cb1c65b4a0b28449c84b35ec10e2fe/Tools%20for%20students/Eduardo%20Reyes/Data.zip)
+
+
+
+ ''', unsafe_allow_html=True)
st.write("---")
st.markdown('''
- ## Outputs of the script
-
- The current version of this notebook produces 2 pptx files, one using the fluorescence images +
- the find maxima images, and the second one using the same fluorescence images but with the
- thresholded images. Ideally, we would want to examine both to check which works better, since
- under ideal conditions both give very similar results, but raw image quality and processing
- can create some differences within a condition or experiment so using the same threshold method
- will cause a lot of artifacts in some images (find maxima uses a different principle, more
- insensitive to these variability).
-
- ''')
+ ## Outputs
+
+
+
+ The current version of this notebook produces 2 .pptx files, one using the fluorescence
+ images + the particle mask images prouced by the ***Find Maxima*** approach, and the
+ second one using the fluorescence images + the particle mask images produced by the
+ ***Thresholding*** approach.
+
+ Ideally, we would want to examine both to check which quantification approach works
+ better for the experiment of interest. Under ideal conditions both approaches give very
+ similar results. However, the fluorescence image quality is the main factor that
+ influences the results provided by both approaches, which use different principles to
+ find the particles.
+
+ For these reasons, we want not only to compare both PPTX summaries, but it is also
+ crucial to evaluate consistency in particle detection within each PPTX. Some experimental
+ conditions may have more/less background noise or number of particles than other
+ conditions, and this may lead to incorrect particle detection and quantification for
+ some conditions but not for others. However, the quantification and results report
+ generation are fully automated so that both parts of the workflow can be easily repeated
+ to find the most appropriate quantification parameters for each condition and each
+ experiment.
+
+ Furthermore, this app automatically detects experimental conditions and organizes the
+ slides as follows:
+
+
+ -Each experimental condition is shown in a separate slide. Up to 20 pairs of cell images
+ can fill each slide. If more slides are needed for a condition, they will all have the
+ same title (top-left).
+
+ -If big images containing multiple cells were acquired for each condition,
+ subfolders for each those are created during the quantification. The app identifies
+ this and makes multiple slides with the same title, but different subtitle (top-right).
+
+ NOTE: If you want to see the format of these PPTX presentations, download the
+ example zip file (link above) and run the app with it.
+
+
+
+ ''', unsafe_allow_html=True)
return
###################################################################################################
@@ -473,147 +547,243 @@ def load_third_page():
st.markdown('''
-
Automating the generation of Power Point presentations with our layout is done
+ using the python-pptx library.
+ For more information on this library, see:
+ python-pptx (Pypi)