const-ae / transformGamPoi-Paper

GNU General Public License v3.0
26 stars 7 forks source link

Best Performing method #3

Closed cakeinspace closed 1 year ago

cakeinspace commented 1 year ago

Hey thanks for the code its super useful. From what I understand the best performing method in the consistency is the logp1. Which is simply $log(\frac{n_{gc} \bar N_c}{N_c} + 1)$ where $N_c$ is the total umi count of a cell and $\bar N_c$ is the mean of total umis across all cells. This is given by the logp1 function in the transformation_helpers.R code right. The transformGamPoi repository defines the shifted log transform method. From my understanding this divides the umi counts by the size factor of each cell which in this methods case is the total umi / mean of total umi across all cells and then does log(1 + transformed_umi). Am i right in this. Thanks a lot for your help. The code has been really useful to learn about all the different transformation methods

cakeinspace commented 1 year ago

Also just another thing if logp1 is in fact the best performing method then I need to be passing alpha = 0 to this right

const-ae commented 1 year ago

Hey,

From what I understand the best performing method in the consistency is the logp1. Which is simply $log(\frac{n_{gc} \bar N_c}{N_c} + 1)$ where $N_c$ is the total umi count of a cell and $\bar N_c$ is the mean of total umis across all cells.

Well, the $\text{acosh}(2\alpha y /s + 1)$ transformation performs even better in the consistency benchmark, but the $log(y/s+1)$ performs quite well too (See Fig. 2A).

From my understanding this divides the umi counts by the size factor of each cell which in this methods case is the total umi / mean of total umi across all cells and then does log(1 + transformed_umi). Am i right in this.

Yes, this is essentially what the transformation does. To be 100% precise, the logp1_fnc calls transformGamPoi::shifted_log_transform which calculates

1/sqrt(alpha) * log1p(4 * alpha * x)

where alpha = 1/(4 * pseudocount). As you see the 1/sqrt(alpha) scales the result by 0.5 for a pseudocount of 1. This scaling does not affect the variance stabilization and is there to make it the results consistent with the acosh transformation.

Also just another thing if logp1 is in fact the best performing method then I need to be passing alpha = 0 to this right

No, the alpha argument of the internal logp1_fnc is ignored! You should just use the transformGamPoi::shifted_log_transform or transformGamPoi::acosh_transform functions.