Skip to content

Add fileStem to anota2seqRun/anota2seqResidOutlierTest and switch plots to PDF - #4

Open
aradar46 wants to merge 54 commits into
ChrOertlin:masterfrom
aradar46:devel
Open

aradar46 wants to merge 54 commits into
ChrOertlin:masterfrom
aradar46:devel

Conversation

@aradar46

@aradar46 aradar46 commented Aug 24, 2026

Copy link
Copy Markdown

Hi,

This PR addresses two of small adjustment regarding how plots are saved:

  1. Custom output paths (fileStem): Added the fileStem argument to anota2seqResidOutlierTest and passed it through anota2seqRun. This allows saving all outputs into custom subdirectories (e.g. fileStem = "results/ANOTA2SEQ") instead of writing directly to the working directory with hardcoded names.

  2. Vector PDF format: Switched the few remaining .jpeg/.jpg outputs in anota2seqPerformQC, anota2seqResidOutlierTest, and anota2seqAnalyze to .pdf so that all generated figures in the package consistently use vector format and editable if needed for publication.

  3. Updated the relevant .Rd documentation files.

  • Tested locally with both anota2seqRun and the individual step-by-step functions.

These changes were mainly personal preferences that suited my workflow better, so feel free to adapt or ignore them if not relatable.

-- okey I am confused now. I had only two small commits!
I have attached a git patches
0001-Add-a-fileStem-parameter-to-allow-customization-of-o.patch
0002-refactor-switch-plot-output-format-from-JPEG-to-PDF-.patch
anota2seq_filestem_pdf_support.patch

vobencha and others added 30 commits April 30, 2018 10:35
nturaga and others added 24 commits May 19, 2021 16:31
…es for those functions that currently have it hardcoded, giving more control over where the output files are saved. Especially useful for multi-dataset runs in a pipeline.
…and QC functions to gives more control to user for high quality publication figures
@sourcery-ai

sourcery-ai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR adds configurable, consistently vectorized PDF plot output and propagates custom filename stems through the pipeline, while also introducing dataset-level regulatory-mode state, a combined single-data-frame output, and broad validation and result-handling changes that require review beyond the stated plotting adjustments.

Sequence diagram for propagated custom plot output stems

sequenceDiagram
    participant User
    participant anota2seqRun
    participant anota2seqPerformQC
    participant anota2seqResidOutlierTest
    participant anota2seqAnalyze
    participant PDF

    User->>anota2seqRun: anota2seqRun(fileStem)
    anota2seqRun->>anota2seqPerformQC: anota2seqPerformQC(fileStem)
    anota2seqPerformQC->>PDF: pdf(fileStem_plot_filename.pdf)
    anota2seqRun->>anota2seqResidOutlierTest: anota2seqResidOutlierTest(fileStem)
    anota2seqResidOutlierTest->>PDF: pdf(fileStem_residual_filename.pdf)
    anota2seqRun->>anota2seqAnalyze: anota2seqAnalyze(fileStem)
    anota2seqAnalyze->>PDF: pdf(fileStem_rvm_fit_filename.pdf)
Loading

File-Level Changes

Change Details Files
Added configurable output filename stems and propagated them through the pipeline while converting remaining diagnostic plots to PDF.
  • Added fileStem to residual outlier testing and the top-level run orchestration.
  • Forwarded fileStem to QC, residual testing, and analysis outputs.
  • Changed remaining JPEG/JPG diagnostic outputs to PDF with equivalent plot dimensions.
  • Updated function documentation for new arguments and output extensions.
R/anota2seqResidOutlierTest.R
R/anota2seqRun.R
R/anota2seqPerformQC.R
R/anota2seqAnalyze.R
man/anota2seqPerformQC.Rd
man/anota2seqResidOutlierTest.Rd
man/anota2seqRun.Rd
Centralized regulatory-mode state on Anota2seqDataSet and added combined regulatory-mode output retrieval.
  • Moved regModes from selected-output classes to the dataset class and updated constructors and consumers.
  • Set the dataset-level flag during regulatory-mode analysis.
  • Added output = "singleDf" to merge effect and adjusted-p-value results across analyses with a singleRegMode classification.
  • Adjusted plot output handling for selected contrasts and missing analyses.
R/anota2seqClasses.R
R/anota2seqDataSetFromMatrix.R
R/anota2seqDataSetFromSE.R
R/anota2seqInternalFunctions.R
R/anota2seqMethods.R
R/anota2seqRegModes.R
R/anota2seqSelSigGenes.R
man/anota2seqGetOutput.Rd
Hardened type checks and refined analysis/result handling across core functions.
  • Replaced class-string comparisons with S4-aware or predicate-based checks.
  • Restricted analyzed statistic matrices to analysis-specific column sets.
  • Improved default contrast naming and filtering of unavailable plot data.
  • Added and documented related API and release-note updates.
