CdaFactory
The CdaFactory
class serves as a base class for the various factory classes that transform Cancer Data Aggregator (CDA) data into components of GA4GH Phenopackets.
Overview
This abstract factory class provides common functionality for its concrete subclasses:
- CdaIndividualFactory
: Transforms subject data into Individual objects
- CdaDiseaseFactory
: Transforms diagnosis data into Disease objects
- CdaBiosampleFactory
: Transforms specimen/sample data into Biosample objects
- CdaMutationFactory
: Transforms mutation data into Variant objects
API Documentation
Superclass for the CDA Factory Classes
Each subclass must implement the to_ga4gh method, which transforms a row of a table from CDA to a GA4GH Message.
Source code in src/oncopacket/cda/cda_factory.py
days_to_iso(days)
staticmethod
Convert the number of days of life into an ISO 8601 period representing the age of an individual.
Note, we only use the D
designator as transformation to years or months would be lossy.
The days
can be negative, leading to the duration of the same length.
None
is returned if the input str
cannot be parsed into an integer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
days
|
Union[int, float, str]
|
a |
required |
Raises:
Type | Description |
---|---|
ValueError
|
if |
Source code in src/oncopacket/cda/cda_factory.py
to_ga4gh(row)
abstractmethod
Return a message from the GA4GH Phenopacket Schema that corresponds to this row.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row
|
Series
|
A row from the CDA |
required |
Returns:
Type | Description |
---|---|
a message from the GA4GH Phenopacket Schema |
Raises:
Type | Description |
---|---|
ValueError
|
if unable to parse |