ggplot_scan1pattern {qtl2pattern} | R Documentation |
Plot scan pattern usign ggplot2
Description
Plot scan pattern usign ggplot2
Genome scan by pattern set
Usage
ggplot_scan1pattern(
object,
map,
plot_type = c("lod", "coef", "coef_and_lod"),
patterns = object$patterns$founders,
columns = 1:3,
min_lod = 3,
lodcolumn = seq_along(patterns),
facet = "pheno",
...
)
## S3 method for class 'scan1pattern'
autoplot(object, ...)
scan1pattern(
probs1,
phe,
K = NULL,
covar = NULL,
map,
patterns,
condense_patterns = TRUE,
blups = FALSE,
do_scans = TRUE
)
## S3 method for class 'scan1pattern'
summary(object, map, ...)
Arguments
object |
object of class |
map |
genome map |
plot_type |
type of plot from |
patterns |
data frame of pattern information |
columns |
columns used for coef plot |
min_lod |
minimum LOD peak for contrast to be retained |
lodcolumn |
columns used for scan1 plot (default all |
facet |
Plot facets if multiple phenotypes and patterns provided (default = |
... |
additional parameters passed on to other methods |
probs1 |
object of class |
phe |
data frame with one phenotype |
K |
kinship matrix |
covar |
covariate matrix |
condense_patterns |
remove snp_action from contrasts if TRUE |
blups |
Create BLUPs if |
do_scans |
Do scans if |
Value
object of class ggplot
List containing:
patterns Data frame of summary for top patterns (column
founders
has pattern)dip_set Diplotype sets for contrasts
group Group for each founder pattern
scan Object of class
scan1
.coef Object of class
listof_scan1coef
. See package 'qtl2ggplot'.
Author(s)
Brian S Yandell, brian.yandell@wisc.edu
Examples
dirpath <- "https://raw.githubusercontent.com/rqtl/qtl2data/master/DOex"
# Read DOex example cross from 'qtl2data'
DOex <- subset(qtl2::read_cross2(file.path(dirpath, "DOex.zip")), chr = "2")
# Download genotype probabilities
tmpfile <- tempfile()
download.file(file.path(dirpath, "DOex_genoprobs_2.rds"), tmpfile, quiet=TRUE)
pr <- readRDS(tmpfile)
unlink(tmpfile)
# Download SNP info for DOex from web and read as RDS.
tmpfile <- tempfile()
download.file(file.path(dirpath, "c2_snpinfo.rds"), tmpfile, quiet=TRUE)
snpinfo <- readRDS(tmpfile)
unlink(tmpfile)
snpinfo <- dplyr::rename(snpinfo, pos = pos_Mbp)
# Convert to SNP probabilities
snpinfo <- qtl2::index_snps(DOex$pmap, snpinfo)
snppr <- qtl2::genoprob_to_snpprob(pr, snpinfo)
# Scan SNPs
scan_snppr <- qtl2::scan1(snppr, DOex$pheno)
top_snps_tbl <- top_snps_pattern(scan_snppr, snpinfo)
# Summarize to find top patterns
patterns <- dplyr::arrange(summary(top_snps_tbl), dplyr::desc(max_lod))
# Scan using patterns.
scan_pat <- scan1pattern(pr, DOex$pheno, map = DOex$pmap, patterns = patterns)
# Summary of scan1pattern.
summary(scan_pat, DOex$pmap)