@@ -596,6 +596,7 @@ seqVCF2GDS <- function(vcf.fn, out.fn, header=NULL,
596596 stopifnot(is.logical(digest ) | is.character(digest ), length(digest )== 1L )
597597 stopifnot(is.logical(use_Rsamtools ), length(use_Rsamtools )== 1L )
598598 stopifnot(is.logical(verbose ), length(verbose )== 1L )
599+ show_timeheader <- ! isTRUE(attr(verbose , " header_no_time" ))
599600
600601 pnum <- .NumParallel(parallel )
601602 parallel <- .McoreParallel(parallel )
@@ -612,7 +613,7 @@ seqVCF2GDS <- function(vcf.fn, out.fn, header=NULL,
612613 if (length(variant_count ) != length(vcf.fn ))
613614 stop(" 'variant_count' and 'vcf.fn' should have the same length." )
614615 }
615- if (verbose ) cat(date(), " \n " , sep = " " )
616+ if (verbose && show_timeheader ) . cat(" ##< " , .tm() )
616617
617618 genotype.storage <- " bit2"
618619
@@ -781,7 +782,7 @@ seqVCF2GDS <- function(vcf.fn, out.fn, header=NULL,
781782 {
782783 if (verbose )
783784 {
784- cat(" # of cores/jobs: " , pnum , " \n " , sep = " " )
785+ . cat(" # of cores/jobs: " , pnum )
785786 a <- variant_count < 0L
786787 if (length(a ) < length(vcf.fn )) a [length(vcf.fn )] <- NA
787788 if (anyNA(a ) || any(a , na.rm = TRUE ))
@@ -821,7 +822,7 @@ seqVCF2GDS <- function(vcf.fn, out.fn, header=NULL,
821822 if (start + count > num_var + 1L )
822823 stop(" Invalid 'count'." )
823824 if (verbose )
824- cat(" # of variants: " , .pretty(count ), " \n " , sep = " " )
825+ . cat(" # of variants: " , .pretty(count ))
825826
826827 if (count > = pnum )
827828 {
@@ -831,7 +832,7 @@ seqVCF2GDS <- function(vcf.fn, out.fn, header=NULL,
831832 psplit <- .file_split(count , pnum , start )
832833 if (verbose )
833834 {
834- cat(sprintf( " >>> writing to %d files: <<<\n " , pnum ) )
835+ . cat(" >>> writing to " , pnum , " files: <<<" )
835836 cat(sprintf(" %s\t [%s .. %s]\n " , basename(ptmpfn ),
836837 .pretty(psplit [[1L ]]),
837838 .pretty(psplit [[1L ]] + psplit [[2L ]] - 1L )), sep = " " )
@@ -865,7 +866,7 @@ seqVCF2GDS <- function(vcf.fn, out.fn, header=NULL,
865866 ptmpfn = ptmpfn , psplit = psplit , variant_count = variant_count )
866867
867868 if (verbose )
868- cat(" >>> Done (" , date (), " ) <<<\n " , sep = " " )
869+ . cat(" >>> Done (" , .tm (), " ) <<<" )
869870
870871 } else {
871872 pnum <- 1L
@@ -1221,15 +1222,15 @@ seqVCF2GDS <- function(vcf.fn, out.fn, header=NULL,
12211222 linecnt <- double(1L )
12221223
12231224 # progress file
1224- prog_fn <- paste0(out.fn , " .progress" )
1225+ prog_fn <- paste0(out.fn , " .progress.txt " )
12251226 progfile <- file(prog_fn , " wt" )
12261227 cat(" >>> " , out.fn , " <<<\n " , file = progfile , sep = " " )
12271228 if (verbose )
1228- cat(" [Progress Info: " , basename(prog_fn ), " ]\n " , sep = " " )
1229+ . cat(" [Progress Info: " , basename(prog_fn ), " ]" )
12291230 infile <- NULL
12301231 on.exit({
12311232 close(progfile )
1232- unlink(paste0( out.fn , " .progress " ) , force = TRUE )
1233+ unlink(prog_fn , force = TRUE )
12331234 if (! is.null(infile )) close(infile )
12341235 }, add = TRUE )
12351236
@@ -1403,20 +1404,14 @@ seqVCF2GDS <- function(vcf.fn, out.fn, header=NULL,
14031404 # optimize access efficiency
14041405
14051406 if (verbose )
1406- {
1407- cat(" Done.\n " )
1408- cat(date(), " \n " , sep = " " )
1409- }
1407+ if (optimize ) .cat(" Done. # " , .tm()) else cat(" Done.\n " )
14101408 if (optimize )
14111409 {
14121410 if (verbose )
1413- {
14141411 cat(" Optimize the access efficiency ...\n " )
1415- flush.console()
1416- }
14171412 cleanup.gds(out.fn , verbose = verbose )
1418- if (verbose ) cat(date(), " \n " , sep = " " )
14191413 }
1414+ if (verbose && show_timeheader ) .cat(" ##> " , .tm())
14201415
14211416 # output
14221417 invisible (normalizePath(out.fn ))
0 commit comments