saeyslab / CytoNorm

R library to normalize cytometry data
33 stars 6 forks source link

Arcsinh transform with a cofactor of 150 for Cytek Aurora data #42

Open rohitfarmer opened 1 year ago

rohitfarmer commented 1 year ago

Hi there,

I am working with the spectral flow data from Cytek Aurora. I am trying to figure out how to specify a cofactor of 150 for arcsinh transformation in the transformList() function. Any suggestions would be helpful.

Thanks, Rohit

SamGG commented 1 year ago

Hi,

My answer is not authoritative, Sofie or others will correct me.

transformList() is a flowCore function, so your question should be addressed to flowCore package. An even better place is the bioconductor support, because you don't report a bug in fact.

So, CytoNorm's readme shows the use of cytofTransf which is defined in CytoNorm. Its code could help you to set up your own transform. The code is below. NB: we also have to add a reverse transform. So functions for Cytek based on your choice is something like that:

cytekTransform <- flowCore::arcsinhTransform(transformationId="cytekTransform",
                                             a=0, b=(1/150), c=0)
cytofTransform.reverse <- function(x){
    return(sinh(x)*150)
}

We have to use the flowCore definition because this allows to the flwoCore infrastructure.

IMHO 150 is too low for Cytek, I would start with a cofactor of 3000 (e.g. Importing and Transforming Spectral Flow Cytometry Data in https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8640183/)

Best, Samuel

#' cytofTransform
#'
#' Arcsinh transformation with cofactor 5
#'
#' @param x Value to transform
#' @export
cytofTransform <- flowCore::arcsinhTransform(transformationId="cytofTransform",
                                             a=0, b=(1/5), c=0)

#' cytofTransform.reverse
#'
#' @param x Value to tranform
#' Function to reverse arcsinh transformation with cofactor 5
#'
#' @export
cytofTransform.reverse <- function(x){
    return(sinh(x)/(1/5))
}