Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about differences between propr versions #23

Open
suzannejin opened this issue May 24, 2021 · 6 comments
Open

Question about differences between propr versions #23

suzannejin opened this issue May 24, 2021 · 6 comments
Labels
helpful This question has been marked as potentially helpful to others. question

Comments

@suzannejin
Copy link
Collaborator

Hi @tpq !
While running propr using an older version (v4.0.0), I found that for some datasets different coefficients were obtained in comparison to the latest propr version. May I ask if some latest changes that affect the computation of the proportionality coefficients were introduced or am I missing something here?

Below you have an example run on a single-cell dataset downloaded from Skinnider et al 2019 (https://github.com/skinnider/SCT-MoA/blob/master/data/geo/filtered/GSE51254.txt.gz)

get_perb_ori <- function(X) {
    if ('propr' %in% (.packages())) {
        detach('package:propr', unload=T)  # load propr 4.0.0
    }
    library(propr)
    print(packageVersion('propr'))
    rho = perb(X)
    return(rho@matrix)
}
get_perb_tpq <- function(X) {
    if ('propr' %in% (.packages())) {
        detach('package:propr', unload=T)
    }
    library(propr, lib.loc=paste0(.libPaths()[1], "/propr_tpq"))  # load newest propr version
    print(packageVersion('propr'))
    rho = perb(X)
    return(rho@matrix)
}

# load data and run propr
expr = read.delim("data/one-per-publication/GSE51254.txt.gz")
rho_ori = get_perb_ori(expr)
rho_tpq = get_perb_tpq(expr)
identical(rho_ori, rho_tpq)
# [1] FALSE
a = rho_ori[lower.tri(rho_ori)]
b = rho_tpq[lower.tri(rho_tpq)]
summary(a-b)
#     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
# -1.71878 -0.05474  0.03054  0.03111  0.11754  1.47488 
@tpq
Copy link
Owner

tpq commented May 24, 2021

Hello again! Thanks for a challenging question. I don't think there were any substantial changes, but I checked the source code and it seems I have updated the default zero-handling procedure. (Diff checker pasted below).

Could you try:

expr = read.delim("data/one-per-publication/GSE51254.txt.gz")
rho_ori = get_perb_ori(expr+1)
rho_tpq = get_perb_tpq(expr+1)
identical(rho_ori, rho_tpq)
a = rho_ori[lower.tri(rho_ori)]
b = rho_tpq[lower.tri(rho_tpq)]
summary(a-b)

and let me know what you get?

image

@suzannejin
Copy link
Collaborator Author

Thanks a lot Thom!!! The values are the same for both propr versions when using expr+1.

Now, I still have one question. The problem I have is that I am trying to benchmark on Skinnider's dataset, and I somehow failed to reproduce their values for rho and phs (whereas the other metrics like pearson, spearman, and zi_kendall, had no problem). Do you think that some part of the propr code might depend more on the working environment/ packages/ libraries / etc than the conventional stats::cor(mat, method = 'spearman', ...)?

@tpq
Copy link
Owner

tpq commented Jun 12, 2021

Ah, sorry! I never responded! Is it possible things changed from R 3.6 to R 4.0?

@tpq tpq changed the title Inconsistency between propr versions Question about differences between propr versions Jun 12, 2021
@tpq tpq added question helpful This question has been marked as potentially helpful to others. labels Jun 12, 2021
@suzannejin
Copy link
Collaborator Author

Hey Thom, sorry for the late response! I don't think the problem is between R 3.6 and R 4.0 since I have already tried on both R 3.5 and R 4.0+. I am currently checking with Skinnider to see where is the actual problem. I will keep you updated once we find out the cause

@AlSzmigiel
Copy link

Hi @suzannejin, did you manage to solve this problem? I know it was some time ago but I'm experiencing a similar issue right now.

@suzannejin
Copy link
Collaborator Author

Hey @AlSzmigiel what is the problem for you exactly? Do you find differences between different propr versions, or between different R versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
helpful This question has been marked as potentially helpful to others. question
Projects
None yet
Development

No branches or pull requests

3 participants