-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.Rmd
116 lines (83 loc) · 3.75 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
### mmconvert
[![R-CMD-check](https://github.com/rqtl/mmconvert/workflows/R-CMD-check/badge.svg)](https://github.com/rqtl/mmconvert/actions)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/mmconvert)](https://cran.r-project.org/package=mmconvert)
[![zenodo DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5565363.svg)](https://doi.org/10.5281/zenodo.5565363)
[Karl Broman](https://kbroman.org)
R package to convert mouse genome positions between build 39 physical locations and
the [Cox genetic map](https://doi.org/10.1534/genetics.109.105486) positions.
(See the [Cox map version 3](https://github.com/kbroman/CoxMapV3), updated
for the build 39 physical map.)
The package is a reimplementation of part of the basic functionality
of the mouse map converter web service from Gary Churchill's group at
the Jackson Lab.
---
### Installation
Install the package from
[CRAN](https://cran.r-project.org/package=mmconvert) with
`install.packages("mmconvert")`.
Alternatively, install the mmconvert package from
[GitHub](https://github.com/rqtl/mmconvert) using the
[remotes package](https://remotes.r-lib.org):
install.packages("remotes")
remotes::install_github("rqtl/mmconvert")
---
### Usage
[mmconvert](https://github.com/rqtl/mmconvert) contains two functions:
`mmconvert()` and `cross2_to_grcm39()`.
#### `mmconvert()`
`mmconvert()` takes a set of positions as input, plus an
indication of whether they are basepairs or Mbp (in build 39) or
sex-averaged, female, or male cM from a slightly smoothed version of the [revised Cox genetic
map](https://github.com/kbroman/CoxMapV3).
The input positions can be character strings like `"chr:position"`.
```{r input_char}
input_char <- c(rs13482072="14:6738536", rs13482231="14:67215850", gnf14.117.278="14:121955310")
```
Or they can be a list of marker positions, separated by chromosome.
```{r input_list}
input_list <- list("14"=c(rs13482072=6738536, rs13482231=67215850, gnf14.117.278=121955310))
```
Or they can be a data frame with chromosome IDs as the first column
and positions as the second column. Marker names can either be in a
third column or included as row names.
```{r input_df}
input_df <- data.frame(chr=c(14,14,14),
pos=c(6738536, 67215850, 121955310),
marker=c("rs13482072", "rs13482231", "gnf14.117.278"))
```
For any of these cases, the output is a data frame with seven
columns: marker, chromosome, sex-averaged cM, female cM, male cM,
basepairs, and mega-basepairs.
```{r mmconvert}
library(mmconvert)
mmconvert(input_df)
```
If you want to give the input positions in Mbp rather than basepairs,
use the argument `input_type="Mbp"`.
```{r mmconvert_Mbp}
input_df$pos <- input_df$pos / 1e6
mmconvert(input_df, input_type="Mbp")
```
The input positions can also be provided in sex-averaged, female, or male cM.
But note that the bp or Mbp positions must be in mouse genome build
39, and cM positions must be according to the
[Cox Map V3](https://github.com/kbroman/CoxMapV3).
#### `cross2_to_grcm39()`
`cross2_to_grcm39()` takes a cross2 object from
[R/qtl2](https://kbroman.org/qtl2/) with mouse genotype data from one
of the MUGA arrays and converts it to mouse genome build GRCm39, by
possibly subsetting the markers, reordering them according to the
GRCm39 build, and plugging in GRCm39 Mbp positions and the revised Cox
genetic map. See <https://github.com/kbroman/MUGAarrays> for the
MUGA array annotations and <https://github.com/kbroman/CoxMapV3> for
the revised Cox genetic map.
```{r cross2_to_grcm39, eval=FALSE}
file <- paste0("https://raw.githubusercontent.com/rqtl/",
"qtl2data/main/DOex/DOex.zip")
library(qtl2)
DOex <- read_cross2(file)
DOex_rev <- cross2_to_grcm39(DOex)
```
---
#### License
Licensed under [GPL-3](https://www.r-project.org/Licenses/GPL-3).