merge_feature: Plot of merge_feature object

View source: R/merge_feature.R

ggplot_merge_featureR Documentation

Plot of merge_feature object

Description

Merge all SNPs in small region with LOD peaks across multiple phenotype.

Usage

ggplot_merge_feature(object, pheno, plot_by = c("pattern", "consequence"), ...)

## S3 method for class 'merge_feature'
autoplot(object, ...)

merge_feature(
  top_snps_tbl,
  snpinfo,
  out_lmm_snps,
  drop = 1.5,
  dropchar = 0,
  exons = gene_exon(top_snps_tbl)
)

## S3 method for class 'merge_feature'
summary(object, sum_type = c("SNP type", "pattern"), ...)

Arguments

object

of class merge_feature

pheno

name of phenotype to be plotted

plot_by

element to plot by (one of c("pattern","consequence"))

...

other arguments not used

top_snps_tbl

tbl from top_snps_pattern or top_snps

snpinfo

SNP information table

out_lmm_snps

tbl from scan1 on SNPs

drop

include LOD scores within drop of max for each phenotype

dropchar

number of characters to drop on phenames

exons

table from gene_exon

sum_type

one of c("SNP type","pattern")

Value

ggplot2 object

tbl with added information on genes and exons

table summary

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)

# Collect top SNPs
top_snps_tbl <- top_snps_pattern(scan_snppr, snpinfo)
summary(top_snps_tbl)

# Download Gene info for DOex from web via RDS
tmpfile <- tempfile()
download.file(file.path(dirpath, "c2_genes.rds"), tmpfile, quiet=TRUE)
gene_tbl <- readRDS(tmpfile)
unlink(tmpfile)

out <- merge_feature(top_snps_tbl, snpinfo, scan_snppr, exons = gene_tbl)
summary(out, "pattern")



byandell/qtl2pattern documentation built on Nov. 9, 2023, 7:57 p.m.