This function reduces the destruction of an hourglass shaped pattern to a single score value.

Based on a given TAI or TDI pattern the given vector is being divided into three developmental modules: early, mid, and late. The corrisponding TAI or TDI values in each developmental module are accumulated using the scoringMethod argument ("max-min" or "mean-mean").

In more detail:

(1) for a given TAI or TDI vector tai_profile or tdi_profile, we classify each value of tai_profile or tdi_profile into its corresponding developmental module early, mid, or late.

(2) accumulate the tai_profile or tdi_profile values in each developmental module using the arithmetic mean (mean) in case scoringMethod = "mean-mean", or accumulate the tai_profile or tdi_profile values in each developmental module using max for the early and late module and min for the mid module in case scoringMethod = "max-min".

(3) then reduce the three values for each developmental module by computing the difference between: mid - early, and mid - late.

(4) the two difference values are referred to as a_early and a_late.

Each developmental module now has an accumulated representation value which is being reduced to one value using the method argument ("max", "min", or "mean").

Given the two accumulated values for each hourglass module: a_early and a_late, we reduce the two given values by:

• "max": $$S = max{a_early,a_late}$$

• "min": $$S = min{a_early,a_late}$$

• "mean": $$S = mean{a_early,a_late}$$

All together this results in a global score S. This global score S is being returned by this function.

reversehourglassScore(age_vals, early, mid, late, method, scoringMethod)

## Arguments

age_vals a numeric vector containing TAI or TDI values for each developmental stage s. a numeric vector including the numeric stage values that correspond to the early phase of development. a numeric vector including the numeric stage values that correspond to the middle phase of development. a numeric vector including the numeric stage values that correspond to the late phase of development. to determine the two value reduction value, resulting in the global score S: "max", or "min", or "mean". method to determine the module accumulation value: "max-min" or "mean-mean".

## Value

a numeric value representing the hourglass destruction score.

## Details

The gpScore is a heuristic score enabling to construct a test statistic to determine the significance of a present (phylotranscriptomic) hourglass pattern.

Drost et al. (2015), Evidence for active maintenance of phylotranscriptomic hourglass patterns in animal and plant embryogenesis. Mol Bio Evol.

ReverseHourglassTest, TAI, TDI

Hajk-Georg Drost

## Examples


data(PhyloExpressionSetExample)
data(DivergenceExpressionSetExample)

# example PhyloExpressionSet:

# compute the TAI profile
TAIs <- TAI(PhyloExpressionSetExample)

# compute the global hourglass destruction score
# for the TAIs profile using reduction method: mean(mean-mean)
reversehourglass_score <- reversehourglassScore(age_vals = TAIs,early = 1:2,mid = 3:5,late = 6:7,
method = "mean",scoringMethod = "mean-mean")

# example DivergenceExpressionSet:

# compute the TDI profile
TDIs <- TDI(DivergenceExpressionSetExample)

# compute the global hourglass destruction score for the TDIs profile
# using reduction method: mean(mean-mean)
reversehourglass_score <- rhScore(age_vals = TDIs,early = 1:2,mid = 3:5,late = 6:7,
method = "mean",scoringMethod = "mean-mean")