-
Notifications
You must be signed in to change notification settings - Fork 12
Description
(Moving this from the devteam-bioc Slack to GitHub)
Jiefei wrote on Slack:
Hi Herve, I would like to make some changes to the IRanges package but I might miss something so I want to hear your opinion. For making the IRanges package compatible with ALTREP, the IRanges should be able to use the user's input as its start and width variable, so for the C level constructor:
SEXP solve_user_SEW0(SEXP start, SEXP end, SEXP width)
{
SEXP ans, ans_start, ans_width;
int ans_length, i;
ans_length = LENGTH(start);
PROTECT(ans_start = NEW_INTEGER(ans_length));
PROTECT(ans_width = NEW_INTEGER(ans_length));
for (i = 0; i < ans_length; i++) {
if (solve_user_SEW0_row(INTEGER(start)[i],
INTEGER(end)[i],
INTEGER(width)[i],
INTEGER(ans_start) + i,
INTEGER(ans_width) + i) != 0)
{
UNPROTECT(2);
error("solving row %d: %s", i + 1, errmsg_buf);
}
}
PROTECT(ans = _new_IRanges("IRanges", ans_start, ans_width, R_NilValue));
UNPROTECT(3);
return ans;
}
I plan to change it to
SEXP solve_user_SEW0(SEXP start, SEXP end, SEXP width)
{
SEXP ans;
int duplicate_num = 0;
int ans_length = LENGTH(start);
for (int i = 0; i < ans_length; i++) {
if (solve_user_SEW0_row(i,
&start,&end, &width,
&duplicate_num
) != 0)
{
error("solving row %d: %s", i + 1, errmsg_buf);
}
}
PROTECT(ans = _new_IRanges("IRanges", start, width, R_NilValue));
UNPROTECT(1+ duplicate_num);
return ans;
}
The function
solve_user_SEW0_rowwill duplicatestartandwidthif it need to change the value of these two variables. The similar pattern is also found in the functionsolve_user_SEW. I would like to know if there is any concern that prevents us from using the user's input as the IRanges object's slots. Do you think these changes could be a solution for the ALTREP problem?