Skip to content

Select regions

A lasso is drawn around a group of cells; the cells inside stay bright, a selection row appears in the layers list, then the selection is removed.

Draw a lasso, square, circle or shape around cells, then read the selection back in Python.

import milume
w = milume.peek(adata)  # press L, then drag around some cells
sel_id = w.selections[-1]["id"]

Controls

The four selection tools share one toolbar button. Click it to arm the last-used tool, or right-click it to pick another.

Control What it does
Lasso (L) Drag a freehand outline.
Square (R) Drag a rectangle.
Circle (O) Drag an ellipse.
Shape (G) Click vertices of a polygon; press Enter to finish.
Shape menu (right-click) Choose which of the four tools the button arms.
Layer actions Rename, hide or delete the selection from the layers list.
The selection tool button right-clicked, showing a menu with Lasso, Square, Circle and Shape, each with its icon. The selection tool button right-clicked, showing a menu with Lasso, Square, Circle and Shape, each with its icon.

Square and circle

A square selection is dragged out over the cells, held, then removed.
A circle selection is dragged out over the cells, held, then removed.

While a selection is active

The cells inside stay at full color and the right panel counts only them. A small toolbar at the bottom of the map offers Radius neighborhood and k-NN neighborhood around the selection, with Make selection to keep that neighborhood as a new selection. Press ⌫ or Delete to remove the active selection.

A square selection with k-NN neighborhood on; the k slider moves up and back and the ring of neighboring cells grows and shrinks.

Python

w.selections updates on every edit. Join hits to observations by name:

hits = w.get_obs_names(adata, sel_id)  # obs names inside
w.assign_obs_mask(adata, "in_region", selection_id=sel_id)
w.clear_selections()

See Methods for the full signatures.