library(scpImaging)
.countCells()
function counts the image mask per image,
and returns a data frame with the cell counts per image.scpImaging
is a standalone R package for working with
micrographs generated during cellenONE-based single-cell preparations.
It has been designed around single-cell proteomics, and interfaces with
the scp
R package and workflows, but is standalone and can
be used with different workflows. I is designed to work any cell-based
data from the cellenONE.
The typical workflow for using ‘scpImaging’ is as follows:
library(scpImaging)
.scpAnnotator
(coming soon), or can be
the cell tables generated by the cellenONE instrument during the
run.cleanFilenames()
function is provided in case this has happened and is used to restore
filenames to their original state.cropImages()
function.npyMasksToPng()
function converts these to PNG files.countCells()
function counts the image mask per
image, and returns a data frame with the cell counts per image.Note: If you are just using scpImaging
for
doublet/multiplet detection you can stop at this point. If you wish to
use CellProfiler-based image analysis and/or iSEE visualisation you
should continue.
The custom Cellprofiler pipeline included with the
scpImaging
package is designed to work with the cropped
images generated by the cropImages()
function and the .png
masks generated in step 5.
The Cellprofiler pipeline is run. If default settings are
unchanged, this produces alternative overlay images that can be used if
preferred, as well as .csv files, the specific file of interest is
called ImageAttributesCellMask.csv
The cell data data.frame or singlecellexperiment object is
updated with filenames for the cropped images, mask images, overlay
images, as well as overlayed parent images using the
generateImageColumns()
or in the case of a
singlecellexperiment, with
generateImageColumnsSCE()
.
The cellprofiler data can be merged with the initial cell data
data.frame form the previous step, using the
addCellProfilerAttributes()
. Alternatively, if you have
already processed your singlecelldata in a singlecellexperiment or
qfeatures format, you can add the CellProfiler attributes to the
singlecelldata using the addCellProfilerAttributesSCE()
function as an alternative.
iSEE is an R Shiny-based app for interactive visualisation and
exploration of summerisedexperiment or singlecellexperiment objects. If
you use scp
-based workflows, your single-cell data will be
in an appropriate format for iSEE
-based use, allowing you
to easily visualise your data and potentially share with others in an
online format.
The core scpImaging
component for
iSEE
-based visualisation is the
cellenONEplot()
. It also makes use of the
overlayMask()
and overlayMaskOnParent()
functions to overlay the cell masks on the images, either as an outline
or as a transparent overlay.
Next the additional images with the overlay, and overlayed parent
images are generated with overlayMask
and
overlayMaskOnParent()
. These are saved as .png files. If
using the default settings, the filenames for these will have been
automatically generated in the previous step.
Finally use iSEE, along with the custom cellenONEplot(), to enable visualisation of your cellenONE images, and cell segmentation.
library(scpImaging)
.This will require install from github. We recommend using devtool::install_github, you will need to set up a github personal access token for this.
# install.packages("devtools") # if required
library("devtools")
## Loading required package: usethis
devtools::install_github("emmottlab/scpImaging")
## Using GitHub PAT from the git credential store.
## Downloading GitHub repo emmottlab/scpImaging@HEAD
## Skipping 5 packages not available: SingleCellExperiment, QFeatures, SummarizedExperiment, iSEE, S4Vectors
## ── R CMD build ────────────────────────────────────────────────────────────────────
## checking for file ‘/private/var/folders/9x/19yq9x6n5rg15t7v4hcv9dpm0000gn/T/RtmppRUO39/remotesf6954de8e588/emmottlab-scpImaging-f551f5fe82cbfbd999c2c2d544b5d35707ab0543/DESCRIPTION’ ... ✔ checking for file ‘/private/var/folders/9x/19yq9x6n5rg15t7v4hcv9dpm0000gn/T/RtmppRUO39/remotesf6954de8e588/emmottlab-scpImaging-f551f5fe82cbfbd999c2c2d544b5d35707ab0543/DESCRIPTION’
## ─ preparing ‘scpImaging’:
## checking DESCRIPTION meta-information ... ✔ checking DESCRIPTION meta-information
## ─ checking for LF line-endings in source and make files and shell scripts
## ─ checking for empty or unneeded directories
## Removed empty directory ‘scpImaging/user’
## ─ building ‘scpImaging_0.9.9.1.tar.gz’
##
##
library("scpImaging")
This can be either an sample annotation file from
scpAnnotator
:
dat <- read.csv('data/scp_sample_annotation_table_Full_cleaned.csv')
# Inspect the data frame
head(dat)
## RawFileName Channel CellType
## 1 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.1 Carrier
## 2 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.10 A549
## 3 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.11 A549
## 4 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.12 A549
## 5 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.13 A549
## 6 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.14 Control
## Background Circularity Date
## 1 NA
## 2 20241106_12441306_sample name_Background.png 1.02 06/11/2024
## 3 20241106_12441306_sample name_Background.png 1.04 06/11/2024
## 4 20241106_12441306_sample name_Background.png 1.03 06/11/2024
## 5 20241106_12441306_sample name_Background.png 1.08 06/11/2024
## 6 NA
## DetDiaMaxTrans DetDiaMinTrans Diameter DropNo EjBound Elongation Field
## 1 NA NA NA NA NA NA NA
## 2 28 15 23.21 2694 292 1.37 2
## 3 28 15 23.06 2805 292 1.52 2
## 4 28 15 20.44 2564 292 1.40 2
## 5 28 15 20.60 2656 292 1.77 2
## 6 NA NA NA NA NA NA NA
## ImageFile Intensity IsoDiaMaxFlu
## 1 NA NA
## 2 2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run.png 72.79 0
## 3 2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run.png 68.92 0
## 4 2564_Printed_T1_F2_R33_C3_(A-1)_Trans_samplename_Run.png 71.82 0
## 5 2656_Printed_T1_F2_R33_C7_(A-1)_Trans_samplename_Run.png 68.31 0
## 6 NA NA
## IsoDiaMaxTrans IsoDiaMinFlu IsoDiaMinTrans IsoIntMaxFlu IsoIntMaxTrans
## 1 NA NA NA NA NA
## 2 100 0 5 0 255
## 3 100 0 5 0 255
## 4 100 0 5 0 255
## 5 100 0 5 0 255
## 6 NA NA NA NA NA
## IsoIntMinFlu IsoIntMinTrans Plate SedBound Target Teg Time Well
## 1 NA NA NA NA NA
## 2 0 1 1 200 1 Transmission 12:52:54 A-1
## 3 0 1 1 200 1 Transmission 12:53:18 A-1
## 4 0 1 1 200 1 Transmission 12:52:22 A-1
## 5 0 1 1 200 1 Transmission 12:52:43 A-1
## 6 NA NA NA NA NA
## X XPos Y YPos
## 1 NA NA NA NA
## 2 426.96 9 125.26 30
## 3 443.44 13 122.74 30
## 4 365.63 3 102.16 33
## 5 419.54 7 142.05 33
## 6 NA NA NA NA
Or a cellenONE-generated cell table
These files have the file extension .xls, but is actually actually a tab-separated file. For each cell dispense run on a cellenONE, 4 .xls files are produced. You want the file that starts ‘Reordered_’ and ends ’_isolated.xls’.
datCellenONE <- read.delim('data/Reordered_20241106_12441306_sample name_isolated.xls', sep = '\t', header = TRUE)
# inspect the data frame
head(datCellenONE)
## DropNo X Y Diameter Elongation Circularity Intensity Teg
## 1 2 446.74 99.16 21.02 1.31 1.02 64.27 Transmission
## 2 9 452.09 108.99 22.05 1.50 1.04 72.22 Transmission
## 3 42 353.56 136.40 15.28 1.87 1.10 67.04 Transmission
## 4 51 432.10 96.52 19.25 2.07 1.13 78.51 Transmission
## 5 94 463.41 100.28 22.58 1.37 1.02 69.82 Transmission
## 6 98 366.26 136.21 22.91 1.61 1.06 78.50 Transmission
## Plate Well Target Field XPos YPos Date Time
## 1 1 A-1 1 1 1 14 06/11/2024 12:44:15
## 2 1 A-1 1 1 1 30 06/11/2024 12:44:17
## 3 1 A-1 1 1 1 46 06/11/2024 12:44:22
## 4 1 A-1 1 1 1 62 06/11/2024 12:44:24
## 5 1 A-1 1 1 3 17 06/11/2024 12:44:32
## 6 1 A-1 1 1 3 33 06/11/2024 12:44:33
## ImageFile
## 1 =HYPERLINK(2_Printed_T1_F1_R14_C1_(A-1)_Trans_samplename_Run.png)
## 2 =HYPERLINK(9_Printed_T1_F1_R30_C1_(A-1)_Trans_samplename_Run.png)
## 3 =HYPERLINK(42_Printed_T1_F1_R46_C1_(A-1)_Trans_samplename_Run.png)
## 4 =HYPERLINK(51_Printed_T1_F1_R62_C1_(A-1)_Trans_samplename_Run.png)
## 5 =HYPERLINK(94_Printed_T1_F1_R17_C3_(A-1)_Trans_samplename_Run.png)
## 6 =HYPERLINK(98_Printed_T1_F1_R33_C3_(A-1)_Trans_samplename_Run.png)
## Background EjBound SedBound
## 1 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## 2 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## 3 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## 4 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## 5 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## 6 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## DetDiaMinTrans DetDiaMaxTrans IsoDiaMinTrans IsoDiaMaxTrans IsoIntMinTrans
## 1 15 28 5 100 1
## 2 15 28 5 100 1
## 3 15 28 5 100 1
## 4 15 28 5 100 1
## 5 15 28 5 100 1
## 6 15 28 5 100 1
## IsoIntMaxTrans IsoDiaMinFlu IsoDiaMaxFlu IsoIntMinFlu IsoIntMaxFlu X.1 X.2 X.3
## 1 255 0 0 0 0 NA NA NA
## 2 255 0 0 0 0 NA NA NA
## 3 255 0 0 0 0 NA NA NA
## 4 255 0 0 0 0 NA NA NA
## 5 255 0 0 0 0 NA NA NA
## 6 255 0 0 0 0 NA NA NA
## X.4 X.5 X.6 X.7 X.8 X.9 X.10 X.11 X.12 X.13 X.14 X.15 X.16 X.17 X.18 X.19 X.20
## 1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 3 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 6 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## X.21 X.22
## 1 NA NA
## 2 NA NA
## 3 NA NA
## 4 NA NA
## 5 NA NA
## 6 NA NA
If you note, in this second example, the filenames in the ‘ImageFile’
and ‘Background’ columns are hyperlinks, we can clean these up using the
cleanFilenames()
function.
# Remove the hyperlinks from the filenames in the 'ImageFile' column
datCellenONE <- cleanFilenames(datCellenONE, 'ImageFile')
# And in the 'Background' column
datCellenONE <- cleanFilenames(datCellenONE, 'Background')
head(datCellenONE)
## DropNo X Y Diameter Elongation Circularity Intensity Teg
## 1 2 446.74 99.16 21.02 1.31 1.02 64.27 Transmission
## 2 9 452.09 108.99 22.05 1.50 1.04 72.22 Transmission
## 3 42 353.56 136.40 15.28 1.87 1.10 67.04 Transmission
## 4 51 432.10 96.52 19.25 2.07 1.13 78.51 Transmission
## 5 94 463.41 100.28 22.58 1.37 1.02 69.82 Transmission
## 6 98 366.26 136.21 22.91 1.61 1.06 78.50 Transmission
## Plate Well Target Field XPos YPos Date Time
## 1 1 A-1 1 1 1 14 06/11/2024 12:44:15
## 2 1 A-1 1 1 1 30 06/11/2024 12:44:17
## 3 1 A-1 1 1 1 46 06/11/2024 12:44:22
## 4 1 A-1 1 1 1 62 06/11/2024 12:44:24
## 5 1 A-1 1 1 3 17 06/11/2024 12:44:32
## 6 1 A-1 1 1 3 33 06/11/2024 12:44:33
## ImageFile
## 1 =HYPERLINK(2_Printed_T1_F1_R14_C1_(A-1)_Trans_samplename_Run.png)
## 2 =HYPERLINK(9_Printed_T1_F1_R30_C1_(A-1)_Trans_samplename_Run.png)
## 3 =HYPERLINK(42_Printed_T1_F1_R46_C1_(A-1)_Trans_samplename_Run.png)
## 4 =HYPERLINK(51_Printed_T1_F1_R62_C1_(A-1)_Trans_samplename_Run.png)
## 5 =HYPERLINK(94_Printed_T1_F1_R17_C3_(A-1)_Trans_samplename_Run.png)
## 6 =HYPERLINK(98_Printed_T1_F1_R33_C3_(A-1)_Trans_samplename_Run.png)
## Background EjBound SedBound
## 1 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## 2 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## 3 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## 4 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## 5 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## 6 =HYPERLINK(20241106_12441306_sample name_Background.png) 292 200
## DetDiaMinTrans DetDiaMaxTrans IsoDiaMinTrans IsoDiaMaxTrans IsoIntMinTrans
## 1 15 28 5 100 1
## 2 15 28 5 100 1
## 3 15 28 5 100 1
## 4 15 28 5 100 1
## 5 15 28 5 100 1
## 6 15 28 5 100 1
## IsoIntMaxTrans IsoDiaMinFlu IsoDiaMaxFlu IsoIntMinFlu IsoIntMaxFlu X.1 X.2 X.3
## 1 255 0 0 0 0 NA NA NA
## 2 255 0 0 0 0 NA NA NA
## 3 255 0 0 0 0 NA NA NA
## 4 255 0 0 0 0 NA NA NA
## 5 255 0 0 0 0 NA NA NA
## 6 255 0 0 0 0 NA NA NA
## X.4 X.5 X.6 X.7 X.8 X.9 X.10 X.11 X.12 X.13 X.14 X.15 X.16 X.17 X.18 X.19 X.20
## 1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 3 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 5 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## 6 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## X.21 X.22
## 1 NA NA
## 2 NA NA
## 3 NA NA
## 4 NA NA
## 5 NA NA
## 6 NA NA
The artifact has been removed from the ‘ImageFile’ and ‘Background’ columns.
This is performed using the cropImages()
function.
cropImages(dat, pixel_offset = 37,output_dir = 'croppedImages',input_dir = 'www',create_dir = TRUE)
The pixel offset tells the function how many pixels to crop from each
side of the image, so 37 pixels on each side will result in a 75x75
pixel image. The output_dir
is where the cropped images
will be saved, and input_dir
is where the original images
are located. The create_dir = TRUE
argument will create the
output directory if it does not already exist.
This will give a warning if ImageFiels are missing. Note if using scpAnnotator, this is expected, as you will have rows in the file for the Carrier, Reference, empty, and control channels. As this creates new files, it doesn’t actually return anything to the R environment.
A custom Cellpose-SAM model is used for this, and is available with the preprint/figshare (coming soon)
This step is performed in the terminal. If you have installed
Cellpose in a conda environment following the install instructions
available on the cellpose github, you can run the following command
in the terminal/console: conda activate cellpose
python -m cellpose --dir /DirWhereYourCroppedImageFilesAre --pretrained_model /DirWhereYouSavedTheCustomCPSAMModel/CPSAM_scpImaging_20250604 --verbose
The npyMasksToPng()
function converts these to PNG
files. While cellpose can save masks as .pngs directly, these are
typically too faint to see the masks directly. The
npyMasksToPng()
function converts the .npy files to .png
files. It makes use of the reticulate
library, and requires
a functional python/numpy installation.
npyMasksToPng(input_dir = 'data',output_dir = 'masks')
## Successfully converted 11 files from 'data' to 'masks'.
This will convert all .npy files in the input directory to .png files in the output directory. It will show errors if files are missing but will run.
countCells()
function counts the image mask per
image, and returns a data frame with the cell counts per image.# Call countcells
datCellCount <- countCells(path = 'www', suffix = '_cp_masks.png')
# Inspect the data frame
head(datCellCount)
## CP_Mask
## 1 cropped_10030_Printed_T1_F4_R46_C59_(A-1)_Trans_samplename_Run_cp_masks.png
## 2 cropped_10038_Printed_T1_F4_R62_C59_(A-1)_Trans_samplename_Run_cp_masks.png
## 3 cropped_1004_Printed_T1_F4_R40_C11_(A-1)_Trans_Hek_cells_Run_cp_masks.png
## 4 cropped_10062_Printed_T1_F4_R17_C61_(A-1)_Trans_samplename_Run_cp_masks.png
## 5 cropped_10080_Printed_T1_F4_R33_C61_(A-1)_Trans_samplename_Run_cp_masks.png
## 6 cropped_1009_Printed_T1_F1_R14_C37_(A-1)_Trans_samplename_Run_cp_masks.png
## CP_CellCount
## 1 1
## 2 1
## 3 1
## 4 1
## 5 1
## 6 1
Note: If you are just using scpImaging
for
doublet/multiplet detection you can stop at this point. If you wish to
use CellProfiler-based image analysis and/or iSEE visualisation you
should continue.
Please install Cellprofiler following the github instructions.
If default settings are unchanged, this produces alternative overlay
images that can be used if preferred, as well as .csv files, the
specific file of interest is called
ImageAttributesCellMask.csv
.
The only parts you may wish to change are the directories for saving
the output, in the ExportToSpreadsheet
,
ExportToDatabase
and SaveImages
modules.
These include the cropped images, mask images, overlay images, as
well as overlayed parent images using the
generateImageColumns()
or in the case of a
singlecellexperiment, with generateImageColumnsSCE()
.
The function takes a column as the initial filename source, and adds suffixes and prefixes to distinguish the different cropped images, mask files, and overlayed images.
# Inspect dat first
head(dat)
## RawFileName Channel CellType
## 1 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.1 Carrier
## 2 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.10 A549
## 3 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.11 A549
## 4 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.12 A549
## 5 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.13 A549
## 6 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.14 Control
## Background Circularity Date
## 1 NA
## 2 20241106_12441306_sample name_Background.png 1.02 06/11/2024
## 3 20241106_12441306_sample name_Background.png 1.04 06/11/2024
## 4 20241106_12441306_sample name_Background.png 1.03 06/11/2024
## 5 20241106_12441306_sample name_Background.png 1.08 06/11/2024
## 6 NA
## DetDiaMaxTrans DetDiaMinTrans Diameter DropNo EjBound Elongation Field
## 1 NA NA NA NA NA NA NA
## 2 28 15 23.21 2694 292 1.37 2
## 3 28 15 23.06 2805 292 1.52 2
## 4 28 15 20.44 2564 292 1.40 2
## 5 28 15 20.60 2656 292 1.77 2
## 6 NA NA NA NA NA NA NA
## ImageFile Intensity IsoDiaMaxFlu
## 1 NA NA
## 2 2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run.png 72.79 0
## 3 2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run.png 68.92 0
## 4 2564_Printed_T1_F2_R33_C3_(A-1)_Trans_samplename_Run.png 71.82 0
## 5 2656_Printed_T1_F2_R33_C7_(A-1)_Trans_samplename_Run.png 68.31 0
## 6 NA NA
## IsoDiaMaxTrans IsoDiaMinFlu IsoDiaMinTrans IsoIntMaxFlu IsoIntMaxTrans
## 1 NA NA NA NA NA
## 2 100 0 5 0 255
## 3 100 0 5 0 255
## 4 100 0 5 0 255
## 5 100 0 5 0 255
## 6 NA NA NA NA NA
## IsoIntMinFlu IsoIntMinTrans Plate SedBound Target Teg Time Well
## 1 NA NA NA NA NA
## 2 0 1 1 200 1 Transmission 12:52:54 A-1
## 3 0 1 1 200 1 Transmission 12:53:18 A-1
## 4 0 1 1 200 1 Transmission 12:52:22 A-1
## 5 0 1 1 200 1 Transmission 12:52:43 A-1
## 6 NA NA NA NA NA
## X XPos Y YPos
## 1 NA NA NA NA
## 2 426.96 9 125.26 30
## 3 443.44 13 122.74 30
## 4 365.63 3 102.16 33
## 5 419.54 7 142.05 33
## 6 NA NA NA NA
dat <- # Generate the image columns
datplus <- generateImageColumns(dat,source_column = "ImageFile")
# Inspect the dat containing the new columns
head(datplus)
## RawFileName Channel CellType
## 1 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.1 Carrier
## 2 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.10 A549
## 3 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.11 A549
## 4 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.12 A549
## 5 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.13 A549
## 6 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.14 Control
## Background Circularity Date
## 1 NA
## 2 20241106_12441306_sample name_Background.png 1.02 06/11/2024
## 3 20241106_12441306_sample name_Background.png 1.04 06/11/2024
## 4 20241106_12441306_sample name_Background.png 1.03 06/11/2024
## 5 20241106_12441306_sample name_Background.png 1.08 06/11/2024
## 6 NA
## DetDiaMaxTrans DetDiaMinTrans Diameter DropNo EjBound Elongation Field
## 1 NA NA NA NA NA NA NA
## 2 28 15 23.21 2694 292 1.37 2
## 3 28 15 23.06 2805 292 1.52 2
## 4 28 15 20.44 2564 292 1.40 2
## 5 28 15 20.60 2656 292 1.77 2
## 6 NA NA NA NA NA NA NA
## ImageFile Intensity IsoDiaMaxFlu
## 1 NA NA
## 2 2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run.png 72.79 0
## 3 2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run.png 68.92 0
## 4 2564_Printed_T1_F2_R33_C3_(A-1)_Trans_samplename_Run.png 71.82 0
## 5 2656_Printed_T1_F2_R33_C7_(A-1)_Trans_samplename_Run.png 68.31 0
## 6 NA NA
## IsoDiaMaxTrans IsoDiaMinFlu IsoDiaMinTrans IsoIntMaxFlu IsoIntMaxTrans
## 1 NA NA NA NA NA
## 2 100 0 5 0 255
## 3 100 0 5 0 255
## 4 100 0 5 0 255
## 5 100 0 5 0 255
## 6 NA NA NA NA NA
## IsoIntMinFlu IsoIntMinTrans Plate SedBound Target Teg Time Well
## 1 NA NA NA NA NA
## 2 0 1 1 200 1 Transmission 12:52:54 A-1
## 3 0 1 1 200 1 Transmission 12:53:18 A-1
## 4 0 1 1 200 1 Transmission 12:52:22 A-1
## 5 0 1 1 200 1 Transmission 12:52:43 A-1
## 6 NA NA NA NA NA
## X XPos Y YPos
## 1 NA NA NA NA
## 2 426.96 9 125.26 30
## 3 443.44 13 122.74 30
## 4 365.63 3 102.16 33
## 5 419.54 7 142.05 33
## 6 NA NA NA NA
## Cropped
## 1 /cropped_
## 2 cropped_2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run.png
## 3 cropped_2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run.png
## 4 cropped_2564_Printed_T1_F2_R33_C3_(A-1)_Trans_samplename_Run.png
## 5 cropped_2656_Printed_T1_F2_R33_C7_(A-1)_Trans_samplename_Run.png
## 6 /cropped_
## CP_Mask
## 1 /cropped__cp_masks
## 2 cropped_2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run_cp_masks.png
## 3 cropped_2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run_cp_masks.png
## 4 cropped_2564_Printed_T1_F2_R33_C3_(A-1)_Trans_samplename_Run_cp_masks.png
## 5 cropped_2656_Printed_T1_F2_R33_C7_(A-1)_Trans_samplename_Run_cp_masks.png
## 6 /cropped__cp_masks
## CP_Overlay
## 1 /cropped__cp_masks_overlay
## 2 cropped_2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run_cp_masks_overlay.png
## 3 cropped_2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run_cp_masks_overlay.png
## 4 cropped_2564_Printed_T1_F2_R33_C3_(A-1)_Trans_samplename_Run_cp_masks_overlay.png
## 5 cropped_2656_Printed_T1_F2_R33_C7_(A-1)_Trans_samplename_Run_cp_masks_overlay.png
## 6 /cropped__cp_masks_overlay
## CP_Overlay_Parent
## 1 /_parent_overlayed
## 2 2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run_parent_overlayed.png
## 3 2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run_parent_overlayed.png
## 4 2564_Printed_T1_F2_R33_C3_(A-1)_Trans_samplename_Run_parent_overlayed.png
## 5 2656_Printed_T1_F2_R33_C7_(A-1)_Trans_samplename_Run_parent_overlayed.png
## 6 /_parent_overlayed
addCellProfilerAttributes()
The cellprofiler data can be merged with the initial cell data
data.frame form the previous step, using the
addCellProfilerAttributes()
. Alternatively, if you have
already processed your singlecelldata in a singlecellexperiment or
qfeatures format, you can add the CellProfiler attributes to the
singlecelldata using the addCellProfilerAttributesSCE()
function as an alternative.
# read in Cellprofiler output as a data fram
cellProfilerDF <- read.csv('data/ImageAttributesCellMask.csv')
# add the cellprofiler attribues
datCP <- addCellProfilerAttributes(dat,cellProfilerDF, key1_col = 'Cropped', multiplet_handling = "takemaxarea")
# inspect datCP (note - this has a 'lot' of columns)
head(datCP)
## RawFileName Channel CellType
## 1 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.1 Carrier
## 2 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.10 A549
## 3 SH_20241118_WA10_SCoPE_HekvA549 Reporter.intensity.11 A549
## Background Circularity Date
## 1 NA
## 2 20241106_12441306_sample name_Background.png 1.02 06/11/2024
## 3 20241106_12441306_sample name_Background.png 1.04 06/11/2024
## DetDiaMaxTrans DetDiaMinTrans Diameter DropNo EjBound Elongation Field
## 1 NA NA NA NA NA NA NA
## 2 28 15 23.21 2694 292 1.37 2
## 3 28 15 23.06 2805 292 1.52 2
## ImageFile Intensity IsoDiaMaxFlu
## 1 NA NA
## 2 2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run.png 72.79 0
## 3 2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run.png 68.92 0
## IsoDiaMaxTrans IsoDiaMinFlu IsoDiaMinTrans IsoIntMaxFlu IsoIntMaxTrans
## 1 NA NA NA NA NA
## 2 100 0 5 0 255
## 3 100 0 5 0 255
## IsoIntMinFlu IsoIntMinTrans Plate SedBound Target Teg Time Well
## 1 NA NA NA NA NA
## 2 0 1 1 200 1 Transmission 12:52:54 A-1
## 3 0 1 1 200 1 Transmission 12:53:18 A-1
## X XPos Y YPos
## 1 NA NA NA NA
## 2 426.96 9 125.26 30
## 3 443.44 13 122.74 30
## Cropped
## 1 /cropped_
## 2 cropped_2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run.png
## 3 cropped_2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run.png
## CP_Mask
## 1 /cropped__cp_masks
## 2 cropped_2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run_cp_masks.png
## 3 cropped_2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run_cp_masks.png
## CP_Overlay
## 1 /cropped__cp_masks_overlay
## 2 cropped_2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run_cp_masks_overlay.png
## 3 cropped_2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run_cp_masks_overlay.png
## CP_Overlay_Parent
## 1 /_parent_overlayed
## 2 2694_Printed_T1_F2_R30_C9_(A-1)_Trans_samplename_Run_parent_overlayed.png
## 3 2805_Printed_T1_F2_R30_C13_(A-1)_Trans_samplename_Run_parent_overlayed.png
## ImageNumber ObjectNumber Metadata_Cell Metadata_Celltype Metadata_FileLocation
## 1 NA NA NA <NA> NA
## 2 434 1 2694 A549 NaN
## 3 454 1 2805 A549 NaN
## Metadata_Frame Metadata_Series
## 1 NA NA
## 2 0 0
## 3 0 0
## PathName_Image
## 1 <NA>
## 2 /Users/ed/Dropbox (Personal)/Shared/CellenONE_Images/20250430_CellposeAndMasks_A549HEK/cropA549
## 3 /Users/ed/Dropbox (Personal)/Shared/CellenONE_Images/20250430_CellposeAndMasks_A549HEK/cropA549
## AreaShape_Area AreaShape_BoundingBoxArea AreaShape_BoundingBoxMaximum_X
## 1 NA NA NA
## 2 1189 1681 57
## 3 1172 1558 57
## AreaShape_BoundingBoxMaximum_Y AreaShape_BoundingBoxMinimum_X
## 1 NA NA
## 2 59 16
## 3 57 19
## AreaShape_BoundingBoxMinimum_Y AreaShape_Center_X AreaShape_Center_Y
## 1 NA NA NA
## 2 18 35.96215 37.17073
## 3 16 37.19625 36.26962
## AreaShape_Compactness AreaShape_ConvexArea AreaShape_Eccentricity
## 1 NA NA NA
## 2 1.133259 1233 0.2365868
## 3 1.155768 1210 0.4393943
## AreaShape_EquivalentDiameter AreaShape_EulerNumber AreaShape_Extent
## 1 NA NA NA
## 2 38.90863 1 0.7073171
## 3 38.62948 1 0.7522465
## AreaShape_FormFactor AreaShape_MajorAxisLength AreaShape_MaxFeretDiameter
## 1 NA NA NA
## 2 0.8824111 39.58712 41.00000
## 3 0.8652253 40.82051 40.80441
## AreaShape_MaximumRadius AreaShape_MeanRadius AreaShape_MedianRadius
## 1 NA NA NA
## 2 18.35756 6.595175 5.830952
## 3 17.80449 6.548950 5.830952
## AreaShape_MinFeretDiameter AreaShape_MinorAxisLength AreaShape_Orientation
## 1 NA NA NA
## 2 37.16491 38.46325 20.18019
## 3 36.06245 36.66883 -21.12417
## AreaShape_Perimeter AreaShape_Solidity AreaShape_Zernike_0_0
## 1 NA NA NA
## 2 130.1249 0.9643147 0.8918783
## 3 130.4680 0.9685950 0.8919217
## AreaShape_Zernike_1_1 AreaShape_Zernike_2_0 AreaShape_Zernike_2_2
## 1 NA NA NA
## 2 0.031874507 0.0894998 0.01174639
## 3 0.006156418 0.0897222 0.04086960
## AreaShape_Zernike_3_1 AreaShape_Zernike_3_3 AreaShape_Zernike_4_0
## 1 NA NA NA
## 2 0.017906920 0.02310893 0.05987225
## 3 0.003308832 0.01039643 0.06007506
## AreaShape_Zernike_4_2 AreaShape_Zernike_4_4 AreaShape_Zernike_5_1
## 1 NA NA NA
## 2 0.005689543 0.02247195 0.002695254
## 3 0.022541938 0.01624120 0.001804554
## AreaShape_Zernike_5_3 AreaShape_Zernike_5_5 AreaShape_Zernike_6_0
## 1 NA NA NA
## 2 0.008158613 0.009665789 0.03009712
## 3 0.003299231 0.006105263 0.02961611
## AreaShape_Zernike_6_2 AreaShape_Zernike_6_4 AreaShape_Zernike_6_6
## 1 NA NA NA
## 2 0.006490190 0.008894775 0.007596248
## 3 0.007711745 0.008320940 0.008562346
## AreaShape_Zernike_7_1 AreaShape_Zernike_7_3 AreaShape_Zernike_7_5
## 1 NA NA NA
## 2 0.007562936 0.002597422 0.007069382
## 3 0.002708066 0.001710716 0.001908726
## AreaShape_Zernike_7_7 AreaShape_Zernike_8_0 AreaShape_Zernike_8_2
## 1 NA NA NA
## 2 0.007237763 0.008553746 0.005921814
## 3 0.005362452 0.007149288 0.009073054
## AreaShape_Zernike_8_4 AreaShape_Zernike_8_6 AreaShape_Zernike_8_8
## 1 NA NA NA
## 2 0.000728546 0.006574373 0.002809162
## 3 0.004678884 0.005595236 0.003440576
## AreaShape_Zernike_9_1 AreaShape_Zernike_9_3 AreaShape_Zernike_9_5
## 1 NA NA NA
## 2 0.010034860 0.005164440 0.002091510
## 3 0.002401634 0.003387106 0.004084932
## AreaShape_Zernike_9_7 AreaShape_Zernike_9_9 Granularity_10_Image
## 1 NA NA NA
## 2 0.005564030 0.006584147 0
## 3 0.001287279 0.001096391 0
## Granularity_11_Image Granularity_12_Image Granularity_13_Image
## 1 NA NA NA
## 2 0 0.2743788 4.314881
## 3 0 0.0000000 0.960523
## Granularity_14_Image Granularity_15_Image Granularity_16_Image
## 1 NA NA NA
## 2 4.552519 3.066922 0
## 3 11.667239 0.000000 0
## Granularity_1_Image Granularity_2_Image Granularity_3_Image Granularity_4_Image
## 1 NA NA NA NA
## 2 80.13203 4.8054173 0.6412438 0.4616994
## 3 83.17503 0.6457154 0.6993226 0.2354366
## Granularity_5_Image Granularity_6_Image Granularity_7_Image Granularity_8_Image
## 1 NA NA NA NA
## 2 0 0.7057011 0.4981777 0.0000000
## 3 0 0.7773975 0.9018684 0.9374636
## Granularity_9_Image Intensity_IntegratedIntensityEdge_Image
## 1 NA NA
## 2 0.5470271 51.89804
## 3 0.0000000 56.45098
## Intensity_IntegratedIntensity_Image Intensity_LowerQuartileIntensity_Image
## 1 NA NA
## 2 396.3961 0.2666667
## 3 382.8667 0.2392157
## Intensity_MADIntensity_Image Intensity_MassDisplacement_Image
## 1 NA NA
## 2 0.04313725 0.6129630
## 3 0.05490197 0.2855596
## Intensity_MaxIntensityEdge_Image Intensity_MaxIntensity_Image
## 1 NA NA
## 2 0.6509804 0.6509804
## 3 0.6784314 0.6784314
## Intensity_MeanIntensityEdge_Image Intensity_MeanIntensity_Image
## 1 NA NA
## 2 0.4761288 0.3333861
## 3 0.5085674 0.3266781
## Intensity_MedianIntensity_Image Intensity_MinIntensityEdge_Image
## 1 NA NA
## 2 0.3058824 0.3215686
## 3 0.2901961 0.3254902
## Intensity_MinIntensity_Image Intensity_StdIntensityEdge_Image
## 1 NA NA
## 2 0.1960784 0.10510359
## 3 0.1725490 0.09904796
## Intensity_StdIntensity_Image Intensity_UpperQuartileIntensity_Image
## 1 NA NA
## 2 0.1019016 0.3490196
## 3 0.1148566 0.3725490
## Location_CenterMassIntensity_X_Image Location_CenterMassIntensity_Y_Image
## 1 NA NA
## 2 35.36901 37.01612
## 3 36.93710 36.14968
## Location_CenterMassIntensity_Z_Image Location_Center_X Location_Center_Y
## 1 NA NA NA
## 2 0 35.96215 37.17073
## 3 0 37.19625 36.26962
## Location_MaxIntensity_X_Image Location_MaxIntensity_Y_Image
## 1 NA NA
## 2 18 41
## 3 55 35
## Location_MaxIntensity_Z_Image Number_Object_Number
## 1 NA NA
## 2 0 1
## 3 0 1
## RadialDistribution_FracAtD_Image_1of4 RadialDistribution_FracAtD_Image_2of4
## 1 NA NA
## 2 0.05198810 0.1613954
## 3 0.04180029 0.1489078
## RadialDistribution_FracAtD_Image_3of4 RadialDistribution_FracAtD_Image_4of4
## 1 NA NA
## 2 0.2743751 0.5122414
## 3 0.2686653 0.5406265
## RadialDistribution_MeanFrac_Image_1of4 RadialDistribution_MeanFrac_Image_2of4
## 1 NA NA
## 2 0.9509824 0.8967247
## 3 0.7654679 0.8271088
## RadialDistribution_MeanFrac_Image_3of4 RadialDistribution_MeanFrac_Image_4of4
## 1 NA NA
## 2 0.8473560 1.160105
## 3 0.8242821 1.230319
## RadialDistribution_RadialCV_Image_1of4 RadialDistribution_RadialCV_Image_2of4
## 1 NA NA
## 2 0.1025771 0.06857204
## 3 0.1505160 0.17389154
## RadialDistribution_RadialCV_Image_3of4 RadialDistribution_RadialCV_Image_4of4
## 1 NA NA
## 2 0.06598061 0.2116510
## 3 0.04277568 0.1884152
## RadialDistribution_ZernikeMagnitude_Image_0_0
## 1 NA
## 2 0.3324824
## 3 0.3256843
## RadialDistribution_ZernikeMagnitude_Image_1_1
## 1 NA
## 2 0.011273630
## 3 0.002338489
## RadialDistribution_ZernikeMagnitude_Image_2_0
## 1 NA
## 2 0.008348121
## 3 0.002740411
## RadialDistribution_ZernikeMagnitude_Image_2_2
## 1 NA
## 2 0.01314757
## 3 0.01539241
## RadialDistribution_ZernikeMagnitude_Image_3_1
## 1 NA
## 2 0.008112020
## 3 0.006593747
## RadialDistribution_ZernikeMagnitude_Image_3_3
## 1 NA
## 2 0.013547512
## 3 0.006677793
## RadialDistribution_ZernikeMagnitude_Image_4_0
## 1 NA
## 2 0.01652616
## 3 0.01942629
## RadialDistribution_ZernikeMagnitude_Image_4_2
## 1 NA
## 2 0.001012072
## 3 0.014076303
## RadialDistribution_ZernikeMagnitude_Image_4_4
## 1 NA
## 2 0.00892412
## 3 0.00587226
## RadialDistribution_ZernikeMagnitude_Image_5_1
## 1 NA
## 2 0.013092174
## 3 0.002567019
## RadialDistribution_ZernikeMagnitude_Image_5_3
## 1 NA
## 2 0.005961431
## 3 0.003117943
## RadialDistribution_ZernikeMagnitude_Image_5_5
## 1 NA
## 2 0.005164664
## 3 0.002979300
## RadialDistribution_ZernikeMagnitude_Image_6_0
## 1 NA
## 2 0.02082799
## 3 0.02258043
## RadialDistribution_ZernikeMagnitude_Image_6_2
## 1 NA
## 2 0.008868293
## 3 0.010315045
## RadialDistribution_ZernikeMagnitude_Image_6_4
## 1 NA
## 2 0.005042251
## 3 0.005148201
## RadialDistribution_ZernikeMagnitude_Image_6_6
## 1 NA
## 2 0.001985840
## 3 0.003919698
## RadialDistribution_ZernikeMagnitude_Image_7_1
## 1 NA
## 2 0.001809490
## 3 0.001558962
## RadialDistribution_ZernikeMagnitude_Image_7_3
## 1 NA
## 2 0.001814977
## 3 0.001771064
## RadialDistribution_ZernikeMagnitude_Image_7_5
## 1 NA
## 2 0.004050904
## 3 0.001973765
## RadialDistribution_ZernikeMagnitude_Image_7_7
## 1 NA
## 2 0.003382733
## 3 0.003013196
## RadialDistribution_ZernikeMagnitude_Image_8_0
## 1 NA
## 2 0.009719827
## 3 0.014086279
## RadialDistribution_ZernikeMagnitude_Image_8_2
## 1 NA
## 2 0.004150356
## 3 0.007369076
## RadialDistribution_ZernikeMagnitude_Image_8_4
## 1 NA
## 2 0.001774861
## 3 0.004379534
## RadialDistribution_ZernikeMagnitude_Image_8_6
## 1 NA
## 2 0.003758516
## 3 0.003165296
## RadialDistribution_ZernikeMagnitude_Image_8_8
## 1 NA
## 2 0.000920899
## 3 0.002863179
## RadialDistribution_ZernikeMagnitude_Image_9_1
## 1 NA
## 2 0.008473761
## 3 0.005150263
## RadialDistribution_ZernikeMagnitude_Image_9_3
## 1 NA
## 2 0.004220124
## 3 0.004536977
## RadialDistribution_ZernikeMagnitude_Image_9_5
## 1 NA
## 2 0.001535450
## 3 0.002502974
## RadialDistribution_ZernikeMagnitude_Image_9_7
## 1 NA
## 2 0.003186069
## 3 0.000482641
## RadialDistribution_ZernikeMagnitude_Image_9_9
## 1 NA
## 2 0.002620576
## 3 0.000412016
## RadialDistribution_ZernikePhase_Image_0_0
## 1 NA
## 2 1.570796
## 3 1.570796
## RadialDistribution_ZernikePhase_Image_1_1
## 1 NA
## 2 -1.716032
## 3 -2.845200
## RadialDistribution_ZernikePhase_Image_2_0
## 1 NA
## 2 -1.570796
## 3 1.570796
## RadialDistribution_ZernikePhase_Image_2_2
## 1 NA
## 2 -1.311389
## 3 -2.691358
## RadialDistribution_ZernikePhase_Image_3_1
## 1 NA
## 2 -0.7855592
## 3 0.1795423
## RadialDistribution_ZernikePhase_Image_3_3
## 1 NA
## 2 1.597222
## 3 -2.691046
## RadialDistribution_ZernikePhase_Image_4_0
## 1 NA
## 2 -1.570796
## 3 -1.570796
## RadialDistribution_ZernikePhase_Image_4_2
## 1 NA
## 2 -0.09842788
## 3 2.26895312
## RadialDistribution_ZernikePhase_Image_4_4
## 1 NA
## 2 2.1022442
## 3 0.5081971
## RadialDistribution_ZernikePhase_Image_5_1
## 1 NA
## 2 -0.1550901
## 3 2.5535366
## RadialDistribution_ZernikePhase_Image_5_3
## 1 NA
## 2 2.390081
## 3 -2.206446
## RadialDistribution_ZernikePhase_Image_5_5
## 1 NA
## 2 -0.4560941
## 3 1.3371254
## RadialDistribution_ZernikePhase_Image_6_0
## 1 NA
## 2 -1.570796
## 3 -1.570796
## RadialDistribution_ZernikePhase_Image_6_2
## 1 NA
## 2 2.059177
## 3 1.519081
## RadialDistribution_ZernikePhase_Image_6_4
## 1 NA
## 2 1.594045
## 3 1.988487
## RadialDistribution_ZernikePhase_Image_6_6
## 1 NA
## 2 2.4781450
## 3 0.8671422
## RadialDistribution_ZernikePhase_Image_7_1
## 1 NA
## 2 1.5918347
## 3 0.8272363
## RadialDistribution_ZernikePhase_Image_7_3
## 1 NA
## 2 -2.427995
## 3 -1.478113
## RadialDistribution_ZernikePhase_Image_7_5
## 1 NA
## 2 -0.0566152
## 3 -0.4282429
## RadialDistribution_ZernikePhase_Image_7_7
## 1 NA
## 2 2.240909
## 3 -1.171124
## RadialDistribution_ZernikePhase_Image_8_0
## 1 NA
## 2 -1.570796
## 3 -1.570796
## RadialDistribution_ZernikePhase_Image_8_2
## 1 NA
## 2 2.5637786
## 3 0.7681708
## RadialDistribution_ZernikePhase_Image_8_4
## 1 NA
## 2 1.880717
## 3 2.879748
## RadialDistribution_ZernikePhase_Image_8_6
## 1 NA
## 2 2.420144
## 3 1.453891
## RadialDistribution_ZernikePhase_Image_8_8
## 1 NA
## 2 1.472221
## 3 -2.307647
## RadialDistribution_ZernikePhase_Image_9_1
## 1 NA
## 2 2.458964
## 3 -2.920576
## RadialDistribution_ZernikePhase_Image_9_3
## 1 NA
## 2 -1.2491192
## 3 0.7933457
## RadialDistribution_ZernikePhase_Image_9_5
## 1 NA
## 2 0.5558402
## 3 -1.8358243
## RadialDistribution_ZernikePhase_Image_9_7
## 1 NA
## 2 2.201410
## 3 -1.880449
## RadialDistribution_ZernikePhase_Image_9_9
## 1 NA
## 2 1.480597
## 3 1.437536
## Texture_AngularSecondMoment_Image_3_00_256
## 1 NA
## 2 0.000964486
## 3 0.000794256
## Texture_AngularSecondMoment_Image_3_01_256
## 1 NA
## 2 0.000948679
## 3 0.000816316
## Texture_AngularSecondMoment_Image_3_02_256
## 1 NA
## 2 0.001034337
## 3 0.000882972
## Texture_AngularSecondMoment_Image_3_03_256 Texture_Contrast_Image_3_00_256
## 1 NA NA
## 2 0.000952810 792.5122
## 3 0.000851568 994.5167
## Texture_Contrast_Image_3_01_256 Texture_Contrast_Image_3_02_256
## 1 NA NA
## 2 731.4723 259.3152
## 3 900.4408 352.2157
## Texture_Contrast_Image_3_03_256 Texture_Correlation_Image_3_00_256
## 1 NA NA
## 2 759.7856 0.2159994
## 3 974.3694 0.1953313
## Texture_Correlation_Image_3_01_256 Texture_Correlation_Image_3_02_256
## 1 NA NA
## 2 0.2956141 0.7834957
## 3 0.3300636 0.7626356
## Texture_Correlation_Image_3_03_256 Texture_DifferenceEntropy_Image_3_00_256
## 1 NA NA
## 2 0.2750082 5.551043
## 3 0.2534232 5.884351
## Texture_DifferenceEntropy_Image_3_01_256
## 1 NA
## 2 5.563423
## 3 5.821462
## Texture_DifferenceEntropy_Image_3_02_256
## 1 NA
## 2 4.983217
## 3 5.190714
## Texture_DifferenceEntropy_Image_3_03_256
## 1 NA
## 2 5.497409
## 3 5.768561
## Texture_DifferenceVariance_Image_3_00_256
## 1 NA
## 2 1.422840e-04
## 3 9.000301e-05
## Texture_DifferenceVariance_Image_3_01_256
## 1 NA
## 2 1.329930e-04
## 3 9.700601e-05
## Texture_DifferenceVariance_Image_3_02_256
## 1 NA
## 2 0.000212198
## 3 0.000163538
## Texture_DifferenceVariance_Image_3_03_256 Texture_Entropy_Image_3_00_256
## 1 NA NA
## 2 0.000143919 10.25916
## 3 0.000109960 10.46999
## Texture_Entropy_Image_3_01_256 Texture_Entropy_Image_3_02_256
## 1 NA NA
## 2 10.27321 10.19586
## 3 10.44526 10.38084
## Texture_Entropy_Image_3_03_256 Texture_InfoMeas1_Image_3_00_256
## 1 NA NA
## 2 10.25099 -0.2807207
## 3 10.43095 -0.3096688
## Texture_InfoMeas1_Image_3_01_256 Texture_InfoMeas1_Image_3_02_256
## 1 NA NA
## 2 -0.2912231 -0.3128924
## 3 -0.3245953 -0.3465014
## Texture_InfoMeas1_Image_3_03_256 Texture_InfoMeas2_Image_3_00_256
## 1 NA NA
## 2 -0.2914595 0.9823046
## 3 -0.3268506 0.9891535
## Texture_InfoMeas2_Image_3_01_256 Texture_InfoMeas2_Image_3_02_256
## 1 NA NA
## 2 0.9848113 0.9885443
## 3 0.9912273 0.9935305
## Texture_InfoMeas2_Image_3_03_256 Texture_InverseDifferenceMoment_Image_3_00_256
## 1 NA NA
## 2 0.9847461 0.07214088
## 3 0.9914708 0.05122774
## Texture_InverseDifferenceMoment_Image_3_01_256
## 1 NA
## 2 0.06521553
## 3 0.06631301
## Texture_InverseDifferenceMoment_Image_3_02_256
## 1 NA
## 2 0.09700748
## 3 0.08110071
## Texture_InverseDifferenceMoment_Image_3_03_256 Texture_SumAverage_Image_3_00_256
## 1 NA NA
## 2 0.07024045 161.7842
## 3 0.06308334 155.7769
## Texture_SumAverage_Image_3_01_256 Texture_SumAverage_Image_3_02_256
## 1 NA NA
## 2 163.2041 164.8531
## 3 157.2408 159.6594
## Texture_SumAverage_Image_3_03_256 Texture_SumEntropy_Image_3_00_256
## 1 NA NA
## 2 162.7096 6.606917
## 3 156.8841 6.901415
## Texture_SumEntropy_Image_3_01_256 Texture_SumEntropy_Image_3_02_256
## 1 NA NA
## 2 6.546480 6.736256
## 3 6.892636 7.024115
## Texture_SumEntropy_Image_3_03_256 Texture_SumVariance_Image_3_00_256
## 1 NA NA
## 2 6.570275 1229.201
## 3 6.900686 1477.350
## Texture_SumVariance_Image_3_01_256 Texture_SumVariance_Image_3_02_256
## 1 NA NA
## 2 1345.436 2136.159
## 3 1787.697 2615.506
## Texture_SumVariance_Image_3_03_256 Texture_Variance_Image_3_00_256
## 1 NA NA
## 2 1336.198 505.4283
## 3 1635.863 617.9666
## Texture_Variance_Image_3_01_256 Texture_Variance_Image_3_02_256
## 1 NA NA
## 2 519.2270 598.8686
## 3 672.0345 741.9303
## Texture_Variance_Image_3_03_256
## 1 NA
## 2 523.996
## 3 652.558
## [ reached 'max' / getOption("max.print") -- omitted 3 rows ]
The above function relies on there being a ‘Cropped’ column in the
cell data data.frame, which is generated by the
generateImageColumns()
function run in step 7.
Typical ways to break this are to:
generateImageColumns()
iSEE
is an R Shiny-based app for interactive visualisation and exploration of
summerisedexperiment or singlecellexperiment objects. If you use
scp
-based workflows, your single-cell data will be in an
appropriate format for iSEE
-based use, allowing you to
easily visualise your data and potentially share with others in an
online format.
The core scpImaging
component for
iSEE
-based visualisation is the
cellenONEplot()
. It also makes use of the
overlayMask()
and overlayMaskOnParent()
functions to overlay the cell masks on the images, either as an outline
or as a transparent overlay.
Having generated the various filenames in step 7, , and overlayed
parent images are generated with overlayMask
and
overlayMaskOnParent()
. These are saved as .png files. If
using the default settings, the filenames for these will have been
automatically generated in the previous step.
overlayMask(image_input = 'croppedImages',mask_input = 'masks',output_target = 'overlays')
The default behavior over overlayMask is to produce an outline around any identified cells. An alternative is to produce a transparant overlay. This can be controlled using the ‘mode’ option where:
mode = "outline"
is the defaultmode = "overlay"
is an alternativeOutline and overlay colours can be controlled using:
outline_col = "cyan"
(default)overlay_col = "yellow"
(default)Outline line width and overlay transparancy can be controlled with the following options respectively:
outline_lwd = 2
(default)overlay_alpha = 0.4
(default)The overlayMaskOnParent()
function overlays the mask on
the parent image, and can be used in a similar way to
overlayMask()
, but it requires the cell data dataframe for
the necessary X and Y coordinates used for the original crop.
overlayMaskOnParent(parent_image_input = 'www',mask_input = 'masks',coord_df = dat,output_target = 'overlayParent')
## Found 872 unique parent image identifier(s) in coord_df$ImageFile.
## Finished processing. Successfully generated 11 output image(s) for 11 parent image(s), incorporating 11 mask overlays.
Typically, you would use the datCP sample annotation file from step
8, as your sample annotation file at the start of an
scp
-based single-cell workflow which would result the in
the production of a singlecellexperiment object,. For details on scp
please see the
scp bioconductor site.
As scp workflows are out of scope for this vignette, heres an singlecellexperiment object we made earlier…
# Load libraries
library("scp")
## Loading required package: QFeatures
## Loading required package: MultiAssayExperiment
## Loading required package: SummarizedExperiment
## Loading required package: MatrixGenerics
## Loading required package: matrixStats
##
## Attaching package: 'MatrixGenerics'
## The following objects are masked from 'package:matrixStats':
##
## colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
## colCounts, colCummaxs, colCummins, colCumprods, colCumsums, colDiffs,
## colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs, colMads, colMaxs,
## colMeans2, colMedians, colMins, colOrderStats, colProds,
## colQuantiles, colRanges, colRanks, colSdDiffs, colSds, colSums2,
## colTabulates, colVarDiffs, colVars, colWeightedMads,
## colWeightedMeans, colWeightedMedians, colWeightedSds,
## colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
## rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
## rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
## rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
## rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
## rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
## rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
## rowWeightedSds, rowWeightedVars
## Loading required package: GenomicRanges
## Loading required package: stats4
## Loading required package: BiocGenerics
## Loading required package: generics
##
## Attaching package: 'generics'
## The following objects are masked from 'package:base':
##
## as.difftime, as.factor, as.ordered, intersect, is.element, setdiff,
## setequal, union
##
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
##
## IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
##
## anyDuplicated, aperm, append, as.data.frame, basename, cbind,
## colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
## get, grep, grepl, is.unsorted, lapply, Map, mapply, match, mget,
## order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind,
## Reduce, rownames, sapply, saveRDS, table, tapply, unique, unsplit,
## which.max, which.min
## Loading required package: S4Vectors
##
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:utils':
##
## findMatches
## The following objects are masked from 'package:base':
##
## expand.grid, I, unname
## Loading required package: IRanges
## Loading required package: GenomeInfoDb
## Loading required package: Biobase
## Welcome to Bioconductor
##
## Vignettes contain introductory material; view with
## 'browseVignettes()'. To cite Bioconductor, see 'citation("Biobase")',
## and for packages 'citation("pkgname")'.
##
## Attaching package: 'Biobase'
## The following object is masked from 'package:MatrixGenerics':
##
## rowMedians
## The following objects are masked from 'package:matrixStats':
##
## anyMissing, rowMedians
##
## Attaching package: 'QFeatures'
## The following object is masked from 'package:base':
##
## sweep
library("iSEE")
## Loading required package: SingleCellExperiment
# Import singlecellexperiment object
sce <- readRDS("data/sce.rds")
# Read in the cellprofiler attributes again
cpAttDat <- read.csv('data/ImageAttributesCellMask.csv')
# Add these to the singlecellexperiment using addCellProfilerAttributesSCE()
sce <- addCellProfilerAttributesSCE(sce,cpAttDat)
# Configure your iSEE app
app <- iSEE(
sce,
initial = list(
ReducedDimensionPlot(),
ColumnDataTable(),
CellenONEPlot(YAxisSampleDynamicSource = TRUE)
),
appTitle = 'scpImaging: Demonstration with A549/HEK-293T dataset')
# To run the app, uncomment the following:
#shiny::runApp(app)
The iSEE shiny app has a range of possible panels, but the example
below just shows three, including the cellenONEplot()
panel.
Thats it!
You have now completed the scpImaging
pipeline, from
loading the package, to generating images, segmenting cells, and
visualising your data in iSEE.
Please report anything unclear or any errors by raisng a github issue.
sessionInfo()
## R version 4.5.1 (2025-06-13)
## Platform: aarch64-apple-darwin20
## Running under: macOS Sonoma 14.5
##
## Matrix products: default
## BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: Europe/London
## tzcode source: internal
##
## attached base packages:
## [1] stats4 stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] iSEE_2.20.0 SingleCellExperiment_1.30.1
## [3] scp_1.18.0 QFeatures_1.18.0
## [5] MultiAssayExperiment_1.34.0 SummarizedExperiment_1.38.1
## [7] Biobase_2.68.0 GenomicRanges_1.60.0
## [9] GenomeInfoDb_1.44.0 IRanges_2.42.0
## [11] S4Vectors_0.46.0 BiocGenerics_0.54.0
## [13] generics_0.1.4 MatrixGenerics_1.20.0
## [15] matrixStats_1.5.0 scpImaging_0.9.9.1
## [17] devtools_2.4.5 usethis_3.1.0
##
## loaded via a namespace (and not attached):
## [1] RColorBrewer_1.1-3 rstudioapi_0.17.1 jsonlite_2.0.0
## [4] shape_1.4.6.1 magrittr_2.0.3 magick_2.8.7
## [7] farver_2.1.2 rmarkdown_2.29 GlobalOptions_0.1.2
## [10] fs_1.6.6 vctrs_0.6.5 memoise_2.0.1
## [13] htmltools_0.5.8.1 S4Arrays_1.8.1 BiocBaseUtils_1.10.0
## [16] curl_6.4.0 SparseArray_1.8.0 sass_0.4.10
## [19] bslib_0.9.0 fontawesome_0.5.3 htmlwidgets_1.6.4
## [22] desc_1.4.3 plyr_1.8.9 listviewer_4.0.0
## [25] cachem_1.1.0 igraph_2.1.4 mime_0.13
## [28] lifecycle_1.0.4 iterators_1.0.14 pkgconfig_2.0.3
## [31] colourpicker_1.3.0 Matrix_1.7-3 R6_2.6.1
## [34] fastmap_1.2.0 GenomeInfoDbData_1.2.14 shiny_1.11.1
## [37] clue_0.3-66 fdrtool_1.2.18 digest_0.6.37
## [40] colorspace_2.1-1 patchwork_1.3.1 ps_1.9.1
## [43] rprojroot_2.0.4 pkgload_1.4.0 lpsymphony_1.36.0
## [46] httr_1.4.7 abind_1.4-8 mgcv_1.9-3
## [49] compiler_4.5.1 here_1.0.1 remotes_2.5.0
## [52] withr_3.0.2 doParallel_1.0.17 shinyAce_0.4.4
## [55] pkgbuild_1.4.8 MASS_7.3-65 DelayedArray_0.34.1
## [58] sessioninfo_1.2.3 rjson_0.2.23 tools_4.5.1
## [61] vipor_0.4.7 httpuv_1.6.16 glue_1.8.0
## [64] callr_3.7.6 nlme_3.1-168 promises_1.3.3
## [67] grid_4.5.1 rsconnect_1.5.0 cluster_2.1.8.1
## [70] reshape2_1.4.4 gtable_0.3.6 tidyr_1.3.1
## [73] metapod_1.16.0 XVector_0.48.0 ggrepel_0.9.6
## [76] foreach_1.5.2 pillar_1.11.0 stringr_1.5.1
## [79] later_1.4.2 rintrojs_0.3.4 circlize_0.4.16
## [82] splines_4.5.1 dplyr_1.1.4 lattice_0.22-7
## [85] tidyselect_1.2.1 ComplexHeatmap_2.24.1 miniUI_0.1.2
## [88] knitr_1.50 ProtGenerics_1.40.0 IHW_1.36.0
## [91] xfun_0.52 shinydashboard_0.7.3 DT_0.33
## [94] stringi_1.8.7 UCSC.utils_1.4.0 lazyeval_0.2.2
## [97] yaml_2.3.10 nipals_1.0 shinyWidgets_0.9.0
## [100] evaluate_1.0.4 codetools_0.2-20 MsCoreUtils_1.20.0
## [103] tibble_3.3.0 cli_3.6.5 xtable_1.8-4
## [106] reticulate_1.42.0 processx_3.8.6 jquerylib_0.1.4
## [109] Rcpp_1.1.0 png_0.1-8 parallel_4.5.1
## [112] ellipsis_0.3.2 ggplot2_3.5.2 profvis_0.4.0
## [115] AnnotationFilter_1.32.0 urlchecker_1.0.1 slam_0.1-55
## [118] viridisLite_0.4.2 scales_1.4.0 purrr_1.0.4
## [121] crayon_1.5.3 GetoptLong_1.0.5 rlang_1.1.6
## [124] shinyjs_2.1.0
© Ed Emmott 2025, emmottlab.org University of Liverpool.