# NOT RUN {
# load PhyloExpressionSet
data(PhyloExpressionSetExample)
# only visualize the TAI profile without any test statistics...
# this is equavalent to performing: plot(TAI(PhyloExpressionSetExample), type = "l", lwd = 6)
PlotPattern(ExpressionSet = PhyloExpressionSetExample,
            TestStatistic = NULL,
            type          = "l",
            xlab          = "Ontogeny",
            ylab          = "TAI",
            lwd           = 9)
# the simplest example of plotting the TAI profile of a given PhyloExpressionSet:
# In this case (default) the FlatLineTest will be performed to quantify
# the statistical significance of the present TAI pattern and will be drawn as 'p = ... '
# in the plot
PlotPattern(ExpressionSet = PhyloExpressionSetExample, 
            TestStatistic = "FlatLineTest",
            permutations  = 100, 
            type          = "l", 
            xlab          = "Ontogeny", 
            ylab          = "TAI", 
            lwd           = 9)
# an example performing the ReductiveHourglassTest and printing the p-value
# and shaded area of the presumptive phylotypic period into the plot
# Here the 'p = ...' denotes the p-value that is returned by the ReductiveHourglassTest
PlotPattern(
            ExpressionSet = PhyloExpressionSetExample,
            TestStatistic = "ReductiveHourglassTest",
            modules       = list(early = 1:2,mid = 3:5,late = 6:7), 
            permutations  = 100, 
            p.value       = TRUE, 
            shaded.area   = TRUE, 
            xlab          = "Ontogeny", 
            ylab          = "TAI", 
            type          = "l", 
            lwd           = 9)
# testing for early conservation model 
PlotPattern( ExpressionSet = PhyloExpressionSetExample,
             TestStatistic = "EarlyConservationTest",
            modules        = list(early = 1:2,mid = 3:5,late = 6:7), 
            permutations   = 100,
            p.value        = TRUE, 
            shaded.area    = TRUE, 
            xlab           = "Ontogeny", 
            ylab           = "TAI", 
            type           = "l", 
            lwd            = 9)
            
# use your own permutation matrix
custom_perm_matrix <- bootMatrix(PhyloExpressionSetExample,100)
PlotPattern(ExpressionSet      = PhyloExpressionSetExample, 
            TestStatistic      = "FlatLineTest",
            custom.perm.matrix = custom_perm_matrix, 
            type               = "l", 
            xlab               = "Ontogeny", 
            ylab               = "TAI", 
            lwd                = 9)
# }
Run the code above in your browser using DataLab