BasePipeline
TheBasePipeline class is an abstract base class that provides the foundation for all HeartMAP analysis pipelines. It defines the common interface and shared functionality that all pipeline implementations must follow.
Class Overview
BasePipeline is an abstract class from Python’s abc module that cannot be instantiated directly. Instead, you should use one of its concrete implementations:
- BasicPipeline - Basic single-cell analysis
- AdvancedCommunicationPipeline - Cell-cell communication analysis
- MultiChamberPipeline - Chamber-specific analysis
- ComprehensivePipeline - Complete HeartMAP analysis
Import
Constructor
__init__(config: Config)
Initialize a pipeline with the given configuration.
HeartMAP configuration object containing data, analysis, and model settings
Attributes
All pipelines inheriting fromBasePipeline have the following attributes:
Configuration object passed during initialization
Data processor instance for loading and preprocessing data
Visualizer instance for creating plots and figures
Results exporter instance for saving analysis outputs
Dictionary storing pipeline results after execution
Abstract Methods
run(data_path: str, output_dir: Optional[str] = None) -> Dict[str, Any]
Run the complete analysis pipeline. This method must be implemented by all concrete pipeline classes.
Path to input data file (typically
.h5ad format)Directory to save output files. If
None, results are not saved to disk.Dict[str, Any]
Dictionary containing analysis results. The structure depends on the specific pipeline implementation.
Methods
save_results(output_dir: str) -> None
Save pipeline results to the specified directory.
Directory path where results will be saved
- Creates the output directory if it doesn’t exist
- Uses the
ResultsExporterto save analysis results - Exports results in various formats (JSON, CSV, plots)
Creating Custom Pipelines
To create a custom pipeline, inherit fromBasePipeline and implement the run method:
Example Usage
SinceBasePipeline is abstract, you’ll typically work with concrete implementations:
Related Documentation
BasicPipeline
Basic single-cell analysis pipeline
AdvancedCommunicationPipeline
Cell-cell communication analysis
MultiChamberPipeline
Chamber-specific analysis
ComprehensivePipeline
Complete HeartMAP analysis
See Also
- Custom Pipelines Guide - Learn how to create custom analysis pipelines
- Config API Reference - Configuration options
- DataProcessor API Reference - Data processing utilities