KrishnaswamyLab / MAGIC

MAGIC (Markov Affinity-based Graph Imputation of Cells), is a method for imputing missing values restoring structure of large biological datasets.
GNU General Public License v2.0
341 stars 97 forks source link

is here a potential bug? #185

Closed dustincys closed 4 years ago

dustincys commented 4 years ago

Hi, @scottgigante

here: https://github.com/KrishnaswamyLab/MAGIC/blob/master/python/magic/magic.py#L830

is it right t_opt = i

instead of t_opt = i + 1 ?

scottgigante commented 4 years ago

Thanks for checking! This is actually as designed -- the heuristic stops with t one higher than where the error drops below the threshold. This doesn't break the loop, so when we set t_opt it just runs the loop once more.

dustincys commented 4 years ago

Thank you for quick reply. I don't think that will runs the loop once more.

In the "last" loop, at the beginning, while here, i == t_opt -1, next, after here i == t_opt, if error < threshold , then here, i == t_opt-1 again.

until error > threshold.., I see. Thank you.

scottgigante commented 4 years ago

Thanks for checking! Line 829's and t_opt is None ensures that line 830 won't be run more than once, I believe.

dustincys commented 4 years ago

Thank you @scottgigante , that's right.