This R package was developed to help organize and quantify the inForm Cell Analysis output for pixel-by-pixel, cell-by-cell, and tissue segmentation data. The primary goal of this package is to aid in the assessment and determination of optimum staining conditions for multiplex immunofluorescence titrations on Akoya’s scanning and staining platform. There are two primary functions of mIFTO
; FOP()
and mIFTOapp()
. FOP()
was designed to measure the ‘fractions of positivity’ for individual conditions. Then, with a unique identifier, the grouped conditions are exported together into a csv output file with the average fraction of positivity and a csv output file with the individual fractions of positivity per slide. The function uses the inForm output tables (IF or IHC) for cell segmented, colocalization data, or tissue segmented data as input. The other primary function, mIFTOapp()
, was developed to aid in determining an optimum condition for a series of reagent titrations. The output includes pixel histograms of intensity, t-statistics, signal-to-noise ratios, fractions of positivity, and boxplots of expression profiles.
Open an Rstudio session to get started. Next, install the package from github using the following commands:
detach("package:mIFTO", unload=TRUE)
It is helpful to run these lines before performing the installation incase the libraries are currently in use.
If it says "Error in detach("package:mIFTO", unload = TRUE) : invalid 'name' argument" this is ok.
install.packages("devtools")
The installation of ‘devtools’ is usually the most interactive and takes the longest. This is a provided R package which is used for external programmers to develop R packages. During the devtools
installation command (command 1 above), R may require some user input, examples of this include:
Errors are common in this step, usually when updating packages. If a package fails to update properly and crashes the installation process an error message is usually output beginning with: “Error: package ‘failed_package_name’
failed to install’. Installing the package separately may be necessary. Enter install.packages(‘failed_package_name’)
; replacing ‘failed_package_name’ with the name of the failed package.
For more advanced users of R, it may be easier to specify additional options during a package installation. For example, when installing ‘devtools’ the following options can be specified:
install.packages(‘devtools’, ask = FALSE, quiet = TRUE, verbose = FALSE)
This command will install ‘devtools’
without asking the user if it is okay to updated or compile a package and will carry out the procedures automatically. The command will also significantly reduce the output to the console.
library(devtools)
Warning messages like these are fine. Let me know if something else comes up. "1: package ‘devtools’ was built under R version 4.1.3" "2: package ‘usethis’ was built under R version 4.1.3"
install_github("AstroPathJHU/mIFTO")
1
to update all. - building 'mIFTO_2.00.196.tar.gz'
after the packages finish installing. The v.2.0...
number at the top of this page is the latest.
'vctrs' 0.5.1 is already loaded, but >= 0.6.0 is required
, try the following:
run install.packages("vctrs")
.
If it says Problem copying ... vctrs package location ... Permission denied
then you have to go into the location of your libraries and delete the vctrs
folder.
You can usually tell where the folder is from the outputs in RStudio. This user's libraries happen to be at C:\Users\cnajera2\Documents\R\R-4.1.1\library
Then install.packages("vctrs")
should work and you can resume updating mIFTO.
This applies to any other package, not just vctrs
. rlang
is another one that does this a lot.
If it doesn’t let you delete the folders, email ssotodi1@jh.edu
You should see something that says * DONE (mIFTO)
meaning that it installed correctly.
Note: When the package begins to install a number of messages will appear in the console indicating the status of different events, especially during the initial install or just after R has been updated, this is normal. Some of the messages may be in red, this does not indicate an error. If there is an error during installation, usually the output message to the console will start with “Error:”
or “Warning:”
, then describe the corresponding error.
The library(devtools)
call will only be needed the first time the mIFTO
package is used, unless additional updates to the package have been posted.
Once installed once for a user profile, the user can run the apps one of two ways:
library(current_package)
replacing ‘current_package’
for whichever library is needed. To load the mIFTO
R package type: library(mIFTO)
. Afterward call the apps using FOP()
and mIFTOapp()
.package_name::function_name
. For the main apps described in this document use mIFTO::FOP()
and mIFTO::mIFTOapp()
.Code performance is reliant on the local systems connection to the images as well as the computational resources of the local system. Since the image data for these images can be very large, it is advisable that either the images are kept local to the machine the software is run on or that they can be accessed by a high speed network connection.
Before attempting to update the package, run the following line and compare the version output with the version number at the top of this Readme. If they are the same, mIFTO does not need ot be updated.
packageVersion("mIFTO")
When an update for the package is available on github, it is advisable that, if the user already had an R session open with an old version running, the user clear their R history, completely close their current R session or window, and open a new session.
To clear the R history, go to the ‘history’ tab on the top right of the R user interface and select the broom icon, as shown below:
After the new R session is open, the advisable steps for updating the mIFTO R package would be the same as a new install:
install.packages(‘devtools’)
library(devtools)
install_github("AstroPathJHU/mIFTO")
For additional details see section 2.1. If the most up to date package is already installed under the current user profile the following message may appear instead:
A second installation may corrupt the package, in this case the following message will appear:
Once ‘OK’ is clicked, the following lines will be printed into the console (with a local R library path in place instead of bgreen42):
To fix this error, close the current R sessions completely, open a new session, and reinstall the package.
For mIFTO to process the data correctly, the files and folders must follow the proper naming conventions and the structures of the folders need to be correct. A full naming protocol for the scans can be found here.
For mIFTO, folders should also follow a specific naming convention. - IF - [PrimaryAntibody]_1to[ConcentrationofPrimaryAntibody]_[PolymerUsed]_Opal[OpalUsed]_1to[OpalConcentrationUsed] (e.g. 'PD1_1to150_PV50_Opal650_1to50') - IHC - '[Antibody]_IHC' (e.g. 'PD1_IHC')
For FOP, the folder names don't matter. What is important is grouping same titrations together such that the cases that have the same variables are in the same folder. This should result in each folder having one of each tissue type.
This function is used to measure the fraction of positivity across a subset of images for a uniquely named slide. The function is designed to count positivity for cell-by-cell, pixel-by-pixel, or tissue segmented data exported from inForm.
a. For cell-by-cell data: - use the 'Phenotyping' module of inform and export the 'RBG', 'Segmentation Maps (multi-image TIFF)' and 'Cell Segmentation Data'. Name the positive phenotype with the same name (case sensitive) as the input for ‘Primary Antibody’ in the GUI (see below). Name the negative phenotype 'Other'.
b. For pixel-by-pixel: - use the 'cClocalization' module of inForm to export the 'RBG', 'Component Images (multi-image TIFF)' and 'Colocalization Data'. Do not name the opals in the ‘prepare’ tab of inForm.
c. For tissue segmentation: - use the 'Segment Tissue' module in inForm to export the 'RBG', 'Segmentation Maps (multi-image TIFF)' and 'Tissue Segmentation Data'. Name the categories ‘Tumor’ and ‘Non Tumor’ in inForm.
For all exports, do not name the opals in the ‘prepare’ tab of inForm, the code will not be able to find the correct columns. Note that the code will generate statistics for all slides in the selected folder (see below for more details in step 5).
mIFTO::FOP()
& ENTER
Once finished running the app will idle in the background and continue to wait for input. To stop the UI, either close out the web browser or click the red ‘stop’ sign button just above the console window in RStudio and close the web browser.
This function is used to select optimum dilutions from a titration series. For a titration series, at least 3 cases with 10 HPFs each should be used. For best results stain at least 5 dilutions, one above and 4 below the manufactures recommended concentration.
The pixel-by-pixel analysis and cell-by-cell analyses are performed by separate modules in the app as usually one modality or the other is used to determine the optimal dilution. Once the slides have been stained and scanned, establish thresholds for pixel-by-pixel data or phenotype the data for cell-by-cell data in the respective modalities. For cell-by-cell analysis, export the cell segmented for each HPF. For pixel-by-pixel analysis export the component data images for each HPF. Dilutions\conditions can either be exported into separate or a single folder.
mIFTOapp
in R by click the red stop sign button in the RStudio console.Then rerun the app using ‘mIFTO::mIFTOapp()’
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.