agentsclimarketplace

Ggplot2 pie chart rendering

Skill HolobiomicsLab/asb-skill-collections/collections/metabolomics/v2/skills/ggplot2-pie-chart-rendering

Use when you have a frequency table (generated by count_fold_changes and converted to relative abundance via ra_table) of metabolite subsets stratified by class or direction of change (e.g., increased vs. decreased organic acids at padj ≤ 0.From its SKILL.md

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill ggplot2-pie-chart-rendering

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 15 stars15 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its file declares

Copied from the file, not written here

The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

6.9 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

ggplot2-pie-chart-rendering

License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->

Summary

Generate publication-ready pie chart visualizations of metabolite class frequency distributions from omu metabolomics analysis, using ggplot2 to render filtered and normalized count data as proportional segments with customizable styling.

When to use

You have a frequency table (generated by count_fold_changes and converted to relative abundance via ra_table) of metabolite subsets stratified by class or direction of change (e.g., increased vs. decreased organic acids at padj ≤ 0.05), and you need a visual summary of the proportional distribution of those categories for publication or presentation.

When NOT to use

  • Input is already a rendered graphic or non-tabular format (e.g., PNG, SVG) — re-rendering will degrade quality.
  • Data contains more than ~8–10 categories, as pie charts become visually cluttered and difficult to interpret; use bar charts or faceted plots instead.
  • The frequency table has not been normalized to relative abundance (percentage), as raw counts may be misleading in pie chart proportions without context.

Inputs

  • omu_summary output dataframe (containing metabolite names, Class metadata, padj values, log2FoldChange)
  • Frequency table from count_fold_changes (metabolite counts by class and direction)
  • Relative abundance table from ra_table (percentage values by class)

Outputs

  • ggplot2 pie chart object
  • PNG or vector graphics file (saved via base R or ggplot2 graphics export)

How to apply

Load the omu_summary output dataframe filtered by statistical significance (padj ≤ 0.05) and metabolite class. Apply count_fold_changes with column='Class' to generate a frequency table of increased/decreased counts. Transform this frequency table to relative abundance (percentage) using ra_table with variable='Class'. Pass the resulting dataframe to the pie_chart function, specifying the ratio_data argument, variable='Class', column parameter (e.g., 'Decrease'), and optional styling parameters such as color='black'. The function returns a ggplot2 object, which is compatible with ggplot2 themes and can be exported to PNG or other graphics formats using standard R graphics export methods.

Related tools

  • ggplot2 (Core graphics engine for pie_chart rendering; produces ggplot2 objects compatible with ggplot2 themes and export utilities)
  • omu pie_chart function (Wrapper function that orchestrates ggplot2 pie chart construction from ratio_data, applying variable and column filters and color styling) — https://github.com/connor-reid-tiffany/Omu
  • count_fold_changes (Prerequisite function to generate frequency table of metabolite counts stratified by class and fold-change direction (increased/decreased)) — https://github.com/connor-reid-tiffany/Omu
  • ra_table (Prerequisite function to transform count frequency table into relative abundance (percentage) format required for accurate pie chart proportions) — https://github.com/connor-reid-tiffany/Omu

Examples

pie_chart(ratio_data = ra_result, variable = 'Class', column = 'Decrease', color = 'black'); ggsave('organic_acids_pie.png', width = 6, height = 6)

Evaluation signals

  • Output is a valid ggplot2 object (inherits class 'ggplot'); verify with class(pie_obj) in R.
  • Pie segments sum to 100% (or 1.0 if normalized 0–1); verify with sum(pie_obj$data$value) or inspect the underlying ratio_data.
  • Segments are colored according to specified parameters (e.g., color='black' or palette); visual inspection or extraction of scale_fill values.
  • Chart renders without errors when exported to PNG via ggsave or print(pie_obj); file exists and is non-zero bytes.
  • Segment labels (if present) correspond to Class categories and direction values used in count_fold_changes (e.g., 'Organic acids – Decrease', 'Organic acids – Increase').

Limitations

  • Pie charts are difficult to interpret when more than 8–10 categories are present; consider faceted bar charts or alternative visualizations for complex datasets.
  • The pie_chart function requires input data to be pre-normalized to relative abundance; raw counts will produce misleading proportions.
  • No built-in support for nested or hierarchical pie charts; multi-level class structures must be aggregated or flattened prior to visualization.
  • Color customization is limited to simple parameters (e.g., color='black'); complex color palettes or per-segment color mapping may require direct ggplot2 manipulation.

Evidence

  • [other] pie_chart-frequency-table-from-ra_table: "First, a frequency data frame (percentage values) must be made from the count data frame using the ra_table function"
  • [other] pie_chart-function-invocation: "This frequency data frame can be used in the pie_chart function"
  • [other] ggplot2-compatibility: "The figure is a ggplot2 object, so it is compatible with any ggplot2 themes"
  • [other] task-workflow-pie-chart: "Generate a pie_chart with pie_chart function specifying ratio_data, variable='Class', column='Decrease', and color='black'"
  • [other] count-fold-changes-prerequisite: "Apply count_fold_changes with column='Class' and sig_threshold=0.05 to generate a frequency table counting increased vs. decreased metabolites"

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.