| Title: | Point-and-Click Linkage Mapping and QTL Analysis |
|---|---|
| Description: | A 'shiny' application and a set of plain R functions for building genetic linkage maps and locating quantitative trait loci in F2 intercross, backcross and recombinant inbred line populations. It wraps 'onemap' (Margarido et al. 2007 <doi:10.1111/j.2007.0018-0661.02000.x>) for segregation tests, two-point analysis, grouping, ordering and map estimation, and 'qtl' (Broman et al. 2003 <doi:10.1093/bioinformatics/btg112>) for interval mapping and composite interval mapping with permutation thresholds. Results can be exported as figures, tables, a self-contained HTML report and an R script that reproduces the analysis. |
| Authors: | Ebenezer Ogoe [aut, cre, cph] (Co-creator; wrote the 2026 package), Michael Obeng [aut, cph] (Co-creator of Linkmapper (2022)), Stephen Amoako [aut, cph] (Co-creator of Linkmapper (2022)) |
| Maintainer: | Ebenezer Ogoe <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.0 |
| Built: | 2026-10-14 22:33:31 UTC |
| Source: | https://github.com/ebenogoe/linkmapper |
Reads a CSV with one row per individual, in the same order as in the
genotype file, and one numeric column per trait. A first column named
id, individual or ind is ignored.
add_traits(d, path)add_traits(d, path)
d |
An |
path |
Path to the CSV file. |
d with the traits in d$onemap$pheno (replacing any traits
from the genotype file).
Writes the mapped markers and the traits in MAPMAKER format, writes the
map with onemap::write_map(), and reads both with
qtl::read.cross(). Chromosomes are the linkage groups in map order.
build_cross(d, m)build_cross(d, m)
d |
The |
m |
An |
An R/qtl cross object.
Write a self-contained HTML report
build_report(res, settings = list(), path, title = "Linkmapper report")build_report(res, settings = list(), path, title = "Linkmapper report")
res |
A list with any of |
settings |
The settings list. |
path |
Output file. |
title |
Report title. |
path, invisibly.
Write an R script that repeats an analysis
build_script(settings, source)build_script(settings, source)
settings |
A settings list. |
source |
List with |
A character string of R code.
Every step of the app is described by one entry in this list. The app
fills it in as you go, run_analysis() replays it, and build_script()
turns it into R code.
default_settings(d = NULL)default_settings(d = NULL)
d |
Optional |
A named list.
The F2 and backcross demos are the simulated example data shipped with
onemap (200 and 150 individuals, one trait each). The RIL demo is
onemap's selfed RIL example (100 lines, no traits). small is the
20-individual F2 file from the 2022 Linkmapper.
demo_info() linkmapper_demo(name = c("f2", "bc", "ril", "small"))demo_info() linkmapper_demo(name = c("f2", "bc", "ril", "small"))
name |
One of |
demo_info() returns a data frame describing each dataset.
linkmapper_demo() returns an lm_data object.
Filter markers
filter_markers(d, max_missing = 0.25, drop_distorted = FALSE, alpha = 0.05)filter_markers(d, max_missing = 0.25, drop_distorted = FALSE, alpha = 0.05)
d |
An |
max_missing |
Largest share of missing genotypes allowed per marker. |
drop_distorted |
Remove markers with significant segregation distortion (Bonferroni-corrected). |
alpha |
Family-wise significance level for distortion. |
The filtered lm_data, with a filter element recording what
was removed.
Trait values by genotype at a marker
genotype_effect(res, marker)genotype_effect(res, marker)
res |
An |
marker |
Marker name. |
A data frame with genotype and value.
Kept for scripts written for Linkmapper 0.1. Prefer linkage_groups().
group_markers(onemap_obj, lod = 3, max_rf = 0.5, map_fun = "kosambi")group_markers(onemap_obj, lod = 3, max_rf = 0.5, map_fun = "kosambi")
onemap_obj |
A onemap object. |
lod |
LOD threshold. |
max_rf |
Largest recombination fraction treated as linkage. |
map_fun |
|
The onemap group object.
Runs two-point analysis on every pair of markers and groups markers that are linked at or above the LOD threshold and at or below the maximum recombination fraction.
linkage_groups(d, lod = NULL, max_rf = 0.5)linkage_groups(d, lod = NULL, max_rf = 0.5)
d |
An |
lod |
LOD threshold. Defaults to |
max_rf |
Largest recombination fraction treated as linkage. |
An lm_groups list with the onemap twopts and groups
objects and a table of groups.
g <- linkage_groups(linkmapper_demo("bc")) g$tableg <- linkage_groups(linkmapper_demo("bc")) g$table
Size of a linkage map figure in inches
map_plot_size(m)map_plot_size(m)
m |
An |
c(width, height).
Marker positions on a map
map_positions(m)map_positions(m)
m |
An |
A data frame with one row per marker: linkage group, order, marker, position (cM) and distance to the previous marker.
Summary of each linkage group
map_summary(m)map_summary(m)
m |
An |
A data frame with markers, length, mean and largest spacing per group.
Orders each group with the chosen algorithm and estimates map distances with the chosen mapping function. Groups with fewer than two markers cannot be ordered and are reported as unplaced.
order_groups( groups, method = "record", map_fun = c("kosambi", "haldane"), seed = 1, progress = NULL )order_groups( groups, method = "record", map_fun = c("kosambi", "haldane"), seed = 1, progress = NULL )
groups |
An |
method |
One of |
map_fun |
|
seed |
Random seed. RECORD and UG use random starting orders, so the seed makes the map repeatable. |
progress |
Optional function called with the share done (0 to 1). |
An lm_map list with the ordered onemap sequences (maps), a
positions table and settings.
Ordering algorithms
order_methods()order_methods()
A named character vector (labels as names).
Trait values by genotype
plot_effect(df, marker, trait, dark = FALSE)plot_effect(df, marker, trait, dark = FALSE)
df |
Result of |
marker |
Marker name, for the title. |
trait |
Trait name, for the axis. |
dark |
Colours for a dark background. |
A ggplot object.
Each linkage group is a vertical bar with positions (cM) on the left and
marker names on the right. Labels are spread so they do not overlap.
QTL support intervals from scan_qtl() can be drawn beside the groups.
plot_linkage_map(m, qtl = NULL, dark = FALSE, label_size = 2.9, title = NULL)plot_linkage_map(m, qtl = NULL, dark = FALSE, label_size = 2.9, title = NULL)
m |
An |
qtl |
Optional |
dark |
Colours for a dark background. |
label_size |
Text size. |
title |
Optional title. |
A ggplot object (interactive with ggiraph::girafe()).
LOD profile plot
plot_lod(res, dark = FALSE)plot_lod(res, dark = FALSE)
res |
An |
dark |
Colours for a dark background. |
A ggplot object.
Missing data plot
plot_missing(q, threshold = NULL, dark = FALSE)plot_missing(q, threshold = NULL, dark = FALSE)
q |
Result of |
threshold |
Optional cut-off to draw. |
dark |
Colours for a dark background. |
A ggplot object.
Markers are in map order. Darker cells mean tighter linkage.
plot_rf_heatmap(m, lg, dark = FALSE)plot_rf_heatmap(m, lg, dark = FALSE)
m |
An |
lg |
Linkage group name, for example |
dark |
Colours for a dark background. |
A ggplot object.
Segregation test plot
plot_segregation(q, dark = FALSE)plot_segregation(q, dark = FALSE)
q |
Result of |
dark |
Colours for a dark background. |
A ggplot object.
Missing data per marker and per individual, genotype counts, and the chi-square test of each marker against its expected Mendelian ratio (1:2:1, 3:1, 1:1). The significance threshold is Bonferroni-corrected for the number of markers.
qc_summary(d, alpha = 0.05)qc_summary(d, alpha = 0.05)
d |
An |
alpha |
Family-wise significance level for segregation distortion. |
A list with markers and individuals data frames and the
corrected threshold alpha_bonferroni.
QTL mapping methods
qtl_methods()qtl_methods()
A named character vector (labels as names).
Reads MAPMAKER files (.raw or .txt, as used by MAPMAKER/EXP and
R/qtl) and onemap raw files. Supported populations are F2 intercross,
backcross, and recombinant inbred lines from selfing or sib mating.
read_cross(path, name = basename(path))read_cross(path, name = basename(path))
path |
Path to the file. |
name |
Original file name, if |
An lm_data object holding the onemap object, the population
type and the file contents.
d <- read_cross(system.file("extdata", "mapmaker_example_bc.raw", package = "onemap")) dd <- read_cross(system.file("extdata", "mapmaker_example_bc.raw", package = "onemap")) d
Run a whole analysis from settings
run_analysis(d, settings = default_settings(d), progress = NULL)run_analysis(d, settings = default_settings(d), progress = NULL)
d |
An |
settings |
A list like |
progress |
Optional function called with a message at each step. |
A list with data, groups, map, cross and qtl.
run_linkmapper() is the name used in Linkmapper 0.1 and still works.
run_app( onStart = NULL, options = list(), enableBookmarking = NULL, uiPattern = "/", ... ) run_linkmapper(...)run_app( onStart = NULL, options = list(), enableBookmarking = NULL, uiPattern = "/", ... ) run_linkmapper(...)
onStart, options, enableBookmarking, uiPattern
|
Passed to
|
... |
Options passed to the app as golem options. |
A Shiny app object.
if (interactive()) run_app()if (interactive()) run_app()
A session file is JSON holding the genotype file contents, any traits and the settings. Results are recomputed when the session is opened.
save_session(d, settings, path) load_session(path)save_session(d, settings, path) load_session(path)
d |
The |
settings |
The settings list. |
path |
File to write or read. |
save_session() returns path invisibly; load_session()
returns a list with data and settings.
Interval mapping (qtl::scanone()) or composite interval mapping
(qtl::cim()) for one trait, with a genome-wide LOD threshold from
permutations (Churchill and Doerge 1994). For each linkage group whose
highest LOD passes the threshold, the peak is reported with its
1.5-LOD support interval, nearest marker, genome-wide p-value, percentage
of phenotypic variance explained and estimated effects.
scan_qtl( cross, trait = NULL, method = "hk", cim = FALSE, n_marcovar = 3, window = 10, n_perm = 1000, alpha = 0.05, step = 1, seed = 1, progress = NULL )scan_qtl( cross, trait = NULL, method = "hk", cim = FALSE, n_marcovar = 3, window = 10, n_perm = 1000, alpha = 0.05, step = 1, seed = 1, progress = NULL )
cross |
A cross from |
trait |
Trait name. |
method |
One of |
cim |
Use composite interval mapping. |
n_marcovar, window
|
Marker covariates and window (cM) for CIM. |
n_perm |
Number of permutations. |
alpha |
Genome-wide significance level. |
step |
Spacing (cM) of the scan. |
seed |
Random seed. |
progress |
Optional function called with the share done (0 to 1). |
An lm_qtl list.
Uses onemap's suggestion, which accounts for the number of tests made in the two-point analysis.
suggest_lod(d)suggest_lod(d)
d |
An |
A number.
ggplot2 theme used by Linkmapper
theme_linkmapper(base_size = 12, dark = FALSE)theme_linkmapper(base_size = 12, dark = FALSE)
base_size |
Base font size. |
dark |
Use colours for a dark background. |
A ggplot2 theme.
Kept from Linkmapper 0.1 for scripts that use it. Prefer read_cross().
validate_lm_file(path)validate_lm_file(path)
path |
Path to a MAPMAKER or onemap file. |
A onemap object.
Used to pass data from onemap to R/qtl, and useful for exporting a filtered dataset.
write_mapmaker(d, file)write_mapmaker(d, file)
d |
An |
file |
Output path. |
file, invisibly.