LeafSubsampler.py
High-level description
The LeafSubsampler
class in LeafSubsampler.py
defines an abstract base class for all leaf samplers in the Cassiopeia library. It provides a blueprint for creating derived classes that implement different methods for subsampling the leaves of a CassiopeiaTree.
Leaf subsampling is a common operation in phylogenetic analysis, where a subset of leaves (representing cells or taxa) is selected from a larger tree to perform downstream analyses. This can be useful for reducing computational complexity, focusing on specific lineages, or simulating different sampling scenarios.
Code Structure
This code defines an abstract base class LeafSubsampler
with one abstract method subsample_leaves
. This method is meant to be implemented by concrete leaf subsampler classes that inherit from this base class.
References
This code references the following symbols from other files:
cassiopeia.data.CassiopeiaTree
: This class represents a phylogenetic tree with associated data, such as character states and metadata.cassiopeia.mixins.LeafSubsamplerError
: This exception class is raised for errors specific to leaf subsampling operations.cassiopeia.mixins.LeafSubsamplerWarning
: This warning class is used to issue warnings related to leaf subsampling.abc.ABC
andabc.abstractmethod
: These are used to define abstract base classes and methods, ensuring that derived classes implement the required functionality.
Symbols
LeafSubsampler
Description
This is an abstract base class for all leaf samplers. It defines the interface that concrete leaf sampler classes must implement.
Inputs
This class does not have an __init__
method and therefore does not take any inputs.
Outputs
This class does not directly return any outputs.
Internal Logic
This class does not have any internal logic as it is an abstract base class.
Side Effects
This class does not have any side effects as it is an abstract base class.