Skip to content
Written for v1.5.0· Last updated: Oct 15, 2026

Tutorial: Group Comparison Workflow ​

Core Feature

This tutorial covers features available in all Portrai Explorer deployments.

This tutorial demonstrates how to compare different cell populations or tissue regions using Portrai Explorer's visualization and subsetting tools.

Scenario ​

You want to:

  1. Define two groups for comparison (e.g., tumor vs. stroma)
  2. Compare gene expression between groups
  3. Visualize differences using scatter plots
  4. Export group assignments for statistical analysis

Prerequisites ​

Step 1: Define Comparison Groups ​

Identify Groups to Compare ​

Common comparisons:

  • Tumor region vs. Normal tissue
  • Different anatomical regions
  • Treatment vs. Control areas
  • Different cell type populations

Example: Tumor vs. Stroma ​

We'll compare cells in the tumor region to cells in the surrounding stroma.

Step 2: Select Group 1 (Tumor) ​

  1. Open Explorer in Spatial view
  2. Identify the tumor region visually
  3. You might color by a marker to help identify (e.g., tumor marker)

Draw Lasso Around Tumor ​

  1. Switch to the Lasso tool
  2. Draw a lasso around the tumor region
  3. Note the item count in the mode switcher (for example "1234 items")

Save as Subset Condition ​

  1. Click Items dropdown
  2. Select Add selection to subset
  3. The condition is named automatically (e.g., "Spatial Lasso A3F2")

Rename for Clarity ​

In the Subset:

  1. Find the lasso condition
  2. Note or rename to "Tumor Region" for reference

Save as a Saved Subset ​

  1. In the Subset Panel, click Save
  2. The saved subset gets an automatic name, ready to edit: type "Tumor Region" and press Enter

If the subset input field already shows the name of a saved subset you loaded earlier, click Save As instead: Save would overwrite that saved subset.

Step 3: Select Group 2 (Stroma) ​

Clear the Subset ​

  1. Click the Reset control in the subset input field (see Reset) to clear the subset and see all cells again. Use Reset rather than deleting the condition: after a Reset, the next Save creates a new saved subset instead of overwriting "Tumor Region"
  2. Return to the Lasso tool

Draw Lasso Around Stroma ​

  1. Draw a lasso around the stromal region
  2. Note the count of selected cells

Save as a Second Saved Subset ​

  1. Add this selection to subset, and rename the condition to "Stroma Region"
  2. Click Save and name the saved subset "Stroma Region"
  3. Now you have two saved subsets, one per region, listed under Saved Subsets in the Subset Panel

Step 4: Compare Using Color Mapping ​

View Tumor Cells Only ​

  1. In the Subset Panel, click "Tumor Region" under Saved Subsets to load it
  2. Color by a gene of interest
  3. Observe expression pattern and range

View Stroma Cells Only ​

  1. Load the "Stroma Region" saved subset; it replaces the current subset
  2. Keep same gene coloring
  3. Compare expression pattern to tumor

Note Observations ​

  • Is expression higher in tumor or stroma?
  • Are there spatial gradients?
  • Do specific sub-regions show different patterns?

Step 5: Compare Using Scatter Plot ​

Configure Scatter Plot ​

  1. Open the Plot extension
  2. Set X axis: Gene A expression
  3. Set Y axis: Gene B expression
  4. Apply: No subset (show all cells)

Color by Region ​

Create a visual comparison:

  1. If you have a region feature, color by it
  2. Or use cell type coloring
  3. Observe where different populations fall

Alternative: Subset Toggle ​

  1. Apply Tumor Region subset
  2. View scatter plot
  3. Switch to Stroma Region subset
  4. Compare the distributions

Step 6: Create Signatures for Comparison ​

Tumor Signature Genes ​

  1. Create Signature: "Tumor Markers"
  2. Add genes associated with tumor cells
  3. Save the signature

Stroma Signature Genes ​

  1. Create Signature: "Stroma Markers"
  2. Add genes associated with stromal cells
  3. Save the signature

Compare Signatures ​

  1. Open Scatter Plot
  2. X axis: Tumor Markers (Max or Sum)
  3. Y axis: Stroma Markers (Max or Sum)
  4. View the separation of populations

Step 7: Quantify Differences ​

Export Group 1 Data ​

  1. Apply Tumor Region subset
  2. Export gene expression or features with Download selected data
  3. Rename the downloaded file to "tumor_cells.csv"

Export Group 2 Data ​

  1. Apply Stroma Region subset
  2. Export the same data
  3. Rename the downloaded file to "stroma_cells.csv"

Statistical Analysis ​

Use exported data for:

  • Differential expression analysis
  • Statistical tests (t-test, Wilcoxon)
  • Visualization in R/Python

Step 8: Document Comparison ​

Save Subsets ​

The "Tumor Region" and "Stroma Region" saved subsets from Steps 2 and 3 stay in this browser for the project: load either one later to apply it again, and save any further subset you build the same way.

Screenshot Key Findings ​

  1. Capture comparison visualizations
  2. Save scatter plots showing separation
  3. Document expression patterns

Record Methods ​

Note your analysis steps:

  • How regions were defined
  • Which genes/markers used
  • Subset configurations
  • Statistical methods applied

Advanced Comparison Techniques ​

Three-Way Comparison ​

Compare multiple regions:

Subset (OR):
├── Group 1: Tumor Core
├── Group 2: Tumor Margin
└── Group 3: Normal Tissue

Cell Type Within Region ​

Nested comparison:

  1. Subset: Tumor Region
  2. Then subdivide by cell type
  3. Compare T cells in tumor vs. stroma

Using UMAP for Comparison ​

  1. Switch to UMAP projection
  2. Color by region assignment
  3. See if regions cluster separately
  4. Draw lasso in UMAP space for transcriptional groups

Comparing All Categories at Once with Facet View ​

When your groups are encoded as a categorical feature (e.g., a region or cell type column), Facet View lets you compare every group side by side instead of toggling subsets one at a time:

  1. Enable Facet view from the Map Viewer toolbar
  2. Facet by your region or cell type column
  3. Color by a gene of interest — every panel shares the same color scale, so expression is directly comparable across groups
  4. Optionally restrict the grid to just the categories you want to compare

Summary ​

In this tutorial, you learned to:

StepTechnique
1-3Define comparison groups with lasso
4Compare using color mapping
5Compare using scatter plots
6Create signatures
7Export for quantitative analysis
8Document your comparison

Next Steps ​

  • Export data for statistical testing in R/Python
  • Create publication-quality figures
  • Apply similar workflow to other comparisons
  • Explore Subset for complex group definitions

Portrai Explorer Documentation