Application
Classes¶
Modules¶
add_tax_info_command
¶
Provide a command object for adding taxonomy information.
Attributes¶
Table = TypeVar('Table', DataFrame[TidyObservationTable], DataFrame[WideObservationTable], DataFrame[StandardProfile])
module-attribute
¶
Classes¶
AddTaxInfoCommand
dataclass
¶
Define the command object for adding taxonomy information.
Source code in src/taxpasta/application/add_tax_info_command.py
Attributes¶
add_id_lineage: bool = False
class-attribute
instance-attribute
¶add_lineage: bool = False
class-attribute
instance-attribute
¶add_name: bool = False
class-attribute
instance-attribute
¶add_rank: bool = False
class-attribute
instance-attribute
¶add_rank_lineage: bool = False
class-attribute
instance-attribute
¶summarise_at: Optional[str] = None
class-attribute
instance-attribute
¶taxonomy_service: Optional[TaxonomyService] = None
class-attribute
instance-attribute
¶Functions¶
__init__(taxonomy_service: Optional[TaxonomyService] = None, summarise_at: Optional[str] = None, add_name: bool = False, add_rank: bool = False, add_lineage: bool = False, add_id_lineage: bool = False, add_rank_lineage: bool = False) -> None
¶__post_init__() -> None
¶Perform post initialization validation.
Source code in src/taxpasta/application/add_tax_info_command.py
execute(table: Table) -> Table
¶Execute the command to add taxonomy information.
Source code in src/taxpasta/application/add_tax_info_command.py
consensus_application
¶
Provide an abstract base class for consensus building applications.
Classes¶
ConsensusApplication
¶
Bases: ABC
Define an abstract base class for consensus building applications.
Source code in src/taxpasta/application/consensus_application.py
Functions¶
run(profiles: Iterable[DataFrame[StandardProfile]], taxonomy: Path) -> DataFrame
abstractmethod
classmethod
¶Build a consensus from two or more taxonomic profiles.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
profiles |
Iterable[DataFrame[StandardProfile]]
|
Standardized profiles. |
required |
taxonomy |
Path
|
Provide a shared taxonomy. |
required |
Source code in src/taxpasta/application/consensus_application.py
error
¶
Classes¶
Modules¶
standardisation_error
¶
Provide an exception for errors during profile extraction and transformation.
Classes¶
StandardisationError
¶
Bases: TaxpastaError
Define an exception for errors during profile extraction and transformation.
Source code in src/taxpasta/application/error/standardisation_error.py
message = message
instance-attribute
¶profile = profile
instance-attribute
¶sample = sample
instance-attribute
¶__init__(*, sample: str, profile: Path, message: str, **kwargs) -> None
¶Initialize a taxpasta standardisation error.
Source code in src/taxpasta/application/error/standardisation_error.py
sample_handling_application
¶
Provide a sample handling application.
Attributes¶
logger = logging.getLogger(__name__)
module-attribute
¶
Classes¶
SampleHandlingApplication
¶
Define the sample handling application.
Source code in src/taxpasta/application/sample_handling_application.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
Attributes¶
reader = profile_reader
instance-attribute
¶standardiser = profile_standardiser
instance-attribute
¶taxonomy_service = taxonomy_service
instance-attribute
¶Functions¶
__init__(*, profile_reader: Type[ProfileReader], profile_standardiser: Type[ProfileStandardisationService], taxonomy_service: Optional[TaxonomyService] = None, **kwargs: dict)
¶Initialize the sample handling application.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
profile_reader |
Type[ProfileReader]
|
A profile reader for a specific taxonomic profile format. |
required |
profile_standardiser |
Type[ProfileStandardisationService]
|
A profile standardisation service for a specific taxonomic profile format. |
required |
taxonomy_service |
Optional[TaxonomyService]
|
A taxonomy service instance. It is assumed that all profiles to be handled in the application are based on the given taxonomy loaded in the service instance. |
None
|
**kwargs |
dict
|
Passed on for inheritance. |
{}
|
Source code in src/taxpasta/application/sample_handling_application.py
etl_sample(name: str, profile: Path) -> Sample
¶Extract, transform, and load a profile into a sample.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
A name for the sample. |
required |
profile |
Path
|
The path to a taxonomic profile. |
required |
Returns:
Type | Description |
---|---|
Sample
|
A sample. |
Raises:
Type | Description |
---|---|
StandardisationError
|
If the given profile does not match the validation schema. |
Source code in src/taxpasta/application/sample_handling_application.py
merge_samples(samples: Iterable[Sample], wide_format: bool) -> DataFrame[WideObservationTable] | DataFrame[TidyObservationTable]
¶Merge two or more samples into a single table.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
samples |
Iterable[Sample]
|
Two or more samples. |
required |
wide_format |
bool
|
Whether to create wide or (tidy) long format output. |
required |
Returns:
Type | Description |
---|---|
DataFrame[WideObservationTable] | DataFrame[TidyObservationTable]
|
A single table containing all samples in the desired format. |
Source code in src/taxpasta/application/sample_handling_application.py
summarise_sample(sample: Sample, rank: str) -> Sample
¶Summarise a sample at a higher taxonomic rank.
Source code in src/taxpasta/application/sample_handling_application.py
service
¶
Attributes¶
Classes¶
Modules¶
profile_reader
¶
Provide an abstract base class for reading taxonomic profiles.
Attributes¶
Classes¶
ProfileReader
¶
Bases: ABC
Define an abstract base class for reading taxonomic profiles.
Source code in src/taxpasta/application/service/profile_reader.py
profile_standardisation_service
¶
Provide an abstract base class for a profile standardisation service.
Classes¶
ProfileStandardisationService
¶
Bases: ABC
Define an abstract base class for a profile standardisation service.
Source code in src/taxpasta/application/service/profile_standardisation_service.py
transform(profile: DataFrame) -> DataFrame[StandardProfile]
abstractmethod
classmethod
¶Tidy up and standardize a given taxonomic profile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
profile |
DataFrame
|
The taxonomic profile of a particular tool. |
required |
Returns:
Type | Description |
---|---|
DataFrame[StandardProfile]
|
A standardized profile. |
Source code in src/taxpasta/application/service/profile_standardisation_service.py
standard_profile_writer
¶
Provide an abstract base class for writing a standardized profile.
Attributes¶
Classes¶
StandardProfileWriter
¶
Bases: ABC
Define an abstract base class for writing a standardized profile.
Source code in src/taxpasta/application/service/standard_profile_writer.py
table_reader
¶
Provide an abstract base class for reading tables.
tidy_observation_table_writer
¶
Provide an abstract base class for writing tidy observation tables.
Attributes¶
Classes¶
TidyObservationTableWriter
¶
Bases: ABC
Define an abstract base class for writing tidy observation tables.
Source code in src/taxpasta/application/service/tidy_observation_table_writer.py
wide_observation_table_writer
¶
Provide an abstract base class for writing observation matrices.
Attributes¶
Classes¶
WideObservationTableWriter
¶
Bases: ABC
Define an abstract base class for writing observation matrices.