Skip to content

xcell 0.4.0

Choose a tag to compare

@github-actions github-actions released this 30 Oct 15:48
· 57 commits to main since this release
  • Add menu replaces Draw, and text labels on embeddings (toolbar → Add). The toolbar's Draw button is now Add, its menu grouped as Shape (Lasso, Polygon), Line (Pencil, Smooth Curve, Segmented Line) and Text. In Text mode a click on the plot places a label and a click on a label opens an editor for its text (multi-line), size, color, bold, italic, alignment, rotation, and an optional background box with color and opacity; a drag moves it. Positions are in the embedding's data coordinates (sizes in screen pixels), so labels stay on their cells under pan and zoom and travel with Adjust's rotate, flip and quilt moves (only the anchor moves; labels stay upright). A label belongs to the embedding and column pair it was placed on, is stored per dataset in uns['xcell_text_annotations_json'], and is restored on load, so exports carry it; deleting a cell subset with its derived embeddings drops the labels on them. The next label starts in the last one's style. GET/POST /api/text_annotations. Labels are not yet drawn into snapshots or the Figures system. Design note: docs/superpowers/specs/2026-10-30-add-menu-pca-hits-obs-manager-design.md.
  • PCA Loadings: gene-set hits (Analyze → Cells → PCA Loadings). A gene field above the loadings table (comma, semicolon, space or newline separated; or filled from a Gene Panel set, up and down genes together, via From gene set…) marks each listed gene that appears in a PC's displayed top-N positive or negative list: accent chip in the list, an accent bar on the row, and a Hits column as total (pos+/neg−). Matching ignores case, so a human-cased set still hits mouse symbols. Order PCs: Most gene-set hits sorts by total hits, ties and zero-hit PCs by PC number; the checked PCs for a PC subset are keyed by PC number, so reordering does not change them. A summary line gives how many of the genes appear in the top N of at least one PC and how many PCs have hits, and a muted line lists the genes in no displayed list (they may load just below the top N). Computed in the browser over the table as shown (lib/pcaLoadingHits.ts); no backend change. The gene field clears on a dataset switch and survives a PCA re-run.
  • .obs manager (Cells panel → ⚙ .obs). A table of every .obs column with its kind (categorical, boolean, integer, float, string, other), pandas dtype, unique and missing counts, and a preview: the three most frequent values, or min · median · max over the finite values. Sort by name, type, unique or missing; filter by name and by kind. The colour-by column, saved-subset membership columns, tool prefixes (UCell_, leiden, subset_, …) and stored palettes are marked. Tick columns, shift-click for a range or tick all shown, then Delete (one recorded step; the confirm dialog names any saved subset that goes with its column, and colour palettes go too) or Export (TSV with cell ids, through the existing annotations export). Per column: Rename (moves <col>_colors; refuses a taken name and a saved subset's column), Duplicate, and Convert to categorical, string (missing stays missing), numeric (refused with a count and an example of a value that does not parse) or boolean (columns with at most two values and none missing; true/false, yes/no, 1/0 read themselves, otherwise you pick which value is True). Every operation drops a converted column's palette, refreshes the schema and the Cells panel, and has a codegen entry that replays it exactly in the notebook export. GET /api/obs/columns, POST /api/obs/delete_columns, /api/obs/rename_column, /api/obs/duplicate_column, /api/obs/convert_column (column names in the body, so a name containing / works). Note that AnnData stores string columns as categoricals when writing h5ad, so a conversion to string lasts only for the session.
  • Filter Cells: mitochondrial fraction, and cutoffs at ± k MAD (Analyze → Preprocess → Filter Cells). A third histogram shows each cell's percentage of counts from mitochondrial genes, with draggable Min/Max % mito cutoffs bound to two new thresholds (min_pct_mt, max_pct_mt). Mitochondrial means a boolean .var['mt'] column when one exists, else gene names starting mt- in either case; the panel says which and how many, and says so when neither applies. Each histogram has a ± MAD box: typing k places both cutoffs at median ± k × MAD (unscaled, as in scipy and the sc-best-practices QC chapter) on the axis as drawn — the log axis for counts and genes, linear for the percentage — and a cutoff that would fall outside the data is left unset. The box is a shortcut, not a parameter: it fills the same thresholds the lines and the inputs set, and clears itself when one is changed by hand. The notebook export reproduces a mitochondrial threshold as the same per-cell percentage over the recorded gene set, since scanpy's filter_cells has no such option. GET /api/scanpy/filter_cells/qc adds pct_mt and mt_source.
  • Filter Genes: threshold histograms (Analyze → Preprocess → Filter Genes). The same panel as Filter Cells, per gene: total counts and cells expressing, with draggable cutoffs for Min/Max counts and Min cells / Max cells and a live count of the genes that pass. The cells chart is drawn in cells while Min cells stays a percentage of the dataset; a dragged cutoff converts through the same rounding the request uses, so the line shows the count scanpy will be given. GET /api/scanpy/filter_genes/qc.
  • Exclude Genes: patterns preset by species (Analyze → Preprocess → Exclude Genes). When the gene names say human, the pattern field opens as ^MT-, ^ENS, ^RPS, ^RPL, ^LINC instead of the mouse ^mt-, ^Gm\d+, ^Rps, ^Rpl. Only the stock default is replaced: a value from the user config, or an edit, stays.
  • Heatmap: order cells by similarity (Heatmap → Configure → Cell Ordering, and the expression-heatmap figure). By similarity (clustered) lays the columns out in dendrogram leaf order of an average-linkage clustering of the cells on the selected genes, each gene scaled to its own range so none dominates the distance, before the cells are binned; Category, then similarity does the same inside each category block. Above 5,000 cells (heatmap.SIMILARITY_EXACT_MAX_CELLS) the cells are first collapsed to 500 k-means centroids, the centroids are clustered, and each centroid's cells are laid out along the axis to the next one; the footer says cells clustered via centroids when that happened (about 4 s at 60k cells × 30 genes). The response carries cell_ordering_method (exact, centroids, or null for the other orderings). A figure whose default ordering is Category, then similarity but has no column degrades to By similarity; an explicit one is refused (400), like the other category orderings.
  • Heatmap: order genes by similarity (Heatmap → Configure → Gene Ordering, and the expression-heatmap figure). By similarity (clustered) lays the rows out in dendrogram leaf order of an average-linkage clustering of each gene's normalised profile, so genes with the same shape sit together; inside each gene set when sets are shown, like By peak position. An unknown ordering is now refused (400) rather than silently drawn as provided.