create_slimMap: Create recombination map

Description Usage Arguments Details Value References See Also Examples

View source: R/SlimFunctions.R

Description

Create a recombination map that can be used with SLiM (Haller and Messer 2017).

Usage

1
create_slimMap(exon_df, mutation_rate = 1e-08, recomb_rate = 1e-08)

Arguments

exon_df

Data frame. A data frame that contains the positions of each exon to simulate. This data frame must contain the variables chrom, exonStart, and exonEnd. See details.

mutation_rate

Numeric. The per-site per-generation mutation rate, assumed to be constant across the genome. By default, mutation_rate= 1E-8, as in Harris and Nielson (2016).

recomb_rate

Numeric. The per-site per-generation mutation rate, assumed to be constant across the genome. By default, mutation_rate= 1E-8, as in Harris and Nielson (2016)

Details

The Eidos program SLiM (Haller and Messer 2017) is a versatile forwards-in-time evolutionary simulator. SLiM simulates recombination hotspots by way of a user-specified recombination map. This recombination map may be utilized to simulate mutations over unlinked regions (i.e. in different chromosomes) or in linked but non-contiguous regions (i.e in exon-only data). The create_slimMap function may be used to generate the recombination map required by SLiM to simulate exon-only SNV data.

We expect that exon_df does not contain any overlapping segments. Prior to supplying the exon data to create_slimMap users must combine overlapping exons into a single observation. The combine_exons function may be used to accomplish this task.

The argument exon_df must contain the following variables:

name type description
chrom numeric chromosome identification number
exonStart numeric the position of the first base pair in the exon
exonStop numeric the position of the last base pair in the exon

The data frame returned by create_slimMap contains variables required by SLiM to simulate exon-only data. Additionally, the returned data frame also includes variables that are required to re-map mutations to their correct positions when importing SLiM data to R. The variables contained in the returned data frame are described as follows.

chrom

The chromosome number.

segLength

The length of the segment in base pairs. We assume that segments contain the positions listed in exonStart and exonEnd. Therefore, for a combined exon segment, segLength is calculated as exonEnd - exonStart + 1.

recRate

The per-site per-generation recombination rate. Following Harris and Nielson (2016), segments between exons on the same chromosome are simulated as a single base pair with rec_rate equal to recombination rate multiplied by the number of base pairs in the segment. For each chromosome, a single site is created between the last exon on the previous chromosome and the first exon of the current chromosome. This site will have recombination rate 0.5 to accommodate unlinked chromosomes.

mutRate

The per-site per-generation mutation rate. Since we are interested in exon-only data, the mutation rate outside exons is set to zero.

exon

A logical variable that is TRUE if the segment is an exon and FALSE otherwise.

simDist

The simulated exon length, in base pairs. When exon = TRUE, simDist = segLength; however, when exon = FALSE, simDist = 1 since segments between exons on the same chromosome are simulated as a single base pair.

endPos

The simulated end position, in base pairs, of the segment.

Only three of the variables returned by create_slimMap are required by SLiM to simulate exon-only data: recRate, mutRate, and endPos. The other variables seen in the output above are used by the read_slim function to re-map mutations to their correct positions when importing SLiM data to R.

Please note: SLiM is written in a scripting language called Eidos. Unlike an R array, the first position in an Eidos array is 0. Therefore, users must shift the variable endPos forward 1 unit before supplying this variable to SLiM. See example.

Value

A recombination map that may be used in conjunction with SLiM (Haller and Messer 2017). See details and example.

References

Benjamin Haller and Phillip W. Messer (2017). Slim 2: Flexible, interactive forward genetic simulations. Molecular Biology and Evolution; 34(1), pp. 230-240.

Kelly Harris and Rasmus Nielsen (2016). The genetic cost of neanderthal introgression. Genetics, 203(2): pp. 881-891.

See Also

combine_exons

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
#load hg_exons data
data(hg_exons)

#since the exons in hg_exons have already been combined into
#overlapping exons, we supply hg_exons to create_slimMap
slimMap <- create_slimMap(hg_exons)
head(slimMap)

# restrict output to the variables required by SLiM
slimMap <- slimMap[, c("recRate", "mutRate", "endPos")]

# shift endPos up by one unit
slimMap$endPos <- slimMap$endPos - 1

# print first four rows of slimMap
head(slimMap, n = 4)

SimRVSequences documentation built on July 1, 2020, 6:03 p.m.