Group-specific fixed effects model

cytogroup(
  df_samples_subset,
  protein_names,
  condition,
  group = "donor",
  cell_n_min = Inf,
  cell_n_subsample = 0
)

Arguments

df_samples_subset

Data frame or tibble with proteins counts, cell condition, and group information

protein_names

A vector of column names of protein to use in the analysis

condition

The column name of the condition variable

group

The column name of the group variable

cell_n_min

Remove samples that are below this cell counts threshold

cell_n_subsample

Subsample samples to have this maximum cell count

Value

A list of class cytoglm containing

groupfit

speedglm object

df_samples_subset

possibly subsampled df_samples_subset table

protein_names

input protein names

condition

input condition variable

group

input group names

cell_n_min

input cell_n_min

cell_n_subsample

input cell_n_subsample

Examples

set.seed(23)
df <- generate_data()
protein_names <- names(df)[3:12]
df <- dplyr::mutate_at(df, protein_names, function(x) asinh(x/5))
group_fit <- CytoGLMM::cytogroup(df,
                                 protein_names = protein_names,
                                 condition = "condition",
                                 group = "donor")
#> Warning: `as.tibble()` was deprecated in tibble 2.0.0.
#> Please use `as_tibble()` instead.
#> The signature and semantics have changed, see `?as_tibble`.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
group_fit
#> $groupfit
#> Generalized Linear Model of class 'speedglm':
#> 
#> Call:  speedglm(formula = formula_str, data = df_samples_subset, family = binomial()) 
#> 
#> Coefficients:
#> (Intercept)          m01          m02          m03          m04          m05  
#>  -9.090e-01    8.698e-02    1.545e-01    7.363e-02   -5.642e-03    1.077e-02  
#>         m06          m07          m08          m09          m10           X1  
#>   2.152e-03    4.735e-02    4.610e-02   -1.773e-04    2.919e-02    1.016e+00  
#>          X2           X3           X4           X5           X6           X7  
#>   3.993e-01    6.928e-01    5.071e-01    7.220e-01    1.251e-01    4.852e-01  
#>          X8       m01:X1       m01:X2       m01:X3       m01:X4       m01:X5  
#>          NA    1.843e-01   -4.158e-02   -5.075e-03   -1.402e-02   -9.011e-02  
#>      m01:X6       m01:X7       m01:X8       m02:X1       m02:X2       m02:X3  
#>  -2.758e-03   -7.174e-02           NA   -1.089e-01   -9.177e-02   -1.093e-01  
#>      m02:X4       m02:X5       m02:X6       m02:X7       m02:X8       m03:X1  
#>  -1.058e-01   -1.124e-01   -7.804e-02   -4.882e-02           NA    2.120e-02  
#>      m03:X2       m03:X3       m03:X4       m03:X5       m03:X6       m03:X7  
#>   1.178e-01   -1.858e-02    4.345e-03   -4.760e-02    3.601e-02    3.170e-02  
#>      m03:X8       m04:X1       m04:X2       m04:X3       m04:X4       m04:X5  
#>          NA   -8.086e-02    1.334e-02    3.134e-02   -5.542e-02    2.500e-02  
#>      m04:X6       m04:X7       m04:X8       m05:X1       m05:X2       m05:X3  
#>   3.327e-02   -8.551e-03           NA    1.530e-02   -4.858e-02   -1.451e-02  
#>      m05:X4       m05:X5       m05:X6       m05:X7       m05:X8       m06:X1  
#>   1.958e-03    3.823e-02   -5.835e-02    2.097e-03           NA   -8.318e-02  
#>      m06:X2       m06:X3       m06:X4       m06:X5       m06:X6       m06:X7  
#>   1.141e-01   -4.265e-02   -3.411e-02   -1.946e-02   -5.368e-02   -6.319e-02  
#>      m06:X8       m07:X1       m07:X2       m07:X3       m07:X4       m07:X5  
#>          NA   -1.102e-01   -1.820e-02   -8.430e-02   -3.744e-02   -1.059e-01  
#>      m07:X6       m07:X7       m07:X8       m08:X1       m08:X2       m08:X3  
#>  -3.105e-03   -1.263e-02           NA   -9.409e-02   -9.344e-02   -3.130e-02  
#>      m08:X4       m08:X5       m08:X6       m08:X7       m08:X8       m09:X1  
#>   3.927e-03   -4.415e-03   -5.756e-02   -6.987e-05           NA    6.399e-02  
#>      m09:X2       m09:X3       m09:X4       m09:X5       m09:X6       m09:X7  
#>  -5.561e-02   -3.413e-02   -4.475e-03   -7.922e-03   -1.096e-02   -1.039e-02  
#>      m09:X8       m10:X1       m10:X2       m10:X3       m10:X4       m10:X5  
#>          NA   -6.815e-02    2.977e-02   -4.956e-02   -3.438e-02   -1.950e-02  
#>      m10:X6       m10:X7       m10:X8  
#>   3.076e-02   -1.028e-01           NA  
#> 
#> 
#> $df_samples_subset
#> # A tibble: 16,000 × 20
#>    donor condition   m01   m02   m03   m04   m05   m06   m07   m08   m09   m10
#>    <fct> <fct>     <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1 1     treatment 0.390  3.93  3.84 1.94   1.94 1.94   3.11 3.18  1.14   3.44
#>  2 1     treatment 0      3.65  3.07 2.46   4.21 2.56   2.75 1.53  2.05   3.09
#>  3 1     treatment 0.199  1.75  3.04 4.29   2.35 1.61   1.14 1.02  2.70   4.70
#>  4 1     treatment 1.02   2.09  2.62 2.14   2.82 0.569  2.49 2.05  1.14   3.30
#>  5 1     treatment 1.99   2.49  1.82 4.02   2.19 0.733  1.44 0.881 2.56   2.05
#>  6 1     treatment 0.199  1.94  2.73 4.10   1.75 0.881  2.35 2.46  2.35   3.50
#>  7 1     treatment 2.27   4.27  1.44 1.25   5.29 2.14   2.35 2.59  1.25   2.35
#>  8 1     treatment 0.199  3.50  1.88 3.16   3.53 0.390  1.53 2.42  1.53   2.42
#>  9 1     treatment 0.390  2.27  2.96 1.68   2.39 1.94   3.02 4.35  2.42   4.50
#> 10 1     treatment 0.390  2.75  1.68 0.733  2.67 2.42   2.75 3.73  0.199  3.18
#> # … with 15,990 more rows, and 8 more variables: X1 <dbl>, X2 <dbl>, X3 <dbl>,
#> #   X4 <dbl>, X5 <dbl>, X6 <dbl>, X7 <dbl>, X8 <dbl>
#> 
#> $protein_names
#>  [1] "m01" "m02" "m03" "m04" "m05" "m06" "m07" "m08" "m09" "m10"
#> 
#> $condition
#> [1] "condition"
#> 
#> $group
#> [1] "donor"
#> 
#> $cell_n_min
#> [1] Inf
#> 
#> $cell_n_subsample
#> [1] 0
#> 
#> attr(,"class")
#> [1] "cytogroup"