Logo van Umap Tsne Analysis

Umap Tsne Analysis

OrganisatiePopulair
aipoch
umap-tsne-analysis

Use when performing sample-level dimensionality reduction and visualization on abundance or OTU-style matrices with a companion group file, generating UMAP and/or t-SNE coordinates and plots for group separation assessment. NOT for: differential expression testing, single-cell workflows requiring dedicated embeddings pipelines, or analyses without a sample grouping file.

Add to TypingMind

Overzicht

Uitgeveraipoch
Repositorymedical-research-skills
Skillnaamumap-tsne-analysis
Sterren
1.9K
Forks
188
Meegeleverde bestanden
16
LicentieMIT
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Meegeleverde bestanden: 16

    Scripts, sjablonen en referentiemateriaal die het model tijdens het werken kan lezen. De bestanden kunnen alleen worden gelezen en worden nooit uitgevoerd.

  • Open source

    Gepubliceerd door aipoch op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Umap Tsne Analysis in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/aipoch/medical-research-skills/tree/main/awesome-med-research-skills/Data%20Analysis/umap-tsne-analysis
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.

Gebruik deze skill in TypingMind

Schakel Umap Tsne Analysis in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Umap Tsne Analysis automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Umap Tsne Analysis niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

UMAP and t-SNE Analysis

Prerequisites

Run the following before the first analysis to install all required R packages:

bash
Rscript scripts/install_dependencies.R

Alternative manual installation:

bash
Rscript -e "install.packages(c('optparse','data.table','Rtsne','umap','ggplot2','vegan','R.utils'), repos='https://cloud.r-project.org')"

Note: R.utils is only required when --timeout > 0, but pre-installing it avoids environment drift across runs. testthat is installed by scripts/install_dependencies.R as the development test dependency.

The skill cannot run until these packages are installed. In new or bare R environments, always run the prerequisite step first.


When to Read External Files

SituationFile to ReadPurpose
Need algorithm detailsreferences/algorithm.mdDimensionality reduction methods, assumptions, parameter interpretation
Need to run analysisscripts/main.RExecute: Rscript scripts/main.R --input_file ... --group_file ...
Encounter errorsreferences/troubleshooting.mdCommon errors and solutions
Need CLI examplesreferences/cli-guide.mdDetailed CLI usage examples
Need test datatests/data/Sample input files for testing

Usage

bash
Rscript scripts/main.R \
  --input_file ./otu_table.csv \
  --group_file ./group_info.csv \
  --output_dir ./output/ \
  --method both \
  --seed 42

Arguments

ShortLongTypeDefaultDescription
-i--input_filecharacterrequiredAbundance / OTU matrix file
-g--group_filecharacterrequiredGroup information file
-o--output_dircharacter./output/Output directory
-m--methodcharacterbothMethod: tsne, umap, or both
--sample_id_colcharacterfirst columnSample ID column in group file
--group_colcharactersecond columnGroup column in group file
--perplexitynumeric25t-SNE perplexity
--thetanumeric0.0t-SNE theta
--pcalogicalFALSEWhether to use PCA before t-SNE
--check_duplicateslogicalFALSEWhether t-SNE should check duplicated rows
--normalizelogicalTRUEWhether to normalize data before UMAP
--norm_methodcharacterhellingerNormalization method for vegan::decostand()
--n_neighborsinteger10UMAP neighborhood size
-s--seedinteger42Random seed for reproducibility
-t--timeoutinteger0Timeout in seconds; 0 disables timeout

Dependency Baseline

The skill was validated with the exact package baseline recorded in dependencies.lock.tsv.

PackageTested Version
optparse1.7.5
data.table1.15.4
Rtsne0.17
umap0.2.10.0
ggplot23.4.0
vegan2.7.3
R.utils2.13.0
testthat3.1.2

Use this file as the reproducibility baseline when validating a new environment.


Input Format

Abundance / OTU Matrix (input_file)

