Skip to content

Compiled-code stdout fix + set Wei Li as maintainer (Bioc) - #12

Merged
davidliwei merged 3 commits into
masterfrom
fix/compiled-code-stdout
Jul 9, 2026
Merged

Compiled-code stdout fix + set Wei Li as maintainer (Bioc)#12
davidliwei merged 3 commits into
masterfrom
fix/compiled-code-stdout

Conversation

@davidliwei

@davidliwei davidliwei commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Final Bioconductor submission-readiness for 0.99.0.

  • Compiled code → R console: std::cout/cerr/printfRcpp::Rcout/Rcpp::Rcerr/Rprintf in src/RRA.cpp/fileio.cpp/rngs.cpp (the fprintf(fh, ...) result-file writes are unchanged). Clears the last R CMD check NOTE.
  • Maintainer set to Wei Li li.david.wei@gmail.com (cre); Xiaolong Cheng and Lin Yang remain aut.
  • Copilot review follow-ups: early-return on file-open failure (loadControlSeq/getGroupListNum/ReadFile); guard empty-line char access (UB); PutSeed(0) seeds from the clock instead of reading stdin via scanf; fixed two message typos.

Verified: scMAGeCK.so no longer references std::cout/cerr/printf/puts/putchar; scmageck_rra on the bundled demo is byte-identical (all.equal == TRUE; lo_value sums + control-seq count unchanged); R CMD check on Linux = 0 ERROR / 0 WARNING / 0 NOTE.

🤖 Generated with Claude Code

Bioconductor / R CMD check flags compiled code that writes to stdout/stderr.
Replace std::cout/std::cerr/printf with Rcpp::Rcout/Rcpp::Rcerr/Rprintf in
src/RRA.cpp, src/fileio.cpp and src/rngs.cpp (fprintf() calls that write to
the RRA output *file* are unchanged).

Verified: scMAGeCK.so no longer references std::cout/cerr/printf/puts/putchar,
and scmageck_rra output on the bundled demo is byte-identical to before
(full result table all.equal == TRUE; lo_value sums unchanged).
Switch the Authors@R cre role to Wei Li <li.david.wei@gmail.com> for the
Bioconductor resubmission (Xiaolong Cheng and Lin Yang remain authors).
Note the compiled-code fix in NEWS.
@davidliwei
davidliwei force-pushed the fix/compiled-code-stdout branch from 77890cc to 8d5365b Compare July 9, 2026 18:24
@davidliwei

Copy link
Copy Markdown
Collaborator Author

@codex

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to make the package Bioconductor submission-ready for version 0.99.0 by (1) routing compiled-code diagnostics through R-friendly output mechanisms and (2) updating package maintainer metadata.

Changes:

  • Replaced std::cout/std::cerr/printf usage in C/C++ sources with Rcpp::Rcout/Rcpp::Rcerr/Rprintf.
  • Updated DESCRIPTION to set Wei Li as cre (maintainer).
  • Documented the compiled-code stdout/stderr change in NEWS.md.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/RRA.cpp Switched diagnostic output from C/C++ streams/printf to R output APIs (Rcpp::Rcout/Rcpp::Rcerr/Rprintf).
src/fileio.cpp Switched error/diagnostic output to Rcpp::Rcerr/Rprintf while keeping result-file fprintf() writes.
src/rngs.cpp Replaced printf with Rprintf for messages in RNG utilities and added the R print header.
NEWS.md Added a changelog entry describing the compiled output routing change.
DESCRIPTION Updated Authors@R to set Wei Li as maintainer (cre).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/RRA.cpp
Comment on lines 101 to 105
ifstream fh;
fh.open(fname);
if(!fh.is_open()){
cerr<<"Error opening "<<fname<<endl;
Rcpp::Rcerr<<"Error opening "<<fname<<endl;
}
Comment thread src/fileio.cpp
Comment on lines 37 to 41
ifstream fh;
fh.open(fileName);
if(!fh.is_open()){
cerr<<"Error opening "<<fileName<<endl;
Rcpp::Rcerr<<"Error opening "<<fileName<<endl;
}
Comment thread src/fileio.cpp
Comment on lines 179 to 183
// actually loading the file
fh.open(fileName);
if(!fh.is_open()){
cerr<<"Error opening "<<fileName<<endl;
Rcpp::Rcerr<<"Error opening "<<fileName<<endl;
}
Comment thread src/fileio.cpp Outdated
for (i=0;i<groupNum;i++){
if(groups[i].controlsgs>=groups[i].itemNum){ //skip those that consists of only control sgrnas
printf("Suppressing the output of gene %s since it is negative ontrol genes.\n",groups[i].name);
Rprintf("Suppressing the output of gene %s since it is negative ontrol genes.\n",groups[i].name);
Comment thread src/RRA.cpp Outdated
Comment thread src/rngs.cpp Outdated
Comment on lines 118 to 122
if (x == 0)
while (!ok) {
printf("\nEnter a positive integer seed (9 digits or less) >> ");
Rprintf("\nEnter a positive integer seed (9 digits or less) >> ");
scanf("%ld", &x);
ok = (0 < x) && (x < MODULUS);
Comment thread DESCRIPTION
Authors@R: c(
person("Wei", "Li", role = "aut"),
person("Xiaolong", "Cheng", email = "xiaolongcheng1120@gmail.com", role = c("aut", "cre")),
person("Wei", "Li", email = "li.david.wei@gmail.com", role = c("aut", "cre")),
- loadControlSeq / getGroupListNum / ReadFile: return early on file-open
  failure instead of continuing on a failed stream.
- loadControlSeq: guard the trailing-char access so empty lines are not
  read out of bounds (undefined behavior).
- PutSeed(x == 0): seed from the clock like x < 0 instead of prompting via
  scanf() -- reading stdin can hang non-interactive R runs.
- Fix two user-facing message typos ("Aggreation", "ontrol").

RRA output on the bundled demo remains byte-identical (all.equal == TRUE;
lo_value sums and control-sequence count unchanged).
@davidliwei

Copy link
Copy Markdown
Collaborator Author

Thanks @copilot — all 7 points addressed in 695e421:

  • loadControlSeq / getGroupListNum / ReadFile: now return -1 on file-open failure instead of continuing on a failed stream.
  • loadControlSeq empty-line UB: the trailing-char read is now guarded by !oneline.empty().
  • rngs.cpp scanf/stdin: PutSeed(x == 0) now seeds from the clock (like x < 0); the interactive prompt is removed so it can't hang non-interactive runs.
  • Typos: "Aggreation" → "Aggregation"; "negative ontrol genes" → "consists only of negative control sgRNAs".
  • DESCRIPTION email: the maintainer address is intentionally li.david.wei@gmail.com (matches the GitHub/Bioconductor identity); the earlier PR-body text was stale and has been corrected.

Verified: scmageck_rra on the bundled demo is byte-identical after these changes (all.equal == TRUE; lo_value sums and control-sequence count unchanged), and R CMD check compiled-code check is now OK (0 ERROR / 0 NOTE on Linux).

@davidliwei
davidliwei merged commit 3b62b49 into master Jul 9, 2026
1 check passed
@davidliwei
davidliwei deleted the fix/compiled-code-stdout branch July 9, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants