Description Usage Arguments Value Author(s) See Also Examples
View source: R/peptide_cooccurrence.R
calculate a contingency table of two peptides' presence in multiple individuals and perform independence test and cooccurrence coefficients
1 2 3 4 5 6 7 | peptide_cooccurrence(
x,
y,
coefficient = "jaccard",
perform_test = FALSE,
test_method = "fisher"
)
|
x |
a logical vector of peptide 1's presence in multiple samples |
y |
a logical vector of peptide 2's presence in multiple samples |
coefficient |
the cooccurrence coefficient to compute. Options: "jaccard" (jaccard index), "phi" (phi correlation coefficient), and "prop" (mean proportion of both peptide being enriched given one of them is enriched), or a vector of any combination of the three options (e.g., c("jaccard", "phi")). Default: "jaccard" |
perform_test |
a logical indicator of whether statistical tests
should be performed for each comparison.
The test method is specified by |
test_method |
method to perform statistical test. Options: "fisher" (Fisher's exact test) or "chisq" (Pearson's Chi-squared test). Default: "fisher" |
if coefficient
= "phi" and perform_test
= FALSE
,
return a single number, i.e., the phi coefficient.
Otherwise, return a vector that contains at least these four elements:
TT: frequency of both peptide positive;
TF: frequency of peptide 1 positive and peptide 2 negative;
FT: frequency of peptide 1 negative and peptide 2 position;
FF: frequency of both peptide negative.
Depending on coefficient
, the vector also contains jaccard index, phi coefficient
and/or the mean proportion of cooccurrence.
If perform_test
is TRUE
, the vector also contains the key statistics
("oddsr" - odds ratio, if using the Fisher's exact test, or "xsq" - chi-squared, if using
the Chi-squared test), and the p-value.
Siyang Xia sxia@hsph.harvard.edu
peptide_pairwise_correlation
,
fisher.test
,
chisq.test
1 2 3 4 5 6 7 8 9 10 11 12 13 | data(peptide_z)
peptide_bi <- as.data.frame((peptide_z > 3.5) * 1)
peptide_cooccurrence(x = peptide_bi[, 1], y = peptide_bi[, 2],
coefficient = "jaccard",
perform_test = TRUE,
test_method = "fisher")
peptide_cooccurrence(x = peptide_bi[, 1], y = peptide_bi[, 2],
coefficient = "jaccard",
perform_test = TRUE,
test_method = "chisq")
peptide_cooccurrence(x = peptide_bi[, 1], y = peptide_bi[, 2],
coefficient = c("phi", "prop", "jaccard"),
perform_test = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.