I'm trying to reproduce OE score you produce in this study, which by the way is impressive !
The idea behind the OE was also recently reused elsewhere https://rdcu.be/czHtb.
I got some hints from ImmRes_OE.R but I don't understand this little part of code before the whole process, precisely the content of r$cd
. What does it stand for ? The raw counts data ? If you could highlight me a little bit on this, that could help me to understand this little preprocess.
If one value is inferior to zero, you use the raw counts contained in r$cd otherwise you transforme to counts but still your r$genes.mean
is computed from r$tpm
as r$zscores
.
You kind of mixing both approach with counts and tpm and i must say that I'm a bit lost here :/
Thanks.
if(any(r$tpm<0)){
print("Using counts to bin genes!!!")
r$genes.dist<-rowMeans(r$cd>0)
}else{
X<-10*((2^r$tpm)-1)
r$genes.dist<-log2(rowMeans(X,na.rm = T)+1)
}