Skip to content

Commit

Permalink
Parameterize the logging frequency for ProgressLogger in GatherVcfsCl…
Browse files Browse the repository at this point in the history
…oud. (#8662)
  • Loading branch information
gbggrant authored Feb 7, 2024
1 parent dd73036 commit bbc028b
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ public final class GatherVcfsCloud extends CommandLineProgram {
"AUTOMATIC chooses BLOCK if possible and CONVENTIONAL otherwise.")
public GatherType gatherType = GatherType.AUTOMATIC;

@Argument(fullName = "progress-logger-frequency",
doc = "The frequency with which the progress is logged to output (i.e. every N records)")
public Integer progressLoggerFrequency = 10000;

@Advanced
@Argument(fullName = IGNORE_SAFETY_CHECKS_LONG_NAME, doc = "Disable sanity checks to improve performance, may result in silently creating corrupted outputs data")
public boolean ignoreSafetyChecks = false;
Expand Down Expand Up @@ -188,7 +192,7 @@ protected Object doWork() {
break;
case CONVENTIONAL:
log.info("Gathering by conventional means.");
gatherConventionally(sequenceDictionary, createIndex, inputPaths, output, cloudPrefetchBuffer, disableContigOrderingCheck);
gatherConventionally(sequenceDictionary, createIndex, inputPaths, output, cloudPrefetchBuffer, disableContigOrderingCheck, progressLoggerFrequency);
break;
default:
throw new GATKException.ShouldNeverReachHereException("Invalid gather type: " + gatherType + ". Please report this bug to the developers.");
Expand Down Expand Up @@ -299,13 +303,14 @@ private static void gatherConventionally(final SAMSequenceDictionary sequenceDic
final List<Path> inputFiles,
final File outputFile,
final int cloudPrefetchBuffer,
final boolean disableContigOrderingCheck) {
final boolean disableContigOrderingCheck,
final int progressLoggerFrequency) {
final EnumSet<Options> options = EnumSet.copyOf(VariantContextWriterBuilder.DEFAULT_OPTIONS);
if (createIndex) options.add(Options.INDEX_ON_THE_FLY); else options.remove(Options.INDEX_ON_THE_FLY);
try (final VariantContextWriter out = new VariantContextWriterBuilder().setOutputFile(outputFile)
.setReferenceDictionary(sequenceDictionary).setOptions(options).build()) {

final ProgressLogger progress = new ProgressLogger(log, 10000);
final ProgressLogger progress = new ProgressLogger(log, progressLoggerFrequency);
VariantContext lastContext = null;
Path lastFile = null;
VCFHeader firstHeader = null;
Expand Down

0 comments on commit bbc028b

Please sign in to comment.