Compare genotypes/phenotypes based on signature groups (samples are assigned to
several groups). For categorical
type, calculate fisher p value (using stats::fisher.test) and count table.
In larger than 2 by 2 tables, compute p-values by Monte Carlo simulation.
For continuous type, calculate anova p value (using stats::aov),
summary table and Tukey Honest significant difference (using stats::TukeyHSD).
The result of this function can be plotted by `show_group_comparison()`

.

get_group_comparison(
data,
col_group,
cols_to_compare,
type = "ca",
NAs = NA,
verbose = FALSE
)

## Arguments

data |
a `data.frame` containing signature groups and genotypes/phenotypes
(including categorical and continuous type data) want to analyze. User need to
construct this `data.frame` by him/herself. |

col_group |
column name of signature groups. |

cols_to_compare |
column names of genotypes/phenotypes want to summarize based on groups. |

type |
a characater vector with length same as `cols_to_compare` ,
'ca' for categorical type and 'co' for continuous type. |

NAs |
default is `NA` , filter `NA` s for categorical columns.
Otherwise a value (either length 1 or length same as `cols_to_compare` ) fill `NA` s. |

verbose |
if `TRUE` , print extra information. |

## Value

a `list`

contains data, summary, p value etc..

## Author

Shixiang Wang w_shixiang@163.com

## Examples

# \donttest{
load(system.file("extdata", "toy_copynumber_signature_by_M.RData",
package = "sigminer", mustWork = TRUE
))
# Assign samples to clusters
groups <- get_groups(sig, method = "k-means")
set.seed(1234)
groups$prob <- rnorm(10)
groups$new_group <- sample(c("1", "2", "3", "4", NA), size = nrow(groups), replace = TRUE)
# Compare groups (filter NAs for categorical coloumns)
groups.cmp <- get_group_comparison(groups[, -1],
col_group = "group",
cols_to_compare = c("prob", "new_group"),
type = c("co", "ca"), verbose = TRUE
)
# Compare groups (Set NAs of categorical columns to 'Rest')
groups.cmp2 <- get_group_comparison(groups[, -1],
col_group = "group",
cols_to_compare = c("prob", "new_group"),
type = c("co", "ca"), NAs = "Rest", verbose = TRUE
)
# }