snpprob_collapse: Collapse genoprob according to pattern

View source: R/snpprob_collapse.R

snpprob_collapseR Documentation

Collapse genoprob according to pattern

Description

Collapse genoprob according to pattern

Usage

snpprob_collapse(
  snpprobs,
  action = c("additive", "add+dom", "non-add", "recessive", "dominant", "basic")
)

Arguments

snpprobs

object of class calc_genoprob

action

SNP gene action type

Value

object of class calc_genoprob

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)


dim(snppr[[1]])
dim(snpprob_collapse(snppr, "additive")[[1]])



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