R: Combine linkage maps from multiple R/qtl cross objects
combineMap
R Documentation
Combine linkage maps from multiple R/qtl cross objects
Description
Combine map information, marker data and phenotype data from multiple R/qtl cross objects
Usage
combineMap(..., id = "Genotype", keep.all = TRUE)
Arguments
...
An unlimited set of arguments with each argument defining an R/qtl cross
object. All R/qtl objects can have any class structure but it must be
identical across objects. (see Details for more information.)
id
The name of the common column in the pheno element of each cross
object representing the genotype names. Default is "Genotype".
keep.all
A logical value determining whether all genotypes should be kept in the
final linkage map regardless of their absence in some linkage maps (see
Details). Default is TRUE.
Details
This function combines linkage maps from multiple R/qtl cross
objects by merging marker data and map information as well as phenotypic
data if present. The function
contains some initial checks before proceeding with the
combining. Firstly, all R/qtl cross objects must have the same class
structure and have a column in the pheno
element of the object named by the argument id. The marker
names must also be unique across linkage maps as well as avoid the
symbol ";". This symbol is reserved for string manipulation within the
function.
The combining of linkage maps occurs in multiple ways. Firstly, it
merges the linkage maps sequentially based on genotype names. If
keep.all=TRUE then the marker data and phenotypic data are
"padded out" when genotype names are not shared between maps. If
keep.all=FALSE then the marker data and phenotype data are shrunk
to only include genotypes that are shared among all linkage
maps. Secondly, if a linkage group name is shared across
linkage maps then the marker data from the shared linkage group in each
of the maps will be merged.
Several things are important to note with this function. Non-matching
genotype names between linkage maps will expand the final marker data
and phenotypic data so it is prudent to check genotype names are correct
in each of the linkage maps before combining. If maps share the same linkage group
names and do not require merging the duplicate linkage group names in one
of the linkage maps will need to be altered before combining. As a final
process, markers are ordered within linkage groups according to
distances supplied in each of the linkage maps.
It should also be noted that this function does not re-construct the
final linkage map after combining the set of linkage maps. For efficient
linkage map reconstruction of the combined R/qtl object see
mstmap.cross().
Value
A single R/qtl cross object is returned with identical class structure as the
inputted cross objects.
Author(s)
Julian Taylor
See Also
breakCross and mergeCross
Examples
data(mapDH, package = "ASMap")
## create copy of mapDH with some different linkage groups
## and change marker names so they are unique
mapDH1 <- mapDH
names(mapDH1$geno)[5:14] <- paste("L",1:10, sep = "")
mapDH1$geno <- lapply(mapDH1$geno, function(el){
names(el$map) <- dimnames(el$data)[[2]] <- paste(names(el$map), "A", sep = "")
el})
mapDHc <- combineMap(mapDH, mapDH1)
nmar(mapDHc)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(ASMap)
Loading required package: qtl
Loading required package: gtools
Loading required package: fields
Loading required package: spam
Loading required package: grid
Spam version 1.3-0 (2015-10-24) is loaded.
Type 'help( Spam)' or 'demo( spam)' for a short introduction
and overview of this package.
Help for individual functions is also obtained by adding the
suffix '.spam' to the function name, e.g. 'help( chol.spam)'.
Attaching package: 'spam'
The following objects are masked from 'package:base':
backsolve, forwardsolve
Loading required package: maps
# maps v3.1: updated 'world': all lakes moved to separate new #
# 'lakes' database. Type '?world' or 'news(package="maps")'. #
Loading required package: RColorBrewer
Loading required package: lattice
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/ASMap/combineMap.Rd_%03d_medium.png", width=480, height=480)
> ### Name: combineMap
> ### Title: Combine linkage maps from multiple R/qtl cross objects
> ### Aliases: combineMap
> ### Keywords: misc
>
> ### ** Examples
>
>
> data(mapDH, package = "ASMap")
>
> ## create copy of mapDH with some different linkage groups
> ## and change marker names so they are unique
>
> mapDH1 <- mapDH
> names(mapDH1$geno)[5:14] <- paste("L",1:10, sep = "")
> mapDH1$geno <- lapply(mapDH1$geno, function(el){
+ names(el$map) <- dimnames(el$data)[[2]] <- paste(names(el$map), "A", sep = "")
+ el})
>
> mapDHc <- combineMap(mapDH, mapDH1)
> nmar(mapDHc)
1A 1B1 1B2 1D 2A 2B 2D1 2D2 3A 3B 3D 4A 4B 4D 5A 5B 5D 6A 6B 6D
82 10 66 20 40 35 8 13 37 30 6 30 32 6 108 112 12 54 82 30
7A 7B 7D L1 L2 L3 L4 L5 L6 L7 L8 L9 L10
66 74 8 40 35 8 13 37 30 6 30 32 6
>
>
>
>
>
> dev.off()
null device
1
>