plink_map2rec_rates {gscramble} | R Documentation |
Convert a PLINK map file to 'gscramble' RecRates bins in a tibble
Description
This is a convenience function to convert PLINK map format to
the format used in the 'gscramble' RecRates
object. By default,
this function will use the positions of the markers and assume
recombination rates of 1 cM per megabase. If the marker positions
are also available in Morgans in the PLINK map file, the these can be
used by setting use_morgans
to TRUE.
Usage
plink_map2rec_rates(
map,
use_morgans = FALSE,
cM_per_Mb = 1,
chrom_lengths = NULL
)
Arguments
map |
path to the plink |
use_morgans |
logical. IF true, the third column in the PLINK map
file (assumed to have the position of the markers in Morgans) will be used
to calculate the |
cM_per_Mb |
numeric. If |
chrom_lengths |
if you know the full length of each chromosome, you can
add those in a tibble with columns |
Details
For simplicity, this function will assume that the length of the chromosome
is just one base pair beyond the last marker. That is typically not correct
but will have no effect, since there are no markers to be typed out beyond
that point. However, if you know the lengths of the chromosomes and want to
add those in there, then pass them into the chrom_lengths
option.
Value
A tibble that provides the recombination rates for the segments of the genome.
Examples
mapfile <- system.file(
"extdata/example-plink-with-morgans.map.gz",
package = "gscramble"
)
# get a rec-rates tibble from the positions of the markers,
# assuming 1 cM per megabase.
rec_rates_from_positions <- plink_map2rec_rates(mapfile)
# get a rec-rates tibble from the positions of the markers,
# assuming 1.5 cM per megabase.
rec_rates_from_positions_1.5 <- plink_map2rec_rates(
mapfile,
cM_per_Mb = 1.5
)
# get a rec-rates tibble from the cumulative Morgans position
# in the plink map file
rec_rates_from_positions_Morg <- plink_map2rec_rates(
mapfile,
use_morgans = TRUE
)
# get a rec-rates tibble from the cumulative Morgans position
# in the plink map file, and extend it out to the full length
# of the chromosome (assuming for that last part of the chromosome
# a map of 1.2 cM per megabase.)
rec_rates_from_positions_Morg_fl <- plink_map2rec_rates(
mapfile,
use_morgans = TRUE,
cM_per_Mb = 1.2,
chrom_lengths = example_chrom_lengths
)