juxtaposition

Functions that compare two columns.

Provides the foundation for phylogenetic inference tools.

Functions

calc_definitive_max_rank_of_first_retained_disparity_between(...)

Determine hard, exclusive upper bound on MRCA generation.

calc_definitive_max_rank_of_last_retained_commonality_between(...)

Determine latest possible generation of MRCA.

calc_definitive_min_ranks_since_first_retained_disparity_with(...)

Determine a hard, exclusive lower bound on generations since MRCA.

calc_definitive_min_ranks_since_last_retained_commonality_with(...)

Determine hard, inclusive lower bound on generations since MRCA.

calc_min_implausible_spurious_consecutive_differentia_collisions_between(...)

Determine amount of evidence required to indicate shared ancestry.

calc_probability_differentia_collision_between(...)

How likely are differentia collisions?

calc_rank_of_first_retained_disparity_between(...)

Determine upper bound on MRCA generation at given confidence.

calc_rank_of_last_retained_commonality_between(...)

Determine lower bound on generation of MRCA at confidence level.

calc_ranks_since_first_retained_disparity_with(...)

Determine generations since divergence with particular confidence.

calc_ranks_since_last_retained_commonality_with(...)

Determine generations since MRCA with particular confidence.

diff_retained_ranks(first, second)

Return ranks retained by first but not second, and vice versa.

get_last_common_stratum_between(first, second)

Get the most recent stratum in common between first and second, if any.

get_nth_common_rank_between(first, second, n)

Return the nth rank retained by both columns.

calc_definitive_max_rank_of_first_retained_disparity_between(first: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], second: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen]) int | None

Determine hard, exclusive upper bound on MRCA generation.

At most, how many depositions elapsed along the columns’ lines of descent before the first mismatching strata at the same rank between self and second?

Returns

int, optional

The number of depositions elapsed or None if no disparity (i.e., both columns have same number of strata deposited and the most recent stratum is common between first and second).

Notes

If no mismatching strata are found but first and second have different numbers of strata deposited, this method returns one greater than the lesser of the columns’ deposition counts.

calc_definitive_max_rank_of_last_retained_commonality_between(first: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], second: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen]) int | None

Determine latest possible generation of MRCA.

At most, how many depositions elapsed along the columns’ lines of descent before the last matching strata at the same rank between first and second?

Returns

int, optional

The number of depositions elapsed or None if no common ancestor is shared between the columns.

calc_definitive_min_ranks_since_first_retained_disparity_with(focal: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], other: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen]) int | None

Determine a hard, exclusive lower bound on generations since MRCA.

At least, how many depositions have elapsed along the focal column’s line of descent since the first mismatching strata at the same rank between focal and other?

Returns None if no disparity found (i.e., both columns have same number of strata deposited and the most recent stratum is common between focal and other).

calc_definitive_min_ranks_since_last_retained_commonality_with(focal: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], other: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen]) int | None

Determine hard, inclusive lower bound on generations since MRCA.

At least, how many depositions have elapsed along the focal column’s line of descent since the last matching strata at the same rank between focal and other?

Returns None if no common ancestor between focal and other can be resolved with absolute confidence.

calc_min_implausible_spurious_consecutive_differentia_collisions_between(first: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], second: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], significance_level: float) int

Determine amount of evidence required to indicate shared ancestry.

Calculates how many differentia collisions are required to reject the null hypothesis that columns do not share common ancestry at those ranks at significance level significance_level.

calc_probability_differentia_collision_between(first: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], second: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen]) float

How likely are differentia collisions?

Calculates the probability of two randomly-differentiated differentia being identical by coincidence.

calc_rank_of_first_retained_disparity_between(first: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], second: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], confidence_level: float = 0.95) int | None

Determine upper bound on MRCA generation at given confidence.

How many depositions elapsed along the columns’ lines of descent before the first mismatching strata at the same rank between first and second?

Parameters

confidence_levelfloat, optional

With what probability should the true rank of the first disparity between first and second fall at or after the returned rank? Default 0.95.

Returns

int, optional

