Title: | Analysis of Symmetry of Parasitic Infections |
---|---|
Description: | Tools for the analysis and visualization of bilateral asymmetry in parasitic infections. |
Authors: | Matt Wayland |
Maintainer: | Matt Wayland <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0 |
Built: | 2024-11-17 04:09:32 UTC |
Source: | https://github.com/cran/aspi |
Tools for the analysis and visualization of bilateral asymmetry in parasitic infections.
g.test
eb.test
plotHistogram
plotVolcano
diplostomum_eyes_excl_lenses
diplostomum_lenses
simulated_symmetrical_infection
simulated_left_bias_homogeneous_proportions
simulated_left_bias_heterogeneous_proportions
simulated_asymmetry_inconsistent_bias
Matt Wayland, [email protected]
A dataset containing the numbers of Diplostomum metacercariae recovered from the eyes (excluding lenses) of each of 50 ruffe, Gymnocephalus cernuus from Llyn Tegid, a mesotrophic lake in north Wales.
diplostomum_eyes_excl_lenses
diplostomum_eyes_excl_lenses
A data frame with 50 rows and 2 variables (row names are host IDs):
number of metacercariae in left eye
number of metacercariae in the right eye
A dataset containing the numbers of Diplostomum metacercariae recovered from the lenses of the eyes of each of 50 ruffe, Gymnocephalus cernuus from Llyn Tegid, a mesotrophic lake in north Wales.
diplostomum_lenses
diplostomum_lenses
A data frame with 50 rows and 2 variables (row names are host IDs):
number of metacercariae in lens of left eye
number of metacercariae in lens of right eye
Assess symmetry of parasitic infections by performing exact binomial tests on pooled data and individual hosts.
eb.test(x)
eb.test(x)
x |
a matrix or data frame with two numeric columns; first column is for left-side and 2nd column for right-side. Identifiers for hosts can be provided as row names. |
This function performs a binomial exact tests with the null hypothesis of a 1:1 ratio. It takes as its argument a matrix or data frame with two numeric columns; first column is for left-side and 2nd column for right-side. Identifiers for hosts can be provided as row names. Uninfected hosts (zero count for both left and right sides) are ignored.
It returns a list containing two elements:
pooled |
p-value for pooled binomial exact test (null hypothesis: the ratio of the total number of parasites from each side doesn't differ from 1:1). |
hosts |
data.frame of results of binomial exact tests performed on the distribution of parasites in each host. |
eb.test(diplostomum_lenses)
eb.test(diplostomum_lenses)
Perform replicated G-tests of goodness-of-fit to assess symmetry of parasitic infections.
g.test(x)
g.test(x)
x |
a matrix or data frame with two numeric columns; first column is for left-side and 2nd column for right-side. Identifiers for hosts can be provided as row names. |
This function implements Sokal & Rohlf's (1995) G-test for the specific case of an expected 1:1 ratio The function takes as its argument a matrix or data frame with two numeric columns; first column is for left-side and 2nd column for right-side. Identifiers for hosts can be provided as row names. Uninfected hosts (zero count for both left and right sides) are ignored. Cannot be applied to data containing zero counts; use eb.test instead.
A list containing two data.frames:
summary |
results of total, heterogeneity and pooled G-tests. Data frame has four columns: test, degrees of freedom, G-statistic and p-value. |
hosts |
results of individual G-tests on distribution of parasites in each host. Data frame has seven columns: Host (ID), Left (count of parasites on left side), Right (count of parasites on right side), G (G-statistic), p (p-value), BH (p-value adjusted using Benjamini and Hochberg's procedure for controlling the false discovery rate) and Holm (p-value adjusted using Holm's method). |
R.R. Sokal & F.J. Rohlf (1995) Biometry. 3rd Edition. New York: W.H. Freeman and Company. 887 pp.
g.test(diplostomum_eyes_excl_lenses)
g.test(diplostomum_eyes_excl_lenses)
Creates a histogram showing distribution of fold differences in abundance of parasites between left and right sides of host.
plotHistogram(x, nBreaks = 10, ...)
plotHistogram(x, nBreaks = 10, ...)
x |
a matrix or data frame with two numeric columns; first column is for left-side and 2nd column for right-side. Identifiers for hosts can be provided as row names. |
nBreaks |
number of cells for the histogram. A suggestion only; breakpoints will be set to pretty values. |
... |
optional further arguments and graphical parameters passed to plot. |
plot.Histogram creates a histogram showing distribution of fold differences in abundance of parasites between left and right sides. For each infected host the number of parasites on the right side is divided by the number of parasites on the left side, and the result binary log transformed. The log2 ratio will be negative if there are more parasites on the left than right and positive if there are more parasites on the right than left. A log2 ratio of one corresponds to a one-fold difference, i.e. double the number of parasites. Perfect symmetry is a log2 ratio of zero.
plotHistogram(diplostomum_eyes_excl_lenses) plotHistogram(diplostomum_eyes_excl_lenses,nBreaks=20, main="Diplostomum metacercariae in eyes of ruffe")
plotHistogram(diplostomum_eyes_excl_lenses) plotHistogram(diplostomum_eyes_excl_lenses,nBreaks=20, main="Diplostomum metacercariae in eyes of ruffe")
Produces scatterplot of statistical significance vs fold difference in parasite abundance between left and right.
plotVolcano(x, test = "G", pAdj = "BH", sigThresh = 0.05, ...)
plotVolcano(x, test = "G", pAdj = "BH", sigThresh = 0.05, ...)
x |
a matrix or data frame with two numeric columns; first column is for left-side and 2nd column for right-side. Identifiers for hosts can be provided as row names. |
test |
if set to "G" (default) a G-test is performed; otherwise an exact binomial test is performed. |
pAdj |
method for correcting p-values for multiple comparisons. If set to "BH" (default), Benjamini & Hochberg's procedure is used to control the false discovery rate (FDR); otherwise Holm's methos is used to control the familywise error rate (FWER). |
sigThresh |
significance threshold (defaults to 0.05); p-values below this value will be called significant. |
... |
optional further arguments and graphical parameters passed to plot. |
plot.Volcano creates a volcano plot, i.e. a scatterplot of statistical significance (-log10(p-value)) vs fold difference (log2 ratio - as calculated for the histogram above) in parasite abundance between left and right. Each point in the scatterplot represents the parasite distribution in an individual host. A dashed horizontal line represents the user-defined p-value threshold for significance. If a parasite distribution deviates significantly from symmetry it is shown as a red square, otherwise as a blue circle.
plotVolcano(diplostomum_eyes_excl_lenses) plotVolcano(diplostomum_eyes_excl_lenses, test="G", pAdj="BH", sigThresh=0.1, main="Diplostomum metacercariae in eyes of ruffe")
plotVolcano(diplostomum_eyes_excl_lenses) plotVolcano(diplostomum_eyes_excl_lenses, test="G", pAdj="BH", sigThresh=0.1, main="Diplostomum metacercariae in eyes of ruffe")
Simulated data for 10 hosts, providing an example of bilateral asymmetry with inconsistent bias.
simulated_asymmetry_inconsistent_bias
simulated_asymmetry_inconsistent_bias
A data frame with 10 rows and 2 variables:
number of parasites on the left side
number of parasites on the right side
Simulated data for 10 hosts, providing an example of bilateral asymmetry with left bias and the left:right ratio varying between hosts.
simulated_left_bias_heterogeneous_proportions
simulated_left_bias_heterogeneous_proportions
A data frame with 10 rows and 2 variables:
number of parasites on the left side
number of parasites on the right side
Simulated data for 10 hosts, providing an example of bilateral asymmetry with left bias and a similar left:right ratio in all hosts.
simulated_left_bias_homogeneous_proportions
simulated_left_bias_homogeneous_proportions
A data frame with 10 rows and 2 variables:
number of parasites on the left side
number of parasites on the right side
Simulated data for 10 hosts, providing an example of bilateral symmetry.
simulated_symmetrical_infection
simulated_symmetrical_infection
A data frame with 10 rows and 2 variables:
number of parasites on the left side
number of parasites on the right side