Features as rows, samples as columns, CSV/TSV-like tabular file with feature ID in the first column.

csv
OTU_ID,S1,S2,S3,S4
OTU_1,10,3,0,5
OTU_2,2,8,1,0
OTU_3,0,0,6,9

Group File (group_file)

Tabular file with at least two columns: sample ID and group label.

csv
SampleID,Group
S1,Control
S2,Control
S3,Treatment
S4,Treatment

Requirements:

  • At least 2 groups with at least 2 samples per group are required.
  • All sample IDs in the group file must exist in the matrix columns.
  • Single-group inputs will produce a SKILL_INVALID_PARAMETER error because dimensionality reduction without group contrast produces uninterpretable plots.

Output Files

FileDescription
table/tsne_coordinates.csvt-SNE coordinates with sample and group annotations
table/umap_coordinates.csvUMAP coordinates with sample and group annotations
plot/tsne_plot.pdft-SNE scatter plot with group colors and ellipses
plot/umap_plot.pdfUMAP scatter plot with group colors and ellipses
data/session_info.txtR session and package version info
data/analysis_data.rdaSaved analysis object with aligned matrix, metadata, colors, and runtime parameters

Workflow

Step 1: Validate Input

  • Check that matrix file and group file exist
  • Resolve sample ID and group columns
  • Validate at least 2 groups and at least 2 samples per group
  • Ensure all group-file sample IDs exist in the matrix
  • Remove samples with zero total abundance after alignment if needed

Step 2: Prepare Matrix

  • Convert input table into numeric matrix
  • Align matrix columns to sample order from the group file
  • Transpose matrix so rows become samples and columns become features

Step 3: Run Dimensionality Reduction

  • Run t-SNE if --method tsne or --method both
  • Run UMAP if --method umap or --method both
  • Apply fixed random seed for reproducibility

Step 4: Generate Visualizations

  • Plot sample embeddings
  • Color points by group
  • Draw group ellipses when enabled
  • Save PDF outputs

Methods

t-SNE

t-SNE is a non-linear dimensionality reduction method that preserves local neighborhood structure. It is useful for identifying local sample clustering patterns.

UMAP

UMAP is a manifold learning method that aims to preserve both local and some global structure. It is often faster than t-SNE and can produce stable low-dimensional embeddings when parameters are chosen appropriately.

Normalization

When --normalize TRUE, the script uses vegan::decostand() with the selected --norm_method before UMAP. This is helpful for abundance-style ecological matrices.


Agent Response Contract

After a successful run, report:

  1. Method(s) run (tsne, umap, or both)
  2. Sample count and group count processed
  3. Key parameters used (perplexity for t-SNE, n_neighbors for UMAP)
  4. Group separation quality (describe visible clustering from coordinate ranges if accessible)
  5. Artifact paths: coordinate CSV(s) and plot PDF(s) produced

Examples

Basic Usage

bash
Rscript scripts/main.R \
  -i otu_table.csv \
  -g group_info.csv \
  -o ./output \
  -m both

Only t-SNE

bash
Rscript scripts/main.R \
  -i otu_table.csv \
  -g group_info.csv \
  -o ./output \
  -m tsne \
  --perplexity 10

Only UMAP with Custom Group Column

bash
Rscript scripts/main.R \
  -i otu_table.csv \
  -g metadata.csv \
  -o ./output \
  -m umap \
  --sample_id_col SampleID \
  --group_col Treatment \
  --n_neighbors 15

Error Handling

Common Errors

ErrorCauseSolution
SKILL_FILE_NOT_FOUNDInput file does not existCheck file path
SKILL_MISSING_COLUMNSGroup or matrix file lacks required columnsVerify file format
SKILL_SAMPLE_MISMATCHSample IDs in group file do not match matrix columnsCheck sample naming consistency
SKILL_EMPTY_DATAMatrix becomes empty after preprocessingCheck input values and filtering
SKILL_INVALID_PARAMETERInvalid method, invalid parameter value, or single-group inputAdjust CLI arguments; ensure at least 2 groups are present
SKILL_PACKAGE_NOT_FOUNDRequired R package is missingRun Rscript scripts/install_dependencies.R; note that file errors will only surface after packages are installed
SKILL_TIMEOUTAnalysis exceeded the configured timeoutIncrease --timeout or set --timeout 0

