Package 'aspi'

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

Help Index


ASPI: Analysis of Symmetry in Parasitic Infections

Description

Tools for the analysis and visualization of bilateral asymmetry in parasitic infections.

Functions

  • g.test

  • eb.test

  • plotHistogram

  • plotVolcano

Data

  • diplostomum_eyes_excl_lenses

  • diplostomum_lenses

  • simulated_symmetrical_infection

  • simulated_left_bias_homogeneous_proportions

  • simulated_left_bias_heterogeneous_proportions

  • simulated_asymmetry_inconsistent_bias

Author(s)

Matt Wayland, [email protected]


Numbers of Diplostomum metacercariae recorded from the eyes (excluding lenses) of each of 50 ruffe.

Description

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.

Usage

diplostomum_eyes_excl_lenses

Format

A data frame with 50 rows and 2 variables (row names are host IDs):

left

number of metacercariae in left eye

right

number of metacercariae in the right eye


Numbers of Diplostomum metacercariae recorded from the lenses of the eyes of each of 50 ruffe.

Description

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.

Usage

diplostomum_lenses

Format

A data frame with 50 rows and 2 variables (row names are host IDs):

left

number of metacercariae in lens of left eye

right

number of metacercariae in lens of right eye


Exact binomial tests

Description

Assess symmetry of parasitic infections by performing exact binomial tests on pooled data and individual hosts.

Usage

eb.test(x)

Arguments

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.

Details

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.

Value

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.

Examples

eb.test(diplostomum_lenses)

Replicated G-tests of goodness-of-fit

Description

Perform replicated G-tests of goodness-of-fit to assess symmetry of parasitic infections.

Usage

g.test(x)

Arguments

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.

Details

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.

Value

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).

References

R.R. Sokal & F.J. Rohlf (1995) Biometry. 3rd Edition. New York: W.H. Freeman and Company. 887 pp.

Examples

g.test(diplostomum_eyes_excl_lenses)

Plot histogram

Description

Creates a histogram showing distribution of fold differences in abundance of parasites between left and right sides of host.

Usage

plotHistogram(x, nBreaks = 10, ...)

Arguments

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.

Details

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.

Examples

plotHistogram(diplostomum_eyes_excl_lenses)
plotHistogram(diplostomum_eyes_excl_lenses,nBreaks=20,
main="Diplostomum metacercariae in eyes of ruffe")

Volcano plot

Description

Produces scatterplot of statistical significance vs fold difference in parasite abundance between left and right.

Usage

plotVolcano(x, test = "G", pAdj = "BH", sigThresh = 0.05, ...)

Arguments

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.

Details

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.

Examples

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 showing bilateral asymmetry with insconsistent bias

Description

Simulated data for 10 hosts, providing an example of bilateral asymmetry with inconsistent bias.

Usage

simulated_asymmetry_inconsistent_bias

Format

A data frame with 10 rows and 2 variables:

left

number of parasites on the left side

right

number of parasites on the right side


Simulated data showing left bias with heterogeneous proportions

Description

Simulated data for 10 hosts, providing an example of bilateral asymmetry with left bias and the left:right ratio varying between hosts.

Usage

simulated_left_bias_heterogeneous_proportions

Format

A data frame with 10 rows and 2 variables:

left

number of parasites on the left side

right

number of parasites on the right side


Simulated data for showing left bias with homogeneous proportions

Description

Simulated data for 10 hosts, providing an example of bilateral asymmetry with left bias and a similar left:right ratio in all hosts.

Usage

simulated_left_bias_homogeneous_proportions

Format

A data frame with 10 rows and 2 variables:

left

number of parasites on the left side

right

number of parasites on the right side


Simulated data showing bilateral symmetry

Description

Simulated data for 10 hosts, providing an example of bilateral symmetry.

Usage

simulated_symmetrical_infection

Format

A data frame with 10 rows and 2 variables:

left

number of parasites on the left side

right

number of parasites on the right side