Skip to content

Commit

Permalink
fixed bad AD in gbs
Browse files Browse the repository at this point in the history
  • Loading branch information
jendelman committed Jan 4, 2024
1 parent 7e471a9 commit 7716174
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/gbs.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#'
#' Genotype calls for genotype-by-sequencing (GBS) data
#'
#' VCF input file must contain AD field. 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.
#' VCF input file must contain AD field. Variants with more than 2 alleles are coerced to zero DP, so better to filter them out first.
#'
#' 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.
#'
#' @param in.file VCF input file
#' @param out.file VCF output file
Expand Down Expand Up @@ -64,6 +66,7 @@ gbs <- function(in.file, out.file, ploidy, bias=TRUE, n.core=1,
if (any(is.na(alt)))
alt[is.na(alt)] <- 0

AD <- apply(cbind(ref,alt),1,paste,collapse=",")
DP <- ref+alt
DP.AVG <- paste("DP.AVG",round(mean(DP),1),sep="=")

Expand Down

0 comments on commit 7716174

Please sign in to comment.