Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| if (length(idx_nz) >= 2L) { | ||
| for (a in seq_along(idx_nz)) { | ||
| j <- idx_nz[a] | ||
| if (!kept[a]) next | ||
| mij <- mi_i[j] | ||
| for (b in (a + 1L):length(idx_nz)) { | ||
| k <- idx_nz[b] |
There was a problem hiding this comment.
Prevent neighbor-loop from indexing beyond bounds
The streamed ARACNE routine loops neighbor pairs with for (a in seq_along(idx_nz)) and for (b in (a + 1L):length(idx_nz)). When a reaches the last neighbor, (a + 1L):length(idx_nz) evaluates to a decreasing sequence containing values larger than length(idx_nz) (e.g. 3:2), so idx_nz[b] becomes NA and the subsequent h5read(..., index = list(j, k)) call uses an NA index and aborts. This will throw an error for any node that keeps two or more neighbors unless the last neighbor was already pruned, making the streamed mode unusable. Guard the inner loop to run only when a < length(idx_nz) (e.g. iterate seq_len(length(idx_nz) - 1L) or skip when there is no next neighbor).
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_b_68f2390e87dc8320a8e5e3af4d5d8d3b