sim_communities: Generating meta and local community samples for Neutral...

Description Usage Arguments Value

View source: R/sim_communities_function.R

Description

This function generates meta and local community samples to be used in neutral theory simulations This method is an extension from the paper "Taxa-Abundance Distributions in Microbial Communities Using Environmental Sequence Data" by Sloan et al.

Usage

1
2
sim_communities(n, m, Nmeta, r = 1, nOTU, ps = 1, Nlocal, Nmeta_sd = 0,
  Nlocal_sd = 0, pool_sim = FALSE)

Arguments

n

number of samples

m

true migration parameter

Nmeta

total number of reads in each meta community samples. Note that if the argument for Nmeta_sd != 0, then this value will be the mean number of reads across meta community samples.

r

this parameter adjusts the amount of variation between samples. Values can range from 0 to 1. r = 0 will result in a uniformly distributed relative abundance distribution within a sample. Default is 1.

nOTU

number of OTUs

ps

this parameter adjusts the amount of variation between samples, with a range between 0 and 1. This value is the probability that a given OTU's relative abundance with be permuted in a sample. Values of 0 result in homologous taxa abundance distributions across all samples. Default in 1.

Nlocal

total number of reads in each local community samples. Note that if the argument for Nlocal_sd != 0, then this value will be the mean number of reads across meta community samples.

Nmeta_sd

this parameter adjusts the amount of variation in the number of reads in meta community samples. Specifically, this value is the standard deviation used in a normal distribution with mean Nmeta from which samples sizes are generated

Nlocal_sd

this parameter adjusts the amount of variation in the number of reads in local community samples. Specifically, this value is the standard deviation used in a normal distribution with mean Nlocal from which samples sizes are generated from.

pool_sim

to pool meta/source community data during data simulation

Value

a list of 4 elements. The first element is a matrix of local commmunity reads. The second element is a matrix of meta commmunity reads. The thrid element is the estimated average shannon diversity for each sample. The fourth element is the average shannon diversity after the multiple samples have been generated given the inputed value for ps and OTUs with no reads across any samples are removed (should be the same or close to the third element, this is mostly just a check).


kathalexknuts/ntsims documentation built on May 4, 2019, 6:40 p.m.