hiv_workflow.lib.analysis.age_bin module

class hiv_workflow.lib.analysis.age_bin.AgeBin(start, end, delimiter=None)

Bases: object

exception InvalidAgeBinFormat

Bases: Exception

exception NotMergeable

Bases: Exception

STR_FORMAT = '[%s%s%s)'
SPLIT_REGEX = re.compile('^\\[(?P<start>[0-9.]+)(?P<delimiter>[^0-9.]+)(?P<end>[0-9.]+)\\)$')
DEFAULT_DELIMITER = ':'
ALL = 'all'
merge(other_bin)

Create a single AgeBin representing two adjacent AgeBins. Keeps delimiter of ‘self’. :param other_bin: merge self with this other AgeBin object (self is lower age than other_bin) :return: an AgeBin object with delimiter set to self.delimiter (not other_bin.delimiter)

contains(other_bin)

Is other_bin contained within the bounds of self? :param other_bin: an AgeBin object :return: True/False

to_tuple()
classmethod from_string(str)
classmethod merge_bins(bins)
classmethod can_upsample_bins(bins, target_bin)