Skip to content

Commit

Permalink
v0.38
Browse files Browse the repository at this point in the history
  • Loading branch information
jendelman committed Jan 4, 2024
1 parent b1b0025 commit a71aed0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: polyBreedR
Title: Genomics-assisted breeding for polyploids (and diploids)
Version: 0.37
Version: 0.38
Author: Jeffrey B. Endelman
Maintainer: Jeffrey Endelman <[email protected]>
Description: Genomics-assisted breeding for polyploids (and diploids)
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
Changes in 0.38
* Added chunk.size option to gbs

Changes in 0.37
* Vignette 3

Expand Down
15 changes: 10 additions & 5 deletions R/gbs.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
#'
#' Posterior mode and mean genotypes are added as GT and DS fields. GQ is also added based on probability of posterior mode. Binomial calculation uses R/updog package (Gerard et al. 2018) with "norm" prior. Previous INFO is discarded; adds NS, DP.AVG, AF.GT, AB, OD, SE.
#'
#' The input file is processed in chunks of size \code{chunk.size}.
#'
#' @param in.file VCF input file
#' @param out.file VCF output file
#' @param ploidy ploidy
#' @param bias TRUE/FALSE, whether to estimate allelic bias
#' @param n.core number of cores
#' @param chunk.size number of variants to process at a time
#' @param silent TRUE/FALSE
#'
#' @return nothing
Expand All @@ -21,7 +24,10 @@
#' @importFrom stats anova lm chisq.test

gbs <- function(in.file, out.file, ploidy, bias=TRUE, n.core=1,
silent=FALSE) {
chunk.size=1000, silent=FALSE) {

chunk.size <- as.integer(chunk.size)
stopifnot(chunk.size > 0)

prior <- "norm"
if (bias) {
Expand Down Expand Up @@ -106,14 +112,13 @@ gbs <- function(in.file, out.file, ploidy, bias=TRUE, n.core=1,
return(paste(c(info,"GT:AD:DP:DS:GQ",z),collapse="\t"))
}

block.size <- 100
nb <- prep$n.mark %/% block.size+1
nb <- prep$n.mark %/% chunk.size+1
i=1
for (i in 1:nb) {
tmp <- readLines(con.in,block.size)
tmp <- readLines(con.in,chunk.size)
m <- length(tmp)
if (!silent)
cat(sub("X",(i-1)*block.size + m,"Progress: X markers\n"))
cat(sub("X",(i-1)*chunk.size + m,"Progress: X markers\n"))
tmp2 <- strsplit(tmp,split="\t",fixed=T)
x <- lapply(tmp2,function(x){vcf_extract(x[-(1:8)],"AD")})
if (n.core > 1) {
Expand Down
Binary file modified docs/polyBreedR_Manual.pdf
Binary file not shown.
14 changes: 13 additions & 1 deletion man/gbs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a71aed0

Please sign in to comment.