Skip to content

Commit

Permalink
input of vcfcomp can be saved RDS file
Browse files Browse the repository at this point in the history
  • Loading branch information
Zilong-Li committed Apr 30, 2024
1 parent 5cc0b28 commit fea9f8c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/vcf-compare.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' \code{vcfcomp} implements various statisitcs to compare two VCF/BCF files,
#' e.g. report genotype concocrdance, correlation stratified by allele frequency.
#'
#' @param test path to the first VCF/BCF file referred as test.
#' @param test path to the first VCF/BCF file referred as test, or saved RDS file.
#'
#' @param truth path to the second VCF/BCF file referred as truth, or saved RDS file.
#'
Expand Down Expand Up @@ -78,7 +78,9 @@ vcfcomp <- function(test, truth,
formats[1] <- "GT"
}
collapse <- ifelse(stats=="pse", FALSE, TRUE)
d1 <- vcftable(test, format = formats[1], setid = TRUE, collapse = collapse, ...)
d1 <- tryCatch( { suppressWarnings(readRDS(test)) }, error = function(e) {
vcftable(test, format = formats[1], setid = TRUE, collapse = collapse, ...)
} )
d2 <- tryCatch( { suppressWarnings(readRDS(truth)) }, error = function(e) {
vcftable(truth, format = formats[2], setid = TRUE, collapse = collapse, ...)
} )
Expand Down

0 comments on commit fea9f8c

Please sign in to comment.