High-level description

This file contains unit tests for the call_lineage_groups function in the Cassiopeia preprocessing pipeline. The tests verify the functionality of lineage group assignment, including basic grouping, doublet handling, reassignment, and filtering.

Code Structure

The main class TestCallLineageGroup contains several test methods, each testing different aspects of the call_lineage_groups function. The setUp method initializes test data for various scenarios.

Symbols

TestCallLineageGroup

Description

A unittest.TestCase subclass containing tests for the call_lineage_groups function.

Internal Logic

  1. Sets up test data in setUp method
  2. Defines multiple test methods to check different aspects of lineage group assignment

setUp

Description

Initializes test data for various scenarios, including basic grouping, reassignment, filtering, and doublet handling.

Internal Logic

  1. Creates multiple pandas DataFrames with test data
  2. Sets up different scenarios for lineage group assignment testing

test_format

Description

Tests if the output of call_lineage_groups has the expected columns.

Internal Logic

  1. Calls call_lineage_groups with test data
  2. Checks if the output DataFrame contains all expected columns

test_basic_grouping

Description

Tests basic lineage group assignment functionality.

Internal Logic

  1. Calls call_lineage_groups with basic test data
  2. Verifies if the assigned lineage groups and UMI counts match expected values

test_doublet

Description

Tests lineage group assignment with potential doublets.

Internal Logic

  1. Calls call_lineage_groups with doublet test data
  2. Checks if doublets are correctly identified and assigned

test_reassign

Description

Tests reassignment of cells to lineage groups.

Internal Logic

  1. Calls call_lineage_groups with reassignment test data
  2. Verifies if cells are correctly reassigned to appropriate lineage groups

test_filter_reassign

Description

Tests filtering and reassignment of lineage groups.

Internal Logic

  1. Calls call_lineage_groups with filter and reassign test data
  2. Checks if filtering and reassignment are performed correctly

test_filter_lineage_group_to_allele_table_single_lineage

Description

Tests the conversion of filtered lineage groups to an allele table for a single lineage.

Internal Logic

  1. Calls filtered_lineage_group_to_allele_table with test data
  2. Verifies if the resulting allele table is correct for a single lineage

Dependencies

  • unittest
  • numpy
  • pandas
  • cassiopeia (specifically the pipeline and lineage_utils modules)

The test file relies on the cassiopeia package, particularly the pipeline and lineage_utils modules, to perform lineage group assignments and related operations.