agentsclimarketplace

Principal component analysis visualization

Skill HolobiomicsLab/asb-skill-collections/collections/epigenomics/v1/skills/principal-component-analysis-visualization

Curated, evidence-grounded skill and software-tool collections for scientific AI agents, generated by the AgenticScienceBuilder

Install
npx -y skills add HolobiomicsLab/asb-skill-collections --skill principal-component-analysis-visualization

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

  • 14 stars14 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 author says it does

Copied from the file, not written here

Use when after merging methylation call files from multiple samples using unite() to create a methylBase object, apply PCA when you need to visualize sample-level relationships based on overall methylation similarity across all covered bases, or when you want to determine which principal components.

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.0 KB, as published. Nobody here has run it

principal-component-analysis-visualization

Summary

Apply PCA to methylation profiles from a unified methylBase object to reveal sample relationships and variance structure in principal component space. Generates a scree plot showing variance explained by each PC and a biplot of the first two principal components to assess methylation-based sample grouping.

When to use

After merging methylation call files from multiple samples using unite() to create a methylBase object, apply PCA when you need to visualize sample-level relationships based on overall methylation similarity across all covered bases, or when you want to determine which principal components explain the most variance in methylation profiles among your samples.

When NOT to use

  • Input is a raw methylRawList (unmunged per-sample files) — must first run unite() to create methylBase.
  • You need to perform clustering by correlation distance with Ward linkage — use clusterSamples() instead, which produces a dendrogram.
  • Sample count is very small (n < 3) — PCA is unstable with fewer samples than dimensions.

Inputs

  • methylBase object (unified methylation data from unite() across all samples and bases)
  • sample metadata (optional, for labeling and coloring scatter plot points)

Outputs

  • scree plot (variance explained by each principal component)
  • PC1 vs PC2 scatter plot (sample coordinates in first two principal components)
  • principal component scores matrix (numeric coordinates for all samples and PCs)

How to apply

Load the methylBase object produced by unite() from merged methylation calls. Apply the PCASamples() function from methylKit to compute principal components of the methylation profile matrix. Extract the scree plot showing variance explained by each PC to determine the number of informative components. Then visualize the first two principal components (PC1 and PC2) as a scatter plot with samples as points, colored or labeled by experimental group (e.g., test1, test2, ctrl1, ctrl2). The function performs centering and scaling on the methylation data before eigenvalue decomposition. Interpret clustering patterns in PC space: samples that cluster together have similar methylation profiles, while separation along PC1 and PC2 indicates major sources of methylation variation between experimental groups.

Related tools

  • methylKit (R package providing PCASamples() function to compute PCA on methylation profiles and generate scree and scatter plots) — https://github.com/al2na/methylKit
  • R (Statistical computing environment in which PCASamples() and plotting functions are executed)

Examples

PCASamples(methylBase_obj)

Evaluation signals

  • Scree plot shows monotonically decreasing variance explained with cumulative sum approaching 100% across PCs
  • PC1 and PC2 scatter plot displays sample points with no overlapping labels and clear visual separation if groups differ in methylation
  • Principal component scores matrix has dimensions (n_samples × n_components) with numeric values suitable for downstream analysis
  • Samples cluster according to known experimental condition (e.g., test and control groups separate) indicating the PCA captured true biological structure
  • Total variance explained by first two PCs is ≥ 50% (heuristic for effective dimensionality reduction)

Limitations

  • PCA assumes linear relationships between methylation and the principal components; complex or non-linear patterns may not be well-captured.
  • Results depend on the choice of bases included in methylBase (coverage threshold, q-value filtering applied before PCA may alter conclusions).
  • With very small sample sizes (n < 5), the variance estimates are unstable and the scatter plot may be misleading.
  • PCA is sensitive to outlier samples (e.g., one sample with extremely different methylation); outliers can dominate PC1, obscuring subtler structure.

Evidence

  • [intro] PCASamples() generates a scree plot showing variance explained by each PC and PC1/PC2 scatter plot revealing methylation profile relationships: "PCASamples() function to compute principal components and generate a scree plot showing variance explained by each PC. 4. Extract and visualize the first two principal components (PC1 and PC2) as a"
  • [intro] methylBase object is the input container created by uniting multiple samples: "In order to do further analysis, we will need to get the bases covered in all samples. The following function will merge all samples to one object for base-pair locations that are covered in all"
  • [other] PCA visualization assesses sample relationships in principal component space: "How do the four samples (test1, test2, ctrl1, ctrl2) cluster based on methylation similarity, and what are their relationships in principal component space?"
  • [readme] methylKit supports multiple visualization options including PCA: "Multiple visualization options"
  • [readme] Sample correlation and clustering is a core feature of methylKit: "Sample correlation and clustering"

Keep looking

Skills are one crate of 328,083. 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.