Skip to content

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:

Look up a name in phenome-api.json or the function location guide. Do not invent a method, preset, metadata key, or parameter.

  • Import from phenome import PhenoMe, load_dinov2_model. Pass device into both. Add also a seed to keep it reproducible by default.
  • Order: find_files, with metadata from get_metadata_from_path (a path template) or make_dataframe_metadata_fn (a table) → read the file table, plot_image_by_index, and inspect_data → process_images, or load an existing run → compute_properties when classical measurements are needed → plot_pca, plot_tsne, or plot_umap. Those plots compute the projection themselves. correct_batches only when plate or batch labels and controls are present. Multi-channel images set channel_mode to split or combined.
  • One checkpoint file uses load_results. Separate embedding and property files use load_embeddings, then load_properties. New images on an existing projection use process_temporal_images. Those rows stay in memory; plot or export them, then call clear_temporal_data.
  • Do not change logging, plot format, or report sections unless asked. save_results writes HDF5 only.
  • For a handoff, call save_results. Add export_experiment_config, export_methods_markdown, or generate_report(..., include_run_settings=True) only for the files the user should receive.
  • For a summary, keep tables and return_fig=True figures in variables and read get_run_settings() or print_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 from inspect_data. If the default 224-pixel square would compress the content too far or stretch a non-square image, set resize_size and pad_size. An int is a square side. A pair (height, width) keeps a rectangular frame.
  • Call get_available_metadata_keys() before color_by, filters, or batch_metadata_key, and get_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, and complete. intensity does 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_explorer in Colab). A .py script 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, and top_properties_different_from_reference. Counts per group use plot_counts. Groups and unusual images use compute_clustering, analyze_group_enrichment, find_prototypes, and detect_outliers. A time course of group centers uses plot_centroids.
  • Linking embeddings to measurements uses compute_component_correlation for one projection, compute_embedding_property_correlations and summarize_embedding_property_correlations for embedding dimensions, and compute_multivariate_interpretability for a joint fit.
  • A custom property uses register_property from phenome.plugins. A model other than DINOv2 subclasses ModelWrapper from phenome.utils and implements _get_embeddings. Changes to images before that model are preprocessing_fn and custom_transformations on process_images.

For Cursor or Claude Desktop, see MCP for PhenoMe.