Performs comprehensive sequence comparison analysis between groups. All patterns of the sequences (subsequences of specific length) are extracted from all sequences in each group. For two groups, the proportions of the patterns between the groups are compared with a z-test for proportions. For more than two groups, the Chi-squared test is applied. Both tests are applied within patterns of the same length.
Usage
compare_sequences(x, ...)
# Default S3 method
compare_sequences(x, group, sub, min_freq = 5L, correction = "bonferroni", ...)
# S3 method for class 'group_tna'
compare_sequences(x, sub, min_freq = 5L, correction = "bonferroni", ...)
Arguments
- x
A
group_tna
object or adata.frame
containing sequence data in wide format.- ...
Not used.
- group
A
vector
indicating the group assignment of each row of the data/sequence. Must have the same length as the number of rows/sequences ofx
. Alternatively, a singlecharacter
string giving the column name of the data that defines the group whenx
is a wide formatdata.frame
or atna_data
object.- sub
An
integer
vector of subsequence lengths to analyze. The default is2:5
.- min_freq
An
integer
giving the minimum number of times that a specific pattern has to be observed to be included in the analysis. The default is5
.- correction
A
character
string naming the multiple comparison correction method (default:"bonferroni"
). Supports all stats::p.adjust methods:"holm"
,"hochberg"
,"hommel"
,"bonferroni"
,"BH"
,"BY"
,"fdr"
,"none"
.
Value
A tna_sequence_comparison
object, which is a data.frame
with
columns giving the names of the pattern, pattern frequencies, pattern
proportions (within patterns of the same length), test statistic values
and p-values of the tests.
See also
Model comparison functions
compare()
,
compare.group_tna()
,
plot.tna_comparison()
,
plot.tna_sequence_comparison()
,
plot_compare()
,
plot_compare.group_tna()
,
print.tna_comparison()
,
print.tna_sequence_comparison()