Closed denvercal1234GitHub closed 1 year ago
Hi @denvercal1234GitHub
transFlowVS
before, but reading its vignette, the mathematics behind both functions look be the same, i.e. asinh(x/cofactor)
where x is the expression of a marker of a cell. do.asinh
several times, each specifying which marker and co-factor you want to transform. Something like the following where I want co-factor 5 for NK11, CD3, and CD45, but co-factor 11 for the rest. Note, the append.cf
is not essential. I only specified it as true so it is easier to later refer to what co-factor I used for what markers.library(Spectre)
x <- demo.start
# Assign some cell id so we can uniquely identify the cells for merging data.table later
x$CellID <- paste0("Cell_", seq_len(nrow(x)))
# Say cofactor 5 for NK11, CD3, CD45, and 11 for the rest
marker_cofactor_5 <- c("NK11", "CD3", "CD45")
marker_cofactor_11 <- c("Ly6G", "CD11b", "B220", "CD8a", "Ly6C", "CD4")
# Do the transformation
x_asinh_cofactor_5 <- do.asinh(x, use.cols=marker_cofactor_5, cofactor=5, append.cf=TRUE)
x_asinh_cofactor_11<- do.asinh(x, use.cols=marker_cofactor_11, cofactor=11, append.cf=TRUE)
# Recreate the data.table so we have raw data and the transformed data
# Subset the transformed data so it contains just the transformed columns and cell ID
x_asinh_cofactor_5 <- x_asinh_cofactor_5[, c("CellID", paste0(marker_cofactor_5, "_asinh_cf5")), with=FALSE]
x_asinh_cofactor_11 <- x_asinh_cofactor_11[, c("CellID", paste0(marker_cofactor_11, "_asinh_cf11")), with=FALSE]
# Combine them with the original data so we have the transformed and raw data together in one data.table
x_asinh <- merge.data.table(x,
merge.data.table(
x_asinh_cofactor_11,
x_asinh_cofactor_5, by='CellID'),
by='CellID')
head(x_asinh)
Hi @denvercal1234GitHub ,
Re: Question 2:
You could also just run multiple lines. For example, if you wanted to use 500 with CD3 and CD4, and 1000 with CD11b and CD45...
cell.dat <- do.asinh(cell.dat, use.cols = c('CD3', 'CD4'), cofactor = 500)
cell.dat <- do.asinh(cell.dat, use.cols = c('CD11b', 'CD45'), cofactor = 1000)
If you then look at cell.dat, the last four columns would be CD3_asinh
, CD4_asinh
, CD11b_asinh
, and CD45_asinh
.
Hi there,
Thanks for the package and detailed tutorials.
I used flowVS to decide cofactor for each channel and exported the transformed data as FCS files. I attempted doing so as shown in https://github.com/HdBraanker/Spectral_Flow_Workflow/issues/3.
Question 1. Does the
flowVS::transFlowVS()
function perform the same transformation as theSpectre::do.asinh()
?Question 2. How may I use a different cofactor for each channel in the
Spectre::doasinh()
?Thanks again.
Related Discussion #95