how to get the result from each permutation in gr.ligrec
Hi there,
I am trying to get the result from each permutation in gr.ligrec, which is the mean expression of the ligand receptor pair in all interaction clusters. I thought it would be stored in the variable named res_means/mean around line 819 because the shuffling is happening here . But it seems not.
for _ in perms:
rs.shuffle(clustering)
test(interactions, interaction_clusters, data, clustering, mean, mask, res=res)
#pd.DataFrame(res_means).to_csv(
# '/res_mean' + str(_) + ".csv")
Do you have any suggestion on how to export those intermediate variables?
Thank you very much for you reply in advance.
hi @K10308 thanks for the interest in Squidpy, indeed that argument return the means of the non-permuted results, there is no way to return all permuted results, how would that be useful?
Because we would like to do a different type of FDR correction other than the ones have been provided, which requires all the permutated means. If you could pin point me where the permutated means are stored, and I could probably find a way to export it (like the code above in #),that would be great. @michalk8 (apology for asking for more help, I have noticed you made a lot of commit to this package, do you know a way to do that?). Thank you guys a lot in advance!
Hi @K10308 ,
res_means just stored the test statistic (the observed means). The simplest way to modify the code would be to do:
for _ in perms:
# initialize every loop to store the means
res = np.zeros((len(interactions), len(interaction_clusters)), dtype=np.float64)
rs.shuffle(clustering)
test(interactions, interaction_clusters, data, clustering, mean, mask, res=res)
pd.DataFrame(res).to_csv(f"perms/perm{_}.csv")
and modify this res[i, j] += (groups[c1, rec] + groups[c2, lig]) > (m1 + m2) to res[i, j] += (groups[c1, rec] + groups[c2, lig]) / 2 in here.
However, this will break the p-value calculation (which you don't need anyway).
closing due to inactivity
这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。