Python/R code for cross-analyzing fluorescence and semantic segmentation results to calculate statistics for development of specific transgenic plant tissues
This repository contains R and Python scripts used in the final module of the GMOdetector workflow for studying plant transformation with complementary semantic segmentation (RGB or reflectance-hyperspectral) and fluorescence-hyperspectral datasets. The scripts contained here are used to cross-reference semantic segmentation masks (with tissues segmented according to their type, e.g. callus and shoot) with weights from regression of fluorescent hyperspectral images over known components (e.g. chlorophyll and GFP) obtained from CubeGLM. Outputs produced include summary statistics of fluorescent protein signal in specific tissues, and p-values for the effects on these statistics by experimental treatment, genotype and interactions thereof.
These scripts are not intended for use outside of the GMOdetector workflow. This readme will provide a basic explanation of how these scripts are used in this workflow.
The main
function is used to integrate outputs from semantic segmentation and (CubeGLM)[https://github.com/naglemi/gmodetector_py]. Below is an example of how this function is used:
python main.py \
<complementary_image_paths.csv> \ # string
<my_aligned_grid.jpg> \ # string
<my_reporter_significance_threshold> \ # integer
<my_reporter_protein_ID> \ # string
<grid_type_integer> \ # integer, "12" or "20"; 12-explant or 20-explant grids supported
<output_format_string> \ #string, "hdf" or "csv"
<output_directory_path> \ # string
<my_grid_borders> # string
The parameters for this function are described in documentation for the GMOdetector workflow:
- Preparing alignment for grid and finding grid borders
- Fluorescent protein settings
- Producing spreadsheet of corresponding RGB or reflectance-hyperspectral images, segmentation masks and fluorescence-hyperspectral weights (Main workflow, section "Prepare sample datasheet input")
To read docstring
documentation for parameters in this Python script, enter Python, load the function and enter help(main)
.
The grid_item_plots.R
script is used to take outputs from the main
function, produce plots and perform tests. Below is an example of basic use:
Rscript grid_item_plots.R \
-d <my_data_folder> \ # string
-r <my_metadata_spreadsheet.xlsx> \ # string
--pixel_threshold <my_reporter_significance_threshold> \ # integer
--missing <if_some_explants_missing_or_contaminated> \ # logical
--MissingList <missing_explant_dataframe> \ # output from missing/contaminated explant script or user manual input
--grid_type <grid_type_integer> \ # integer, "12" or "20"; 12-explant or 20-explant grids supported
--samples-pre-labeling <complementary_image_paths.csv> \ # string
--height <my_plot_height> \ # integer
--width <my_plot_width> \ # integer
--Reporter <my_reporter_protein_ID> \ # string
The additional parameters used here are also described in GMOdetector workflow documentation.
To read Roxygen2
descriptions of these parameters, call Rscript grid_item_plots.R --help
.
Please see the tutorials and examples on reading and interpreting plots and statistical outputs, part of the main repository for the GMOdetector workflow.
We thank the National Science Foundation Plant Genome Research Program for support (IOS #1546900, Analysis of genes affecting plant regeneration and transformation in poplar), and members of GREAT TREES Research Cooperative at OSU for its support of the Strauss laboratory.