rezakj / iCellR

Single (i) Cell R package (iCellR) is an interactive R package to work with high-throughput single cell sequencing technologies (i.e scRNA-seq, scVDJ-seq, scATAC-seq, CITE-Seq and Spatial Transcriptomics (ST)).
121 stars 19 forks source link

data.scale question #36

Open gianfilippo opened 1 year ago

gianfilippo commented 1 year ago

Hi,

does the data.scale function process raw counts or normalized data ?

Thanks

rezakj commented 1 year ago

Hi, this function scales the normalized data but it dose not replace it (puts it in another data slot). Therfore, this function is really un-necessary because all the downstream funtions that require sacled data (like plots or running PCA, etc.) they do so on the fly and keep the normalized data as is.

This is because at the DE step the fold changes are calculated from the normalized data and not transformed (log, etc.) data.

gianfilippo commented 1 year ago

Hi,

thanks. I am asking really because I tried to make a number of the functions from your package compatible with a Seurat object and functions, and I am testing them.

This is still work in progress, though.

I was not sure about the main.data slot. My understanding is that it takes the normalized data (while the raw.data is for counts).

Anyway, I normalized the raw counts with the modified norm.data iCellR function, and I wanted to scale the data, but I ended up with values as well as many NaNs, so I was trying to figure out if I had made a mistake in the conversion of the normalize function.

In your run.pca function you have TopNormLogScale <- log(TopNormLogScale + plus.log.value) when scale.data is TRUE, but your data.scale function has NormLog = log2(DATA + 1) NormLog = as.data.frame(t(NormLog)) TopNormLogScale <- t(scale(NormLog, center = F))

I think this is confusing for me. Can you please explain ?

Thanks