MPIIComputationalEpigenetics / WSHPackage

R package for the calculation of the following Within-Sample Heterogeneity Scores in Bisulfite Sequencing Data: FDRP, qFDRP, PDR, Epipolymorphism, Methylation Entropy and MHL
GNU General Public License v3.0
8 stars 5 forks source link

Expected behavior of function "restrict" #6

Closed linh35-rss closed 3 years ago

linh35-rss commented 3 years ago

Hi Michael,

Thanks for developing this package.

I have some questions about the expected behavior of the function restrict. Based on the paper and the comment in the code, I thought the restrict would return a region <= 50bp (default window size) that covers the CpG site of interest.

https://github.com/MPIIComputationalEpigenetics/WSHPackage/blob/93e0cb6041ed08c6cc8d6cd5cee0c9e5e8e21d44/R/calculate_scores.R#L95-L106

For example, bellow is the expected behavior. It returns a region [80, 130] that covers a 50bp region.

> restrict(c("50", "80", "90", "100", "110", "120", "130", "150"), "100")
[1] "80"  "90"  "100" "110" "120" "130"

However, the example bellow returns a region [50, 150] of 100bp. Is this expected?

> restrict(c("50", "100", "150"), "100")
[1] "50"  "100" "150"

Another related question. In the example bellow, the restrict returns a 50bp region [80, 130]. Do you think returning the region [90, 135] could be better since it will cover more sites?

> restrict(c("50", "80", "90", "100", "110", "120", "130", "131", "132", "133", "134", "135", "150"), "100")
[1] "80"  "90"  "100" "110" "120" "130"

Would love to hear your thoughts. Thank you very much!

schmic05 commented 3 years ago

Hi @linh35-rss,

Thanks a lot for spotting this, it was indeed a small unintended behavior in the code. I fixed it in the most recent version available here, please feel free to try it and to report any further unexpected behavior.

Thanks again,

Michael

linh35-rss commented 3 years ago

Thank you very much, Michael! Didn't realize it's already fixed in the new version. You're awesome!