sampleLibrarySize: Samples the expected library size of individuals/samples

Description Usage Arguments Details Value Examples

View source: R/stochastic_simulation.R

Description

Samples the expected library size of each individual/sample, accounting for potential lane size effects (i.e. the impact of samples being processed on different lanes).

Usage

1
2
3
4
5
6
7
8
sampleLibrarySize(
  samples_list,
  meanLogLibSize_lane = 7,
  sdLogLibSize_lane = 0.5,
  sdLogLibSize_samples = 0.2,
  laneEffect = F,
  nLanes = 2
)

Arguments

samples_list

List of sample/individual names.

meanLogLibSize_lane

Numeric. The mean of the log10 mean library size normal distribution (see Details). Default value of 7.

sdLogLibSize_lane

Numeric. The sd of the log10 mean library size normal distribution (see Details). Default value of 0.5.

sdLogLibSize_samples

Numeric. The sd of the log10 samples library size normal distribution (see Details). Default value of 0.2.

laneEffect

Boolean. Are the samples processed on different lanes/batches? Default value is FALSE.

nLanes

Numeric. How many lanes are there in the experiment? Automatically set to 1 if laneEffect = F. Default value is 2.

Details

The expected library size of each individual is sampled from a log-normal distribution. The mean of this distribution depends on the lane on which the individual/sample is processed. By default, when laneEffect = FALSE, all samples are assumed to be processed in a single batch. Thus their library size is sampled from a log-normal distribution with identical mean (equal to meanLogLibSize_lane) and sd sdLogLibSize_samples. If laneEffect = TRUE, the samples are assumed to be processed in nLanes batches, that each have a different mean log-library size. In this case, the mean of the log-normal distribution for each lane is sampled from a normal distribution with mean meanLogLibSize_lane and sd sdLogLibSize_lane. In turn, the expected library size of each individual/sample is sampled form a log-normal distribution with the corresponding lane-dependent mean, and sd sdLogLibSize_samples.

Value

A list:

Examples

1
2
3
samples_list = sapply(1:10, function(x){paste0("Ind", x)})
libsize = sampleLibrarySize(samples_list)
libsize = sampleLibrarySize(samples_list, laneEffect = TRUE, nLanes = 3)

sismonr documentation built on Feb. 11, 2020, 9:07 a.m.