Skip to content

Commit 5f56156

Browse files
committed
seqGDS2VCF() with indexing
1 parent 2466c36 commit 5f56156

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ UTILITIES
2525
o `seqBlockApply()` and `seqApply()` allows a GDS file name in the first
2626
argument
2727

28+
o `seqGDS2VCF()` generates an indexing file (.tbi) according to the
29+
vcf.gz output file, requiring the Rsamtools package
30+
2831
BUG FIXES
2932

3033
o Previous `seqGetAF_AC_Missing(, minor=FALSE)` returns the AF for the

R/Conversion.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ seqGDS2VCF <- function(gdsfile, vcf.fn, info.var=NULL, fmt.var=NULL,
2727
stopifnot(is.character(chr_prefix), length(chr_prefix)==1L)
2828
stopifnot(is.logical(use_Rsamtools), length(use_Rsamtools)==1L)
2929
stopifnot(is.logical(verbose), length(verbose)==1L)
30+
show_timeheader <- !isTRUE(attr(verbose, "header_no_time"))
3031

3132
if (is.character(gdsfile))
3233
{
@@ -130,7 +131,7 @@ seqGDS2VCF <- function(gdsfile, vcf.fn, info.var=NULL, fmt.var=NULL,
130131

131132
if (verbose)
132133
{
133-
.cat(date())
134+
if (show_timeheader) .cat("##< ", .tm())
134135
.cat("VCF Export: ", basename(vcf.fn))
135136
s <- .seldim(gdsfile)
136137
.cat(" ", .pretty(s[2L]), " sample", .plural(s[2L]), ", ",
@@ -346,8 +347,16 @@ seqGDS2VCF <- function(gdsfile, vcf.fn, info.var=NULL, fmt.var=NULL,
346347
# finalize
347348
.Call(SEQ_ToVCF_Done)
348349
on.exit({
350+
if (outfmt == 2L)
351+
{
352+
if (verbose) cat("VCF indexing ...\n")
353+
Rsamtools::indexTabix(vcf.fn, format="vcf")
354+
}
349355
if (verbose)
350-
cat(date(), " Done.\n", sep="")
356+
{
357+
cat("Done.\n")
358+
if (show_timeheader) .cat("##> ", .tm())
359+
}
351360
}, add=TRUE)
352361

353362
# output

0 commit comments

Comments
 (0)