Calculates pathogen diversity indices.

This function calculates five diversity indices for the user.

  • Simple diversity index, which will show the proportion of unique pathotypes to total samples. As the values gets closer to 1, there is greater diversity in pathoypes within the population. Simple diversity is calculated as: $$ D = \frac{Np}{Ns} $$ where \(Np\) is the number of pathotypes and \(Ns\) is the number of samples.

  • Gleason diversity index, an alternate version of Simple diversity index, is less sensitive to sample size than the Simple index. $$ D = \frac{ (Np - 1) }{ log(Ns)}$$ Where \(Np\) is the number of pathotypes and \(Ns\) is the number of samples.

  • Shannon diversity index is typically between 1.5 and 3.5, as richness and evenness of the population increase, so does the Shannon index value. $$ D = -\sum_{i = 1}^{R} p_i \log p_i $$ Where \(p_i\) is the proportional abundance of species \(i\).

  • Simpson diversity index values range from 0 to 1, 1 represents high diversity and 0 represents no diversity. Where diversity is calculated as: $$ D = \sum_{i = 1}^{R} p_i^2 $$

  • Evenness ranges from 0 to 1, as the Evenness value approaches 1, there is a more even distribution of each pathoype's frequency within the population. Where Evenness is calculated as: $$ D = \frac{H'}{log(Np) }$$ where \(H'\) is the Shannon diversity index and \(Np\) is the number of pathotypes.

calculate_diversities(x, cutoff, control, sample, gene, perc_susc)

Arguments

x

a data.frame containing the data.

cutoff

value for percent susceptible cutoff. Numeric.

control

value used to denote the susceptible control in the gene column. Character.

sample

column providing the unique identification for each sample being tested. Character.

gene

column providing the gene(s) being tested. Character.

perc_susc

column providing the percent susceptible reactions. Character.

Value

hagis.diversities object containing

  • Number of Samples

  • Number of Pathotypes

  • Simple Diversity Index

  • Gleason Diversity Index

  • Shannon Diversity Index

  • Simpson Diversity Index

  • Evenness Diversity Index

Examples

# Using the built-in data set, P_sojae_survey
data(P_sojae_survey)

P_sojae_survey
#>      Isolate         Line         Rps Total HR (1) Lesion (2)
#>   1:       1     Williams susceptible    10      0          0
#>   2:       1       Harlon      Rps 1a    10      4          0
#>   3:       1 Harosoy 13xx      Rps 1b     8      0          0
#>   4:       1     L75-3735      Rps 1c    10     10          0
#>   5:       1    PI 103091      Rps 1d     9      2          0
#>  ---                                                         
#> 290:      21   PRX 145-48      Rps 3c     8      3          1
#> 291:      21     L85-2352       Rps 4    10      3          1
#> 292:      21     L85-3059       Rps 5    10      0          4
#> 293:      21 Harosoy 62XX       Rps 6     8      2          1
#> 294:      21      Harosoy       Rps 7    10      0          0
#>      Lesion to cotyledon (3) Dead (4) total.susc total.resis perc.susc
#>   1:                       0       10         10           0       100
#>   2:                       0        6          6           4        60
#>   3:                       0        8          8           0       100
#>   4:                       0        0          0          10         0
#>   5:                       1        6          7           2        78
#>  ---                                                                  
#> 290:                       0        4          5           3        63
#> 291:                       4        2          7           3        70
#> 292:                       0        6         10           0       100
#> 293:                       0        5          6           2        75
#> 294:                       0       10         10           0       100
#>      perc.resis
#>   1:          0
#>   2:         40
#>   3:          0
#>   4:        100
#>   5:         22
#>  ---           
#> 290:         38
#> 291:         30
#> 292:          0
#> 293:         25
#> 294:          0

# calculate susceptibilities with a 60 % cutoff value
diversities <- calculate_diversities(x = P_sojae_survey,
                                     cutoff = 60,
                                     control = "susceptible",
                                     sample = "Isolate",
                                     gene = "Rps",
                                     perc_susc = "perc.susc")

diversities
#> 
#> hagis Diversities
#> 
#> Number of Samples 21
#> Number of Pathotypes 19 
#> 
#> Indices
#> Simple   0.9047619 
#> Gleason  5.912257 
#> Shannon  2.912494 
#> Simpson  0.9433107 
#> Evenness  0.9891509 
#>