Skip to content

Commit

Permalink
progress file when using a connection
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengxwen committed Mar 6, 2024
1 parent caed220 commit 3dd7405
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: SeqArray
Type: Package
Title: Data Management of Large-Scale Whole-Genome Sequence Variant Calls
Version: 1.43.3
Date: 2024-01-25
Version: 1.43.4
Date: 2024-03-06
Depends: R (>= 3.5.0), gdsfmt (>= 1.31.1)
Imports: methods, parallel, IRanges, GenomicRanges, GenomeInfoDb, Biostrings,
S4Vectors
Expand Down
8 changes: 8 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
CHANGES IN VERSION 1.43.4
-------------------------

UTILITIES

o tweak the display of progress information in `seqVCF2GDS()`


CHANGES IN VERSION 1.42.1
-------------------------

Expand Down
21 changes: 11 additions & 10 deletions R/ConvVCF2GDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -1135,17 +1135,18 @@ seqVCF2GDS <- function(vcf.fn, out.fn, header=NULL,
filterlevels <- header$filter$ID
linecnt <- double(1L)

# progress file
progfile <- file(paste0(out.fn, ".progress"), "wt")
cat(">>> ", out.fn, " <<<\n", file=progfile, sep="")
infile <- NULL
on.exit({
close(progfile)
unlink(paste0(out.fn, ".progress"), force=TRUE)
if (!is.null(infile)) close(infile)
}, add=TRUE)

if (!inherits(vcf.fn, "connection"))
{
progfile <- file(paste0(out.fn, ".progress"), "wt")
cat(out.fn, ":\n", file=progfile, sep="")

infile <- NULL
on.exit({
close(progfile)
unlink(paste0(out.fn, ".progress"), force=TRUE)
if (!is.null(infile)) close(infile)
}, add=TRUE)

for (i in seq_along(vcf.fn))
{
Expand Down Expand Up @@ -1201,7 +1202,7 @@ seqVCF2GDS <- function(vcf.fn, out.fn, header=NULL,
raise.error = raise.error, filter.levels = filterlevels,
start = start, count = count,
chr.prefix = ignore.chr.prefix,
progfile = NULL,
progfile = progfile,
verbose = verbose),
linecnt, new.env())

Expand Down

0 comments on commit 3dd7405

Please sign in to comment.