High-level description

This file contains unit tests for the config parsing functionality of the cassiopeia_preprocess pipeline. It tests the parsing of configuration files, the creation of pipeline stages, and the handling of various configuration scenarios.

Code Structure

The main class TestCollapseUMIs inherits from unittest.TestCase and contains several test methods. The setUp method initializes test data, including different configuration scenarios. The test methods then use this data to verify the correct behavior of the config parsing and pipeline setup functions.

Symbols

TestCollapseUMIs

Description

A test class that inherits from unittest.TestCase, containing methods to test the configuration parsing and pipeline setup for the cassiopeia_preprocess pipeline.

Internal Logic

  1. Sets up test data in the setUp method, including various configuration scenarios.
  2. Tests the parsing of a valid configuration file.
  3. Tests the handling of an unspecified configuration parameter.
  4. Tests the correct setup of the full pipeline.
  5. Tests the correct setup of a subset pipeline.

TestCollapseUMIs.setUp

Description

Initializes test data for the test cases, including different configuration scenarios.

Internal Logic

  1. Creates a basic configuration dictionary and its string representation.
  2. Creates a subset configuration dictionary and its string representation.
  3. Creates a failure configuration dictionary and its string representation.

TestCollapseUMIs.test_read_good_config

Description

Tests the parsing of a valid configuration file.

Internal Logic

  1. Parses the basic configuration string.
  2. Checks that default parameters are set correctly.
  3. Verifies that specified parameters are updated correctly.
  4. Ensures that output directories are set for various pipeline stages.

TestCollapseUMIs.test_unspecified_config_raises_error

Description

Tests that an error is raised when an unspecified configuration parameter is encountered.

Internal Logic

  1. Attempts to parse the failure configuration string.
  2. Asserts that a UnspecifiedConfigParameterError is raised.

TestCollapseUMIs.test_pipeline_setup_correct

Description

Tests the correct setup of the full pipeline.

Internal Logic

  1. Parses the basic configuration string.
  2. Creates the pipeline using the entry and exit points from the configuration.
  3. Compares the created pipeline stages with the expected stages.

TestCollapseUMIs.test_subset_pipeline_setup_correct

Description

Tests the correct setup of a subset pipeline.

Internal Logic

  1. Parses the subset configuration string.
  2. Creates the pipeline using the entry and exit points from the configuration.
  3. Compares the created pipeline stages with the expected subset of stages.

Dependencies

DependencyPurpose
unittestProvides the testing framework
pandasUsed for data manipulation (imported but not used in the test file)
cassiopeia.preprocess.cassiopeia_preprocessContains the main pipeline logic
cassiopeia.preprocess.constantsContains constants used in the pipeline
cassiopeia.preprocess.setup_utilitiesProvides utility functions for setting up the pipeline

Error Handling

The test cases check for proper error handling, specifically testing that a UnspecifiedConfigParameterError is raised when an unspecified configuration parameter is encountered.

This test file ensures that the configuration parsing and pipeline setup functionality of the cassiopeia_preprocess pipeline works correctly under various scenarios, including full pipeline setup, subset pipeline setup, and handling of configuration errors.