R/anota2seqAnalyze.R
R/anota2seqDataSetFromSE.R
R/anota2seqInternalFunctions.R
R/anota2seqMethods.R
R/anota2seqPerformQC.R
R/anota2seqResidOutlierTest.R
R/anota2seqSelSigGenes.R
DESCRIPTION
NAMESPACE
NEWS
inst/CITATION
vignettes/anota2seq.Rnw

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 3 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="R/anota2seqMethods.R" line_range="296-298" />
<code_context>
+                      )
+                  directOut$singleRegMode <- "background"
+                  
+                  directOut$singleRegMode[rownames(directOut) %in% 
+                                              rownames(object@selectedTranslation@selectedRvmData[[selContrast]])
+                                          [object@selectedTranslation@selectedRvmData[[selContrast]][,"singleRegMode"] == "translation"]] <- "translation"
+                  
+                  directOut$singleRegMode[rownames(directOut) %in% 
</code_context>
<issue_to_address>
**issue (bug_risk):** The `singleDf` output leaves every identifier classified as `background` because `directOut` receives default numeric row names (`1:n`) while the selected result tables are indexed by gene identifiers; the `%in%` checks therefore never match and the assigned `translation`/`buffering` regulatory modes are lost.

**Triggers:** When `anota2seqGetOutput(..., output = "singleDf")` is used after regulatory-mode analysis.

**Suggested fix:** Set `rownames(directOut) <- rownames(object@dataP)` or match against `directOut$identifier` instead of `rownames(directOut)`.
</issue_to_address>

### Comment 2
<location path="R/anota2seqRun.R" line_range="73-85" />
<code_context>
     ## If parameters are specified check them
     if(!is.null(thresholds)){
+        
+        ## reset parameter list
+        parameters <- list(minSlopeTranslation = NULL,
+                           maxSlopeTranslation = NULL,
+                           minSlopeBuffering = NULL,
+                           maxSlopeBuffering = NULL,
+                           maxPAdj = NULL,
+                           maxP = NULL,
+                           minEff = NULL,
+                           deltaPT = NULL,
+                           deltaTP = NULL,
+                           deltaP = NULL,
+                           deltaT = NULL)
+        
+        
         for(paramNames in 1:length(thresholds)){
</code_context>
<issue_to_address>
**issue (bug_risk):** Supplying any non-NULL `thresholds` list resets every unspecified filtering parameter to `NULL`, replacing the normal defaults such as `maxPAdj = 0.15` and the slope limits; a partial thresholds list therefore silently disables the omitted filters instead of retaining their defaults.

**Triggers:** When `anota2seqRun` is called with a partial `thresholds` list, such as only `maxPAdj`.

**Suggested fix:** Initialize the threshold list with the same default values used when `thresholds` is NULL, then overwrite only the supplied entries.
</issue_to_address>

### Comment 3
<location path="R/anota2seqPerformQC.R" line_range="196" />
<code_context>
     if(useRVM==TRUE & onlyGroup==FALSE){
         message("\tUsing RVM for omnibus interaction statistics\n")
-        jpeg(paste(fileStem, "_rvm_fit_for_interactions.jpg", sep=""), width=800, height=400, quality=100)
+        pdf(paste(fileStem, "_rvm_fit_for_interactions.pdf", sep=""), width=8, height=4)
         par(mfrow=c(1,2))
         anota2seqPlotIGFit(intResidMS, intResidDf[1], qqName="Fit for interactions")
</code_context>
<issue_to_address>
**issue (bug_risk):** Passing a stem containing a new subdirectory, such as `results/ANOTA2SEQ`, causes `pdf()` to fail because none of these functions creates the parent directory before opening the output device; the advertised custom-subdirectory workflow therefore errors when the directory does not already exist.

**Triggers:** When `fileStem` contains a directory that has not been created in advance.

**Suggested fix:** Create the parent directory before opening plots, or validate and document that callers must create it first.
</issue_to_address>

Sourcery assessment

Approval pending. 3 findings to address first.

Blocking findings: R/anota2seqMethods.R:298, R/anota2seqRun.R:85, R/anota2seqPerformQC.R:196


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread R/anota2seqMethods.R
Comment on lines +296 to +298
directOut$singleRegMode[rownames(directOut) %in%
rownames(object@selectedTranslation@selectedRvmData[[selContrast]])
[object@selectedTranslation@selectedRvmData[[selContrast]][,"singleRegMode"] == "translation"]] <- "translation"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): The singleDf output leaves every identifier classified as background because directOut receives default numeric row names (1:n) while the selected result tables are indexed by gene identifiers; the %in% checks therefore never match and the assigned translation/buffering regulatory modes are lost.

Triggers: When anota2seqGetOutput(..., output = "singleDf") is used after regulatory-mode analysis.

Suggested fix: Set rownames(directOut) <- rownames(object@dataP) or match against directOut$identifier instead of rownames(directOut).

Comment thread R/anota2seqRun.R
Comment on lines +73 to +85
## reset parameter list
parameters <- list(minSlopeTranslation = NULL,
maxSlopeTranslation = NULL,
minSlopeBuffering = NULL,
maxSlopeBuffering = NULL,
maxPAdj = NULL,
maxP = NULL,
minEff = NULL,
deltaPT = NULL,
deltaTP = NULL,
deltaP = NULL,
deltaT = NULL)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): Supplying any non-NULL thresholds list resets every unspecified filtering parameter to NULL, replacing the normal defaults such as maxPAdj = 0.15 and the slope limits; a partial thresholds list therefore silently disables the omitted filters instead of retaining their defaults.

Triggers: When anota2seqRun is called with a partial thresholds list, such as only maxPAdj.

Suggested fix: Initialize the threshold list with the same default values used when thresholds is NULL, then overwrite only the supplied entries.

Comment thread R/anota2seqPerformQC.R
if(useRVM==TRUE & onlyGroup==FALSE){
message("\tUsing RVM for omnibus interaction statistics\n")
jpeg(paste(fileStem, "_rvm_fit_for_interactions.jpg", sep=""), width=800, height=400, quality=100)
pdf(paste(fileStem, "_rvm_fit_for_interactions.pdf", sep=""), width=8, height=4)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue (bug_risk): Passing a stem containing a new subdirectory, such as results/ANOTA2SEQ, causes pdf() to fail because none of these functions creates the parent directory before opening the output device; the advertised custom-subdirectory workflow therefore errors when the directory does not already exist.

Triggers: When fileStem contains a directory that has not been created in advance.

Suggested fix: Create the parent directory before opening plots, or validate and document that callers must create it first.

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.

6 participants