steverozen / ICAMS

ICAMS: In-depth Characterization and Analysis of Mutational Signatures
GNU General Public License v3.0
8 stars 3 forks source link

R/strandbias_functions.R/CalculateExpressionLevel: Case where dt2 has no rows #7

Closed JiaGengChang closed 4 years ago

JiaGengChang commented 4 years ago

Explanation: In the case where nrow(dt1) <= num.of.bins and dt2 has no rows, break.points2 will be numeric (empty). As a result, the length of break.points is not longer than num.of.bins and there will be an error in the call to list <- lapply(1:num.of.bins, FUN = GetExpLevel, exp.value = dt$exp.value, break.points = break.points)

For example, if num.of.bins = 4 and break.points = [0, 0.00339, 8.83416], an NA result is got for lower/upper when GetExpLevel tries to access break.points[i] for i = 3 (upper) and i = 4 (both lower and upper).

Suggestion: Would it be possible to do something to lengthen break.points in the case break.points is of the same length or shorter than num.of.bins?

Debug environment - CalculateExpressionLevelDinuc (an 2bp-indel adapted version of CalculateExpressionLevel ) Selection_194

Thank you very much

jnh01 commented 4 years ago

@JiaGengChang Thanks a lot for giving detailed information about this issue. I have updated the code in master branch for this edge case. If you find other bug in ICAMS, please let us know. Thanks!