Modules¶
model
¶
Classes¶
Modules¶
standard_profile
¶
Provide a description of the standard profile format.
Classes¶
StandardProfile
¶
Bases: DataFrameModel
Define the standard profile format.
Source code in src/taxpasta/domain/model/standard_profile.py
tidy_observation_table
¶
Provide a description of a tidy observation table.
Classes¶
TidyObservationTable
¶
Bases: DataFrameModel
Define the tidy observation table.
Source code in src/taxpasta/domain/model/tidy_observation_table.py
count: Series[np.int64] = pa.Field(ge=0)
class-attribute
instance-attribute
¶id_lineage: Optional[Series[pd.CategoricalDtype]] = pa.Field()
class-attribute
instance-attribute
¶lineage: Optional[Series[pd.CategoricalDtype]] = pa.Field()
class-attribute
instance-attribute
¶name: Optional[Series[pd.CategoricalDtype]] = pa.Field()
class-attribute
instance-attribute
¶rank: Optional[Series[pd.CategoricalDtype]] = pa.Field()
class-attribute
instance-attribute
¶rank_lineage: Optional[Series[pd.CategoricalDtype]] = pa.Field()
class-attribute
instance-attribute
¶sample: Series[pd.CategoricalDtype] = pa.Field()
class-attribute
instance-attribute
¶taxonomy_id: Series[pd.CategoricalDtype] = pa.Field()
class-attribute
instance-attribute
¶Config
¶Configure the schema model.
Source code in src/taxpasta/domain/model/tidy_observation_table.py
wide_observation_table
¶
Provide a description of an observation matrix.
Classes¶
WideObservationTable
¶
Bases: DataFrameModel
Define the observation matrix.
Source code in src/taxpasta/domain/model/wide_observation_table.py
any_samples: Series[np.int64] = pa.Field(ge=0, alias='^(?!(taxonomy_id|name|rank|lineage|id_lineage|rank_lineage)$).*', regex=True)
class-attribute
instance-attribute
¶id_lineage: Optional[Series[pd.CategoricalDtype]] = pa.Field()
class-attribute
instance-attribute
¶lineage: Optional[Series[pd.CategoricalDtype]] = pa.Field()
class-attribute
instance-attribute
¶name: Optional[Series[pd.CategoricalDtype]] = pa.Field()
class-attribute
instance-attribute
¶rank: Optional[Series[pd.CategoricalDtype]] = pa.Field()
class-attribute
instance-attribute
¶rank_lineage: Optional[Series[pd.CategoricalDtype]] = pa.Field()
class-attribute
instance-attribute
¶taxonomy_id: Series[pd.CategoricalDtype] = pa.Field()
class-attribute
instance-attribute
¶Config
¶Configure the schema model.
Source code in src/taxpasta/domain/model/wide_observation_table.py
service
¶
Attributes¶
Classes¶
Modules¶
consensus_builder
¶
Provide a builder service for creating a consensus between many profiles.
Classes¶
ConsensusBuilder
¶
Bases: ABC
Define a builder service for creating a consensus between many profiles.
Source code in src/taxpasta/domain/service/consensus_builder.py
sample_merging_service
¶
Provide a sample merging service that summarizes two or more samples.
Classes¶
SampleMergingService
¶Define a sample merging service that summarizes one or more samples.
Source code in src/taxpasta/domain/service/sample_merging_service.py
merge_long(samples: Iterable[Sample]) -> DataFrame[TidyObservationTable]
classmethod
¶Merge two or more sample profiles into a tidy observation table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
samples |
Iterable[Sample]
|
Two or more samples. |
required |
Returns:
Type | Description |
---|---|
DataFrame[TidyObservationTable]
|
A single table containing three columns: taxonomy identifier, abundance |
DataFrame[TidyObservationTable]
|
count, and sample identifier. |
Source code in src/taxpasta/domain/service/sample_merging_service.py
merge_wide(samples: Iterable[Sample]) -> DataFrame[WideObservationTable]
classmethod
¶Merge two or more sample profiles into a wide-format observation matrix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
samples |
Iterable[Sample]
|
Two or more samples. |
required |
Returns:
Type | Description |
---|---|
DataFrame[WideObservationTable]
|
A single table containing one row per taxon, one column for the taxonomy |
DataFrame[WideObservationTable]
|
identifier, and one column per sample with abundance counts. |
Source code in src/taxpasta/domain/service/sample_merging_service.py
taxonomy_service
¶
Provide an abstract taxonomy service interface.
Attributes¶
ResultTable = TypeVar('ResultTable', TidyObservationTable, WideObservationTable, StandardProfile)
module-attribute
¶Classes¶
TaxonomyService
¶
Bases: ABC
Define the abstract taxonomy service interface.
Source code in src/taxpasta/domain/service/taxonomy_service.py
__init__(**kwargs) -> None
¶add_identifier_lineage(table: DataFrame[ResultTable]) -> DataFrame[ResultTable]
abstractmethod
¶Add a column for the taxon lineage as identifiers to the given table.
add_name(table: DataFrame[ResultTable]) -> DataFrame[ResultTable]
abstractmethod
¶add_name_lineage(table: DataFrame[ResultTable]) -> DataFrame[ResultTable]
abstractmethod
¶add_rank(table: DataFrame[ResultTable]) -> DataFrame[ResultTable]
abstractmethod
¶add_rank_lineage(table: DataFrame[ResultTable]) -> DataFrame[ResultTable]
abstractmethod
¶Add a column for the taxon lineage as ranks to the given table.
format_biom_taxonomy(table: DataFrame[ResultTable]) -> List[Dict[str, List[str]]]
abstractmethod
¶get_taxon_identifier_lineage(taxonomy_id: int) -> Optional[List[int]]
abstractmethod
¶Return the lineage of a given taxonomy identifier as identifiers.
get_taxon_name(taxonomy_id: int) -> Optional[str]
abstractmethod
¶get_taxon_name_lineage(taxonomy_id: int) -> Optional[List[str]]
abstractmethod
¶get_taxon_rank(taxonomy_id: int) -> Optional[str]
abstractmethod
¶get_taxon_rank_lineage(taxonomy_id: int) -> Optional[List[str]]
abstractmethod
¶summarise_at(profile: DataFrame[StandardProfile], rank: str) -> DataFrame[StandardProfile]
abstractmethod
¶Summarise a standardised abundance profile at a higher taxonomic rank.