This function will calculate the distribution of susceptibilities by gene.

summarize_gene(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

returns an object of class

hagis.gene.summary

An object of class hagis.gene.summary is a

data.table::data.table()

containing the following components columns

gene

the gene

N_virulent_isolates

the total number virulent isolates for a given gene in the gene column

percent_pathogenic

the frequency with which a gene is pathogenic

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
susc <- summarize_gene(x = P_sojae_survey,
                       cutoff = 60,
                       control = "susceptible",
                       sample = "Isolate",
                       gene = "Rps",
                       perc_susc = "perc.susc")
susc
#>            gene N_virulent_isolates percent_pathogenic
#>  1: susceptible                  21          100.00000
#>  2:      Rps 1a                  21          100.00000
#>  3:      Rps 1b                  15           71.42857
#>  4:      Rps 1c                  20           95.23810
#>  5:      Rps 1d                  16           76.19048
#>  6:      Rps 1k                  18           85.71429
#>  7:       Rps 2                  14           66.66667
#>  8:      Rps 3a                   5           23.80952
#>  9:      Rps 3b                  20           95.23810
#> 10:      Rps 3c                   4           19.04762
#> 11:       Rps 4                   5           23.80952
#> 12:       Rps 5                  13           61.90476
#> 13:       Rps 6                  11           52.38095
#> 14:       Rps 7                  21          100.00000