The number of depositions elapsed or None if no disparity (i.e., both columns have same number of strata deposited and the most recent stratum is common between first and second).

Notes

If no mismatching strata are found but first and second have different numbers of strata deposited, this method returns one greater than the lesser of the columns’ deposition counts.

The true rank of the first disparity with second is guaranteed to never be after the returned rank when confidence_level < 0.5.

If the differentia width and confidence level are configured such that one or more spurious differentia collisions is plausible, this method will never return None.

Consider two columns that compare identical at all common ranks. If these columns have few enough common ranks that all these collisions could plausibly be spurious then there is not yet enough to support common lineage between the columns so rank 0 must be selected as the estimated site of first retained disparity. If these columns have enough common ranks that all collisions could not plausibly be spurious then the largest rank that could not conceivably be spurious must be selected (and we are guaranteed such a rank exists). It is only when not even one collision could plausibly be spurious that strong enough evidence exists to conclude that there is no disparity.

For example, the method may return None with 64-bit differentia and 95% confidence level but will never return None with 1-bit differentia and 95% confidence level.

calc_rank_of_last_retained_commonality_between(first: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], second: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], confidence_level: float = 0.95) int | None

Determine lower bound on generation of MRCA at confidence level.

How many depositions elapsed along the columns’ lines of descent before the last matching strata at the same rank between first and second?

Parameters

confidence_levelfloat, optional

With what probability should the true rank of the last commonality between first and second fall at or after the returned rank? Default 0.95.

Returns

int, optional

The number of depositions elapsed or None if no common ancestor is shared between the columns.

Notes

The true rank of the last commonality with second is guaranteed to never be after the returned rank when confidence_level < 0.5.

calc_ranks_since_first_retained_disparity_with(focal: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], other: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], confidence_level: float = 0.95) int | None

Determine generations since divergence with particular confidence.

How many depositions have elapsed along the focal column’s line of descent since the first mismatching strata at the same rank between focal and other?

Returns

int, optional

The number of depositions elapsed or None if no disparity (i.e., both columns have same number of strata deposited and the most recent stratum is common between focal and other).

Parameters

confidence_levelfloat, optional

With what probability should the true number of ranks since the first disparity be less than or equal to the returned estimate? Default 0.95.

Notes

Returns -1 if focal and other share no mismatching strata at common ranks but other has more strata deposited than focal.

The true number of ranks since the first disparity with other is guaranteed strictly less than or equal to the returned estimate when confidence_level < 0.5.

calc_ranks_since_last_retained_commonality_with(focal: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], other: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], confidence_level: float = 0.95) int | None

Determine generations since MRCA with particular confidence.

How many depositions have elapsed along the focal column’s line of descent since the last matching strata at the same rank between focal and other?

Returns None if no common ancestor is shared between focal and other.

Parameters

confidence_levelfloat, optional

With what probability should the true number of ranks since the last commonality with other be less than the calculated estimate? Default 0.95.

Notes

If confidence_level < 0.5, then the true number of ranks since the last commonality with other is guaranteed greater than or equal to the calculated estimate.

diff_retained_ranks(first: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], second: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen]) Tuple[Set[int], Set[int]]

Return ranks retained by first but not second, and vice versa.

Returned as a tuple of sets.

get_last_common_stratum_between(first: HereditaryStratigraphicColumn, second: HereditaryStratigraphicColumn, confidence_level: float = 0.95) HereditaryStratum | None

Get the most recent stratum in common between first and second, if any.

Common strata share identical rank and differentia. Returns None if no common strata exist between the two columns. Allows probability equal to 1 - confidence_level that the last true common stratum is before the stratum returned (i.e., strata were erroneously detected as common due to spurious differentia collisions).

See Also

calc_rank_of_last_retained_commonality_between :

Selects the stratum returned. See the corresponding docstring for explanation of parameters.

get_nth_common_rank_between(first: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], second: Union[HereditaryStratigraphicColumn, HereditaryStratigraphicSpecimen], n: int) int | None

Return the nth rank retained by both columns.

Zero indexed. Returns None if n + 1 common ranks do not exist between first and second.