knitr::opts_chunk$set(echo = TRUE)

R Markdown

Convert from save/load to saveRDS/readRDS. Should improve access but will not change size.

suppressPackageStartupMessages({
  library(qtl2geno)
  library(DOread)
  library(qtl2feather)
})
dirpath <- file.path("~/Documents/Research/attie_alan/DO", "data")
datapath <- file.path(dirpath, "DerivedData")

Set up feather directory.

pmap <- readRDS(file.path(datapath, "pmap.rds"))
feather_dir <- file.path(datapath, "feather")
if(!dir.exists(feather_dir))
  dir.create(feather_dir)

Genotype allele probabilities (slow)

aprobs <- DOread::read_probs(NULL, datapath = datapath, method = "calc")$probs
faprobs <- qtl2feather::feather_genoprob(aprobs, "aprobs", feather_dir, verbose = FALSE)
saveRDS(faprobs, file = file.path(feather_dir, "faprobs.rds"))

Genotype 36 probabilities (very slow).

chr <- names(pmap)[1]
probs <- DOread::read_probs(chr, datapath = datapath, 
                            allele = FALSE, method = "calc")$probs
fprobs <- qtl2feather::feather_genoprob(probs, "probs", 
                                        feather_dir, verbose = FALSE)
for(chr in names(pmap)[-1]) {
  cat(chr, "\n")
  probs <- DOread::read_probs(chr, datapath = datapath, 
                              allele = FALSE, method = "calc")$probs
  fprobs <- cbind(fprobs, 
                  qtl2feather::feather_genoprob(probs, "probs", 
                                                feather_dir, verbose = FALSE))
}
saveRDS(fprobs, file = file.path(feather_dir, "fprobs.rds"))
system(paste("ls -lh", feather_dir))


byandell/DOread documentation built on May 13, 2019, 9:26 a.m.