IF error persists, READ: references/troubleshooting.md

Troubleshooting note: In environments where packages are not yet installed, SKILL_PACKAGE_NOT_FOUND will fire before file-validation errors. Install dependencies first, then re-run to expose any file-related errors.


Input Validation

This skill accepts:

  1. An abundance or OTU-style feature matrix (CSV/TSV, features as rows, samples as columns)
  2. A group file with at least two groups (CSV/TSV, sample IDs and group labels)

If the user's request does not involve UMAP or t-SNE dimensionality reduction for group separation visualization — for example, asking to run differential expression testing, process single-cell RNA-seq with specialized pipelines, perform clustering without a group file, or impute missing values — do not proceed with the workflow. Instead respond:

"UMAP and t-SNE Analysis is designed to perform sample-level dimensionality reduction and visualization on abundance or OTU-style matrices. Your request appears to be outside this scope. Please provide a feature matrix and group file for UMAP/t-SNE, or use a more appropriate tool for differential expression testing, single-cell analysis, or clustering."


Testing

Test with Sample Data

bash
Rscript scripts/install_dependencies.R

Rscript scripts/main.R --help

Rscript scripts/main.R \
  -i tests/data/otu_table.csv \
  -g tests/data/group_info.csv \
  -o tests/output/ \
  -m both

Rscript tests/test_skill.R

Rscript tests/run_smoke_test.R

Validation Commands

bash
ls -la tests/output/
ls -la tests/output/table
ls -la tests/output/plot
ls -la tests/output/data
wc -l tests/output/table/tsne_coordinates.csv
wc -l tests/output/table/umap_coordinates.csv

The canonical sample data live in tests/data/. Use those files for examples, smoke tests, and regression checks. The canonical output layout is output_dir/table, output_dir/plot, and output_dir/data.


Implementation Checklist

  • CLI parsing with optparse
  • set.seed() for reproducibility
  • requireNamespace() dependency checks
  • Dependency bootstrap script
  • Session info recording
  • File reading instructions in SKILL.md
  • Modular script structure
  • Error handling with SKILL_* codes
  • Test data provided in tests/data/
  • Version-pinned dependency baseline in dependencies.lock.tsv
  • Automated testthat coverage for validation and plotting edge cases
  • Scripts in scripts/ directory
  • References in references/ directory

Last updated: 2026-04-27 | Version: 1.1.0

Meegeleverde bestanden

Zolang de skill geladen is, leest het model deze bestanden als dat nodig is. Het model kan ze alleen lezen; ze worden nooit uitgevoerd.

Veelgestelde vragen

Wat doet de AI-skill Umap Tsne Analysis?

Use when performing sample-level dimensionality reduction and visualization on abundance or OTU-style matrices with a companion group file, generating UMAP and/or t-SNE coordinates and plots for group separation assessment. NOT for: differential expression testing, single-cell workflows requiring dedicated embeddings pipelines, or analyses without a sample grouping file.

Waarom Umap Tsne Analysis gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Umap Tsne Analysis bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Umap Tsne Analysis in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/aipoch/medical-research-skills/tree/main/awesome-med-research-skills/Data%20Analysis/umap-tsne-analysis. TypingMind leest het bestand SKILL.md, bundelt de bijbehorende bestanden en installeert het geheel als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Umap Tsne Analysis gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Umap Tsne Analysis gebruiken?

Zoveel als je wilt. Je kunt Umap Tsne Analysis gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Umap Tsne Analysis gratis?

Ja. Deze skill is door aipoch op GitHub gepubliceerd onder de licentie MIT. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