knitr::opts_chunk$set(echo = TRUE)
This documents use cases for calc_genoprob
objects in package Rqtl/qtl2
. The R/qtl2feather
is intended to meet these use cases with new subset
, rbind
, and cbind
and other operators for an S3 class feather_genoprob
. The routine feather_genoprob()
creates a feather database for the probs
part of a calc_genoprobs
object.
Use grep
to find use cases in R/*.R
files. After looking for genoprob
and probs
,
here are the cases that remain unsolved.
RcppExports.R
probs
to C++
subroutines in R/qtl2
vapply,lapply,sapply
calc_kinship
and scan1
get mar
dimension acros chr
feather_genoprob_list(genoprobs, dim)[3,]
genoprob_col2drop
uses lapply(probs, genoprobs_col2drop)
sapply(probs, dim)
used in some function examplesgenoprob_to_alleleprob
and genoprob_to_snpprob
each return a calc_genoprob
objectfeather_genoprob
each time if desiredprobs_to_grid
used only by calc_kinship
chr
objects but attributes needed; assumes calc_genoprob
scan1
and scan1_pg
subsets as genoprobs[[chr]][these2keep,-Xcol2drop,,drop=FALSE]
subset(genoprobs, ind=these2keep)[[chr]][,-Xcol2drop,,drop=FALSE]
stuff in qtl2convert
?
tests/testthat
seem OKTwo fixable things:
{v,l,s}apply
with this.probs_to_grid
to explicitly make sure attributes carry forward.Not sure what to do about lapply()
in genoprob_col2drop
.
With these fixes, the following routines will return calc_genoprob objects as is:
genoprob_to_alleleprob
genoprob_to_snpprob
probs_to_grid
The last one is basically internal, but the other two are used a lot. But probably best to have user explicitly convert to feather as they will need to supply a basename
and know a file is being created.
routine | use case
------------------------ | --------------------------------------
RcppExports.R
| pass argument probs
or genoprobs
to various subroutines
calc_kinship.R
| vapply(probs, function(a) dim(a)[3], 0)[chrs]
genoprob_to_alleleprob.R
| genoprob_to_alleleprob(probs) #
returns calc_genoprob
object
probs_to_grid.R
| probs_to_grid(probs, grid) #
returns list but watch out
probs_to_grid.R
| sapply(probs, dim)
|
genoprob_col2drop.R
| lapply(probs, genoprobs_col2drop)
genoprob_to_snpprob
| genoprob_to_snpprob(probs, snpinfo)
returns calc_genoprob
object
scan1.R
| genoprobs[[chr]][these2keep,-Xcol2drop,,drop=FALSE]
scan1.R
| vapply(genoprobs, function(a) dim(a)[3], 1)
scan1.R
| lapply(genoprobs, function(a) dimnames(a)[[3]])
scan1_pg.R
| vapply(genoprobs, function(a) dim(a)[3], 1)
scan1_pg.R
| lapply(genoprobs, function(a) dimnames(a)[[3]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.