Skip to contents

Generate a self-contained HTML report for a glysmith_result object. The report is rendered via rmarkdown::render() using an internal R Markdown template. If use_ai is TRUE, the report text will be polished and organized into sections using LLM (deepseek-chat), and plots will be described with a multimodal model (deepseek-vl-chat). To use this feature, you have to provide an API key and set it in the environment variable DEEPSEEK_API_KEY by running Sys.setenv(DEEPSEEK_API_KEY = "your_api_key"). You can apply the API key on https://platform.deepseek.com.

Usage

polish_report(
  x,
  output_file,
  title = "GlySmith report",
  open = interactive(),
  use_ai = FALSE
)

Arguments

x

A glysmith_result object.

output_file

Path to the output HTML file.

title

Report title.

open

Whether to open the report in a browser after rendering.

use_ai

Whether to polish the report text, organize sections, and generate plot descriptions using AI (deepseek-chat and deepseek-vision). Default is FALSE.

Value

The normalized path to the generated HTML file.

Examples

library(glyexp)
exp <- real_experiment2
result <- forge_analysis(exp)
#>  Identification overview
#>  Identification overview [129ms]
#> 
#>  Preprocessing
#> 
#>  Preprocessing

#> ── Removing variables with too many missing values ──
#>  Preprocessing

#> 
#>  Preprocessing

#>  No QC samples found. Using all samples.
#>  Preprocessing

#>  Applying preset "discovery"...
#>  Preprocessing

#>  Total removed: 10 (14.93%) variables.
#>  Preprocessing

#>  Variable removal completed.
#>  Preprocessing

#> 
#>  Preprocessing

#> ── Normalizing data ──
#>  Preprocessing

#> 
#>  Preprocessing

#>  No QC samples found. Using default normalization method based on experiment type.
#>  Preprocessing

#>  Experiment type is "glycomics". Using `normalize_median_quotient()` + `normalize_total_area()`.
#>  Preprocessing

#>  Normalization completed.
#>  Preprocessing

#> 
#>  Preprocessing

#> ── Normalizing data (Total Area) ──
#>  Preprocessing

#> 
#>  Preprocessing

#>  Total area normalization completed.
#>  Preprocessing

#> 
#>  Preprocessing

#> ── Imputing missing values ──
#>  Preprocessing

#> 
#>  Preprocessing

#>  No QC samples found. Using default imputation method based on sample size.
#>  Preprocessing

#>  Sample size > 100, using `impute_miss_forest()`.
#>  Preprocessing

#>  Imputation completed.
#>  Preprocessing

#> 
#>  Preprocessing

#> ── Correcting batch effects ──
#>  Preprocessing

#> 
#>  Preprocessing

#>  Batch column  not found in sample_info. Skipping batch correction.
#>  Preprocessing

#>  Batch correction completed.
#>  Preprocessing

#>  Preprocessing [5.6s]
#> 
#>  QC (post-preprocessing)
#>  QC (post-preprocessing) [126ms]
#> 
#>  Principal component analysis
#>  Principal component analysis [300ms]
#> 
#>  Differential expression analysis (limma)
#>  Number of groups: 4
#>  Differential expression analysis (limma)

#>  Groups: "H", "M", "Y", and "C"
#>  Differential expression analysis (limma)

#>  Pairwise comparisons will be performed, with levels coming first as reference groups.
#>  Differential expression analysis (limma)

#>  Differential expression analysis (limma) [58ms]
#> 
#>  Volcano plot
#>  Volcano plot [536ms]
#> 
#>  Heatmap of significant variables
#>  Heatmap of significant variables [66ms]
#> 
#>  Skipping `step_sig_enrich_go()` because input is not a glycoproteomics experiment and input has more than 2 groups.
#>  Skipping `step_sig_enrich_kegg()` because input is not a glycoproteomics experiment and input has more than 2 groups.
#>  Skipping `step_sig_enrich_reactome()` because input is not a glycoproteomics experiment and input has more than 2 groups.
#>  Derived trait calculation
#>  Derived trait calculation [2.2s]
#> 
#>  Differential trait analysis (limma)
#>  Number of groups: 4
#>  Differential trait analysis (limma)

#>  Groups: "H", "M", "Y", and "C"
#>  Differential trait analysis (limma)

#>  Pairwise comparisons will be performed, with levels coming first as reference groups.
#>  Differential trait analysis (limma)

#>  Differential trait analysis (limma) [56ms]
#> 
#>  Heatmap of significant traits
#>  Heatmap of significant traits [74ms]
#> 
polish_report(result, tempfile(fileext = ".html"), open = FALSE)
#> [1] "/tmp/RtmpBgHsNs/file1c902434a622.html"