Using PhenoMe with LLMs
This page is for scientists using PhenoMe. Most are not programmers, so a notebook or a script should stay easy to read and follow. The workflow is in Getting started and Common workflows. People who change PhenoMe itself follow the repository AGENTS.md.
A developer assistant builds that scientist’s analysis tool with from phenome import PhenoMe, load_dinov2_model. An analysis assistant runs the dataset and either saves the run or summarizes it.
Generated from the same docs build:
- llms-small.txt — getting started, workflows, folder patterns, FAQ, this page, and MCP
- llms-full.txt — the whole site, including the API reference
- phenome-api.json — public methods and signatures
Look up a name in phenome-api.json or the function location guide. Do not invent a method, preset, metadata key, or parameter.
Constraints
Section titled “Constraints”- Import
from phenome import PhenoMe, load_dinov2_model. Passdeviceinto both. Add also aseedto keep it reproducible by default. - Order:
find_files, with metadata fromget_metadata_from_path(a path template) ormake_dataframe_metadata_fn(a table) → read the file table,plot_image_by_index, andinspect_data→process_images, or load an existing run →compute_propertieswhen classical measurements are needed →plot_pca,plot_tsne, orplot_umap. Those plots compute the projection themselves.correct_batchesonly when plate or batch labels and controls are present. Multi-channel images setchannel_modetosplitorcombined. - One checkpoint file uses
load_results. Separate embedding and property files useload_embeddings, thenload_properties. New images on an existing projection useprocess_temporal_images. Those rows stay in memory; plot or export them, then callclear_temporal_data. - Do not change logging, plot format, or report sections unless asked.
save_resultswrites HDF5 only. - For a handoff, call
save_results. Addexport_experiment_config,export_methods_markdown, orgenerate_report(..., include_run_settings=True)only for the files the user should receive. - For a summary, keep tables and
return_fig=Truefigures in variables and readget_run_settings()orprint_processing_pipeline(). - After each step, read the printed text and any variable you kept. Before
process_images, the file count, metadata keys, and the sample image have to match the dataset. Read height and width frominspect_data. If the default 224-pixel square would compress the content too far or stretch a non-square image, setresize_sizeandpad_size. An int is a square side. A pair(height, width)keeps a rectangular frame. - Call
get_available_metadata_keys()beforecolor_by, filters, orbatch_metadata_key, andget_available_property_keys()before naming a property. - Folder patterns use
(name)groups, as in Using folder names. Brace placeholders do not match. - Preset names are
none,intensity,shape,basic,standard, andcomplete.intensitydoes not need masks. See Presets. - The usual analysis is a notebook, so the user can see the plot and open
create_interactive_explorer(create_colab_interactive_explorerin Colab). A.pyscript is fine when the user asked for one, or when a notebook is not available. - Run only the comparison the question asks for. A treatment against a reference uses
compute_reference_distances,property_stats_by_group, andtop_properties_different_from_reference. Counts per group useplot_counts. Groups and unusual images usecompute_clustering,analyze_group_enrichment,find_prototypes, anddetect_outliers. A time course of group centers usesplot_centroids. - Linking embeddings to measurements uses
compute_component_correlationfor one projection,compute_embedding_property_correlationsandsummarize_embedding_property_correlationsfor embedding dimensions, andcompute_multivariate_interpretabilityfor a joint fit. - A custom property uses
register_propertyfromphenome.plugins. A model other than DINOv2 subclassesModelWrapperfromphenome.utilsand implements_get_embeddings. Changes to images before that model arepreprocessing_fnandcustom_transformationsonprocess_images.
For Cursor or Claude Desktop, see MCP for PhenoMe.
