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.

Two fixable things:

  1. Make a helper routine that gets dimensions across chromosomes. Make it a method function so that we can have separate methods by database type. Replace {v,l,s}apply with this.
  2. Fix 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:

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]])



byandell/qtl2feather documentation built on May 13, 2019, 9:30 a.m.