LBFfextract package
Module contents
LBFextract
LBFextract is a Python package designed for extracting features from a BAM file, with a particular emphasis on liquid
biopsy-related features and transcription factors. The package employs a plugin interface where each plugin represents a
feature that can be extracted from a BAM file. It consists of a core package housing the main logic, supplemented by a
collection of plugins encompassing various features. Within the lbfextract package, the core components include:
Core Module: Describes the workflow and underlying logic.
CLI Module: Constructs the Command-Line Interface (CLI).
Feature Extractor: Builds the Python interface.
Hookspecs: Defines the interface for hooks.
Plugin Manager: Manages the loading of plugins.
Third-party plugins can implement the following hooks:
fetch_reads: Extracts features from a BAM file.
load_reads: Loads reads if previously extracted.
save_fetched_reads: Saves the fetched reads specific to regions of interest.
transform_reads: Applies transformations to each extracted read.
transform_single_intervals: Extracts the signal of a single region.
transform_all_intervals: Applies transformations requiring data from all regions.
plot_signal: Plots the final signal.
save_signal: Saves the final signal.
LBFextract utilizes Pluggy to provide an interface for third-party software. The general interface for hooks, located
in the hookspecs.py file, outlines the expected signatures for plugins. Default hook implementations are found in
lib.py within the fextract subpackage.
Additionally, CLI-specific hooks are specified in hookspecs.py, with default implementations found in cli_lib.py
and other subpackage plugin modules. These hooks supply CLI commands to execute workflows associated with each plugin.
For seamless integration with Python, the FeatureExtractor object allows users to invoke different feature
extraction methods programmatically. Upon installing new plugins containing cli_hooks, the associated commands are
automatically incorporated into the FeatureExtractor object as accessible methods.
To maintain consistency, each plugin should include a schema.py file defining the configuration schema for its
feature extraction method. Refer to existing plugins, particularly those generating default coverage and
fragmentomics-based signals, for guidance. Schemas should adhere to the Voluptuous schema syntax.
(voluptuous documentation).