This function computes the LateConservationTest score for a given TAI or TDI pattern.

The reductive late conservation test is a permutation test based on the following test statistic.

- A set of developmental stages is partitioned into three modules - early, mid, and late - based on prior biological knowledge.

- The mean TAI or TDI value for each of the three modules T_early, T_mid, and T_late are computed.

- The two differences D1 = T_early - T_late and D2 = T_mid - T_late are calculated.

- The minimum D_min of D1 and D2 is computed as final test statistic of the reductive late conservation test.

This function lcScore computes the D_min value for a given TAI or TDI stored in the age_vals argument.

lcScore(age_vals, early, mid, late, profile.warn = FALSE)

Arguments

age_vals

a numeric vector containing TAI or TDI values for each developmental stage s.

early

a numeric vector storing the numeric stage values that correspond to the early phase of development.

mid

a numeric vector storing the numeric stage values that correspond to the middle phase of development.

late

a numeric vector storing the numeric stage values that correspond to the late phase of development.

profile.warn

a boolean value indicating whether a warning is printed when a high-mid-low pattern isn't followed.

Value

a numeric value representing the late conservation score.

Author

Hajk-Georg Drost and Jaruwatana Sodai Lotharukpong

Examples


 # read standard phylotranscriptomics data
 data(PhyloExpressionSetExample)
 data(DivergenceExpressionSetExample)

 # Example PhyloExpressionSet:

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

 # compute the late conservation score for the TAI profile
 lc_score <- lcScore(age_vals = TAIs,early = 1:2,mid = 3:5,late = 6:7)


 # Example DivergenceExpressionSet:

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

 # compute the late conservation score for the TDI profile
 lc_score <- lcScore(age_vals = TDIs,early = 1:2,mid = 3:5,late = 6:7)
 
 # compute lcScore() vector from bootMatrix()
 apply(bootMatrix(PhyloExpressionSetExample,10),1,lcScore,early = 1:2,mid = 3:5,late = 6:7)
#>            1            2            3            4            5            6 
#> -0.035975502 -0.037154844 -0.023278212 -0.051900074 -0.016272788  0.034063484 
#>            7            8            9           10 
#>  0.032440418  0.004459241 -0.077836247 -0.037626594 
 
 # get warning if the expected pattern isn't followed
 lc_score <- lcScore(age_vals = TAIs,early = 1:2,mid = 3:5,late = 6:7,profile.warn=TRUE)
#> The phylotranscriptomic pattern may not follow a late conservation pattern (high-mid-low or high-high-low).