Make rctd-rust pip-installable - #1
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e64b4d95cd
ℹ️ 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 "@codex address that feedback".
| sq_ptrs[index] = sq_keep[index].ctypes.data | ||
| sigma_values = np.ascontiguousarray(SIGMA_ALL, dtype=np.int64) | ||
| result = ctypes.c_int64(-1) | ||
| _LIB.choose_sigma_full2( |
There was a problem hiding this comment.
Preserve the million-element sigma subsample
When N_fit * number_of_reg_genes exceeds 1,000,000, this unconditional native call scores every element, whereas the pinned upstream choose_sigma randomly selects exactly one million elements before evaluating candidate likelihoods. Because choose_sigma_full2 has no equivalent subsampling branch, large experiments can select a different sigma and produce different downstream results despite the advertised drop-in behavior; preserve the upstream sample or fall back for this case.
Useful? React with 👍 / 👎.
| user_classes = config.class_df | ||
| class_by_type = ({name: name for name in cell_type_names} if user_classes is None else user_classes) | ||
| classes = np.array([class_by_type[name] for name in cell_type_names]) |
There was a problem hiding this comment.
Reject null class mappings before classification
When an explicit class_df contains a None or NaN value, these lines accept the null as a legitimate class label, which changes the same-class comparisons and can silently produce incorrect doublet classifications and class-name outputs. The pinned upstream implementation explicitly rejects these mappings with ValueError, so retain that validation before running the native fits.
Useful? React with 👍 / 👎.
Summary
rctd_rust.run_rctdAPI pinned torctd-py==0.3.7Verification
cargo check --locked --manifest-path work/variants/rctd_rs/Cargo.tomlcargo test --locked --manifest-path work/variants/rctd_rs/Cargo.tomlcp310-abi3-win_amd64wheel and source distributionpytest -q: 3 passed0.999999999998, weights max diff1.447e-6, doublet max diff3.061e-8, labels identical