Debian Codegraph @

current/bin/RandomReadsMG.java

raw symbols SCIP
1 package bin;
2
3 import java.io.File;
4 import java.io.PrintStream;
5 import java.util.ArrayList;
6 import java.util.Arrays;
7 import java.util.Random;
8 import java.util.concurrent.atomic.AtomicInteger;
9 import java.util.concurrent.atomic.AtomicLong;
10
11 import dna.AminoAcid;
12 import fileIO.ByteFile;
13 import fileIO.FileFormat;
14 import fileIO.ReadWrite;
15 import shared.Parse;
16 import shared.Parser;
17 import shared.PreParser;
18 import shared.Shared;
19 import shared.Timer;
20 import shared.Tools;
21 import stream.ConcurrentReadInputStream;
22 import stream.ConcurrentReadOutputStream;
23 import stream.FASTQ;
24 import stream.FastaReadInputStream;
25 import stream.Read;
26 import structures.ByteBuilder;
27 import structures.ListNum;
28 import tax.TaxNode;
29 import tax.TaxTree;
30 import tracker.ReadStats;
31
32 /**
33 * Generates synthetic reads from multiple input fastas.
34 *
35 * @author Brian Bushnell
36 * @date Feb 8, 2025
37 *
38 */
39 public class RandomReadsMG {
40
41 /*--------------------------------------------------------------*/
42 /*---------------- Initialization ----------------*/
43 /*--------------------------------------------------------------*/
44
45 /**
46 * Code entrance from the command line.
47 * @param args Command line arguments
48 */
49 public static void main(String[] args){
50 //Start a timer immediately upon code entrance.
51 Timer t=new Timer();
52
53 //Create an instance of this class
54 RandomReadsMG x=new RandomReadsMG(args);
55
56 //Run the object
57 x.process(t);
58
59 //Close the print stream if it was redirected
60 Shared.closeStream(x.outstream);
61 }
62
63 /**
64 * Constructor.
65 * @param args Command line arguments
66 */
67 public RandomReadsMG(String[] args){
68
69 {//Preparse block for help, config files, and outstream
70 PreParser pp=new PreParser(args, getClass(), false);
71 args=pp.args;
72 outstream=pp.outstream;
73 }
74
75 //Set shared static variables prior to parsing
76 ReadWrite.USE_PIGZ=ReadWrite.USE_UNPIGZ=true;
77 ReadWrite.setZipThreads(Shared.threads());
78 FASTQ.TEST_INTERLEAVED=FASTQ.FORCE_INTERLEAVED=false;
79
80 {//Parse the arguments
81 final Parser parser=parse(args);
82 Parser.processQuality();
83
84 overwrite=ReadStats.overwrite=parser.overwrite;
85 append=ReadStats.append=parser.append;
86
87 out1=parser.out1;
88 out2=parser.out2;
89 qfout1=parser.qfout1;
90 qfout2=parser.qfout2;
91 extout=parser.extout;
92 }
93
94 validateParams();
95 doPoundReplacement(); //Replace # with 1 and 2
96 checkFileExistence(); //Ensure files can be read and written
97 checkStatics(); //Adjust file-related static fields as needed for this program
98
99 //Create output FileFormat objects
100 ffout1=FileFormat.testOutput(out1, FileFormat.FASTQ, extout, true, overwrite, append, false);
101 ffout2=FileFormat.testOutput(out2, FileFormat.FASTQ, extout, true, overwrite, append, false);
102 if("auto".equalsIgnoreCase(taxTreeFile)){taxTreeFile=TaxTree.defaultTreeFile();}
103 tree=TaxTree.loadTaxTree(taxTreeFile, outstream, true, false);
104 }
105
106 /*--------------------------------------------------------------*/
107 /*---------------- Initialization Helpers ----------------*/
108 /*--------------------------------------------------------------*/
109
110 /** Parse arguments from the command line */
111 private Parser parse(String[] args){
112
113 //Create a parser object
114 Parser parser=new Parser();
115
116 //Set any necessary Parser defaults here
117 //parser.foo=bar;
118
119 //Parse each argument
120 for(int i=0; i<args.length; i++){
121 String arg=args[i];
122
123 //Break arguments into their constituent parts, in the form of "a=b"
124 String[] split=arg.split("=");
125 String a=split[0].toLowerCase();
126 String b=split.length>1 ? split[1] : null;
127 if(b!=null && b.equalsIgnoreCase("null")){b=null;}
128
129 if(a.equals("verbose")){
130 verbose=Parse.parseBoolean(b);
131 }else if(a.equals("tree")){
132 taxTreeFile=b;
133 }else if(a.equals("in") || a.equals("ref")){
134 Tools.getFileOrFiles(b, inputFiles, true, false, false, false);
135 }else if(a.equals("depth") || a.equals("cov")){
136 minDepth=maxDepth=Float.parseFloat(b);
137 }else if(a.equals("mindepth") || a.equals("mincov")){
138 minDepth=Float.parseFloat(b);
139 }else if(a.equals("maxdepth") || a.equals("maxcov")){
140 maxDepth=Float.parseFloat(b);
141 }else if(a.equals("depthvariance") || a.equals("variance")){
142 depthVariance=Float.parseFloat(b);
143 }else if(a.equals("mode") || a.equals("depthmode")){
144 depthMode=Tools.find(b.toUpperCase(), modes);
145 }else if(a.equals("insert") || a.equals("avginsert")){
146 avgInsert=Float.parseFloat(b);
147 }else if(a.equals("len") || a.equals("length") || a.equals("readlen") || a.equals("readlength")){
148 readlen=Integer.parseInt(b);
149 }else if(a.equals("paired") || a.equals("int") || a.equals("interleaved")){
150 paired=Parse.parseBoolean(b);
151 }else if(a.equals("seed")){
152 seed=Long.parseLong(b);
153 }else if(b==null && Tools.find(arg.toUpperCase(), modes)>=0){
154 depthMode=Tools.find(arg.toUpperCase(), modes);
155 }else if(a.equals("parse_flag_goes_here")){
156 long fake_variable=Parse.parseKMG(b);
157 //Set a variable here
158 }else if(parser.parse(arg, a, b)){//Parse standard flags in the parser
159 //do nothing
160 }else{
161 File f=new File(arg);
162 if(f.exists() && f.canRead()) {
163 Tools.getFileOrFiles(arg, inputFiles, true, false, false, false);
164 }else {
165 outstream.println("Unknown parameter "+args[i]);
166 assert(false) : "Unknown parameter "+args[i];
167 }
168 }
169 }
170
171 return parser;
172 }
173
174 /** Replace # with 1 and 2 in headers */
175 private void doPoundReplacement(){
176
177 //Do output file # replacement
178 if(out1!=null && out2==null && out1.indexOf('#')>-1){
179 out2=out1.replace("#", "2");
180 out1=out1.replace("#", "1");
181 }
182
183 //Ensure out2 is not set without out1
184 if(out1==null && out2!=null){throw new RuntimeException("Error - cannot define out2 without defining out1.");}
185 }
186
187 /** Ensure files can be read and written */
188 private void checkFileExistence(){
189 //Ensure output files can be written
190 if(!Tools.testOutputFiles(overwrite, append, false, out1, out2)){
191 outstream.println((out1==null)+", "+(out2==null)+", "+out1+", "+out2);
192 throw new RuntimeException("\n\noverwrite="+overwrite+"; Can't write to output files "+out1+", "+out2+"\n");
193 }
194
195 //Ensure input files can be read
196 if(!Tools.testInputFiles(false, true, inputFiles.toArray(new String[0]))){
197 throw new RuntimeException("\nCan't read some input files.\n");
198 }
199
200 //Ensure that no file was specified multiple times
201 if(!Tools.testForDuplicateFiles(true, out1, out2)){
202 throw new RuntimeException("\nSome file names were specified multiple times.\n");
203 }
204 }
205
206 /** Adjust file-related static fields as needed for this program */
207 private static void checkStatics(){
208 //Adjust the number of threads for input file reading
209 if(!ByteFile.FORCE_MODE_BF1 && !ByteFile.FORCE_MODE_BF2 && Shared.threads()>2){
210 ByteFile.FORCE_MODE_BF2=true;
211 }
212
213 assert(FastaReadInputStream.settingsOK());
214 }
215
216 /** Ensure parameter ranges are within bounds and required parameters are set */
217 private boolean validateParams(){
218 // assert(false) : "TODO";
219 return true;
220 }
221
222 /*--------------------------------------------------------------*/
223 /*---------------- Outer Methods ----------------*/
224 /*--------------------------------------------------------------*/
225
226 /** Create read streams and process all data */
227 void process(Timer t){
228
229 //Turn off read validation in the input threads to increase speed
230 final boolean vic=Read.VALIDATE_IN_CONSTRUCTOR;
231 Read.VALIDATE_IN_CONSTRUCTOR=true;
232
233 //Optionally create a read output stream
234 final ConcurrentReadOutputStream ros=makeCros();
235
236 //Reset counters
237 readsProcessed=readsOut=0;
238 basesProcessed=basesOut=0;
239
240 //Process the reads in separate threads
241 spawnThreads(inputFiles, ros);
242
243 if(verbose){outstream.println("Finished; closing streams.");}
244
245 //Write anything that was accumulated by ReadStats
246 errorState|=ReadStats.writeAll();
247 //Close the read streams
248 errorState|=ReadWrite.closeStream(ros);
249
250 //Reset read validation
251 Read.VALIDATE_IN_CONSTRUCTOR=vic;
252
253 //Report timing and results
254 t.stop();
255 outstream.println(Tools.timeReadsBasesProcessed(t, readsProcessed, basesProcessed, 8));
256 outstream.println(Tools.readsBasesOut(t.elapsed, readsOut, basesOut, 8));
257
258 //Throw an exception of there was an error in a thread
259 if(errorState){
260 throw new RuntimeException(getClass().getName()+" terminated in an error state; the output may be corrupt.");
261 }
262 }
263
264 /** Create a Read Input Stream */
265 private ConcurrentReadInputStream makeCris(FileFormat ff){
266 ConcurrentReadInputStream cris=ConcurrentReadInputStream.getReadInputStream(-1, true, ff, null);
267 cris.start(); //Start the stream
268 if(verbose){outstream.println("Started cris");}
269 return cris;
270 }
271
272 /** Create a Read Output Stream */
273 private ConcurrentReadOutputStream makeCros(){
274 if(ffout1==null){return null;}
275
276 //Set output buffer size
277 final int buff=4;
278
279 //Notify user of output mode
280 if(paired && out2==null){
281 outstream.println("Writing interleaved.");
282 }
283
284 final ConcurrentReadOutputStream ros=ConcurrentReadOutputStream.getStream(
285 ffout1, ffout2, qfout1, qfout2, buff, null, false);
286 ros.start(); //Start the stream
287 return ros;
288 }
289
290 /** Spawn process threads */
291 private void spawnThreads(final ArrayList<String> files, final ConcurrentReadOutputStream ros){
292
293 //Do anything necessary prior to processing
294
295 //Determine how many threads may be used
296 final int threads=Shared.threads();
297
298 //Fill a list with ProcessThreads
299 ArrayList<ProcessThread> alpt=new ArrayList<ProcessThread>(threads);
300 AtomicInteger atom=new AtomicInteger(0);
301 for(int i=0; i<threads; i++){
302 alpt.add(new ProcessThread(files, ros, i, atom));
303 }
304
305 //Start the threads
306 for(ProcessThread pt : alpt){
307 pt.start();
308 }
309
310 //Wait for threads to finish
311 waitForThreads(alpt);
312
313 //Do anything necessary after processing
314
315 }
316
317 /** Wait until all worker threads are finished, then return */
318 private void waitForThreads(ArrayList<ProcessThread> alpt){
319
320 //Wait for completion of all threads
321 boolean success=true;
322 for(ProcessThread pt : alpt){
323
324 //Wait until this thread has terminated
325 while(pt.getState()!=Thread.State.TERMINATED){
326 try {
327 //Attempt a join operation
328 pt.join();
329 } catch (InterruptedException e) {
330 //Potentially handle this, if it is expected to occur
331 e.printStackTrace();
332 }
333 }
334
335 //Accumulate per-thread statistics
336 readsProcessed+=pt.readsInT;
337 basesProcessed+=pt.basesInT;
338 readsOut+=pt.readsOutT;
339 basesOut+=pt.basesOutT;
340 success&=pt.success;
341 }
342
343 //Track whether any threads failed
344 if(!success){errorState=true;}
345 }
346
347 /*--------------------------------------------------------------*/
348 /*---------------- Inner Methods ----------------*/
349 /*--------------------------------------------------------------*/
350
351 private ConcurrentReadInputStream makeCris(String fname){
352 FileFormat ff=FileFormat.testInput(fname, FileFormat.FASTA, null, true, true);
353 ConcurrentReadInputStream cris=ConcurrentReadInputStream.getReadInputStream(-1, false, ff, null);
354 cris.start(); //Start the stream
355 if(verbose){outstream.println("Started cris");}
356 return cris;
357 }
358
359 float chooseDepthForFile(Random randy) {
360 if(depthMode==MIN4) {return depthMin4(randy);}
361 else if(depthMode==EXP) {return depthExp(randy);}
362 else if(depthMode==ROOT) {return depthRoot(randy);}
363 else if(depthMode==LINEAR) {return depthLinear(randy);}
364 else {throw new RuntimeException("Unknown mode "+depthMode);}
365 }
366
367 float depthMin4(Random randy) {
368 float minRoot=(float)Math.sqrt(minDepth);
369 float range=(float)(Math.sqrt(maxDepth)-minRoot);
370 final float rootDepth=minRoot+(Tools.min(randy.nextFloat(), randy.nextFloat(),
371 randy.nextFloat(), randy.nextFloat()))*range;
372 final float fileDepth=rootDepth*rootDepth;
373 return fileDepth;
374 }
375
376 float depthLinear(Random randy) {
377 float range=(float)(maxDepth-minDepth);
378 return randy.nextFloat()*range+minDepth;
379 }
380
381 float depthRoot(Random randy) {
382 float range=(float)maxDepth-minDepth;
383 float root=randy.nextFloat();
384 return root*root*range+minDepth;
385 }
386
387 float depthExp(Random randy) {
388 double lambda=1/Math.sqrt(minDepth*maxDepth);
389 double depth=Tools.exponential(randy, lambda);
390 while(depth<minDepth || depth>maxDepth) {
391 depth=Tools.exponential(randy, lambda);
392 }
393 return (float)depth;
394 }
395
396 /*--------------------------------------------------------------*/
397 /*---------------- Inner Classes ----------------*/
398 /*--------------------------------------------------------------*/
399
400 private class ProcessThread extends Thread {
401
402 //Constructor
403 ProcessThread(final ArrayList<String> files_, final ConcurrentReadOutputStream ros_,
404 int tid_, final AtomicInteger nextFile_){
405 files=files_;
406 ros=ros_;
407 tid=tid_;
408 nextFile=nextFile_;
409 }
410
411 //Called by start()
412 @Override
413 public void run(){
414 //Do anything necessary prior to processing
415 randy=Shared.threadLocalRandom(seed>=0 ? seed+tid : -1);
416
417 //Process the files
418 for(int i=nextFile.getAndIncrement(); i<files.size(); i=nextFile.getAndIncrement()) {
419 String fname=files.get(i);
420 processFile(fname, i);
421 }
422
423 //Do anything necessary after processing
424
425 //Indicate successful exit status
426 success=true;
427 }
428
429 /** Iterate through the reads */
430 void processFile(String fname, int fnum){
431 // System.err.println("Thread "+tid+" processing file "+fnum+"; next="+nextFile);
432 ConcurrentReadInputStream cris=makeCris(fname);
433
434 //Grab the first ListNum of reads
435 ListNum<Read> ln=cris.nextList();
436
437 final float fileDepth=chooseDepthForFile(randy);
438 int taxID=TaxTree.parseHeaderStatic2(fname, tree);
439 if(taxID<0 && ln.size()>0) {
440 Read c0=ln.get(0);
441 taxID=TaxTree.parseHeaderStatic2(c0.id, tree);
442 }
443 System.err.println("File "+fnum+", tid "+taxID+": depth="+String.format("%.2f", fileDepth));
444 // assert(taxID>0) : "Can't parse taxID from "+fname;
445
446 //As long as there is a nonempty read list...
447 while(ln!=null && ln.size()>0){
448
449 for(Read c : ln) {
450 float depthRatio=1f;
451 if(varyDepthPerContig) {
452 depthRatio=1f+(depthVariance*(randy.nextFloat()+randy.nextFloat()))-depthVariance;
453 }
454 float contigDepth=depthRatio*fileDepth;
455 // System.err.println("depthRatio = "+depthRatio+"; contigDepth="+contigDepth);
456 processContig(c, contigDepth, taxID, fnum);
457 }
458
459 //Notify the input stream that the list was used
460 cris.returnList(ln);
461
462 //Fetch a new list
463 ln=cris.nextList();
464 }
465
466 //Notify the input stream that the final list was used
467 if(ln!=null){
468 cris.returnList(ln.id, ln.list==null || ln.list.isEmpty());
469 }
470
471 }
472
473 private void processContig(Read contig, float depth, int taxID, int fnum) {
474 final int basesPerRead=(paired ? 2*readlen : readlen);
475 readsInT++;
476 basesInT+=contig.length();
477 if(contig.length()<basesPerRead+10) {return;}
478 if(paired && contig.length()<avgInsert) {return;}
479
480 long basesToGenerate=(long)(depth*contig.length());
481 long readsGenerated=0;
482 long basesGenerated=0;
483 ArrayList<Read> list=new ArrayList<Read>(200);
484 float variance=varyDepthPerContig ? 0 : randy.nextFloat()*depthVariance;
485
486 // System.err.println("Generating "+basesToGenerate+" for depth-"+depth+" contig "+contig.id);
487
488 for(long i=0; basesGenerated<basesToGenerate; i++) {
489 Read r=generateRead(contig, i, taxID, fnum, contig.numericID, variance);
490 if(r!=null) {
491 list.add(r);
492 readsGenerated+=r.pairCount();
493 basesGenerated+=r.pairLength();
494 }
495 if(list.size()>=200) {
496 if(ros!=null) {ros.add(list, 0);}
497 list=new ArrayList<Read>(200);
498 }
499 }
500 if(list.size()>0) {if(ros!=null) {ros.add(list, 0);}}
501 // System.err.println("Generated "+basesGenerated+" for depth-"+depth+" contig "+contig.id);
502
503 readsOutT+=readsGenerated;
504 basesOutT+=basesGenerated;
505 }
506
507 private Read generateRead(Read contig, long rnum, int taxID, int fnum, long cnum, float variance) {
508 if(paired) {return generateReadPair(contig, rnum, taxID, fnum, cnum, variance);}
509 else {return generateReadSingle(contig, rnum, taxID, fnum, cnum, variance);}
510 }
511
512 private Read generateReadSingle(Read contig, long rnum, int taxID, int fnum, long cnum, float variance) {
513 int insert=readlen;
514 int start=randy.nextInt(contig.length()-insert);
515 if(skip((start+insert)/2, contig.length(), variance)){return null;}
516 int strand=randy.nextInt(2);
517 byte[] bases=Arrays.copyOfRange(contig.bases, start, start+readlen);
518 if(strand==1) {AminoAcid.reverseComplementBasesInPlace(bases);}
519 String header=makeHeader(start, strand, insert, taxID, fnum, cnum, 0);
520 Read r=new Read(bases, null, header, rnum);
521 return r;
522 }
523
524 private Read generateReadPair(Read contig, long rnum, int taxID, int fnum, long cnum, float variance) {
525 double g=randy.nextGaussian()*0.25f;
526 int insert=(int)((1+g)*avgInsert);
527 while(insert>=contig.length() || insert<readlen) {
528 g=randy.nextGaussian()*0.25f;
529 insert=(int)((1+g)*avgInsert);
530 }
531 int start1=randy.nextInt(contig.length()-insert);
532 int strand=randy.nextInt(2);
533 int start2=start1+insert-readlen;
534 if(skip((start1+insert)/2, contig.length(), variance)){return null;}
535
536 byte[] bases1=Arrays.copyOfRange(contig.bases, start1, start1+readlen);
537 byte[] bases2=Arrays.copyOfRange(contig.bases, start2, start2+readlen);
538 AminoAcid.reverseComplementBasesInPlace(bases2);
539 if(strand==1) {
540 byte[] temp=bases1;
541 bases1=bases2;
542 bases2=temp;
543 }
544 String header1=makeHeader(start1, strand, insert, taxID, fnum, cnum, 0);
545 String header2=makeHeader(start1, strand, insert, taxID, fnum, cnum, 1);
546 Read r1=new Read(bases1, null, header1, rnum);
547 Read r2=new Read(bases2, null, header2, rnum);
548 r2.setPairnum(1);
549 r1.mate=r2;
550 r2.mate=r1;
551 return r1;
552 }
553
554 //Skip making a read to vary depth within the contig
555 private boolean skip(int midpoint, int clen, float variance) {
556 if(variance<=0) {return false;}
557 //Then we want to vary within contigs
558 float maxSkipProb=1f-1f/(1f+variance);
559 float relativePosition=midpoint/(float)clen;
560 float skipProb=relativePosition*maxSkipProb;
561 return randy.nextFloat()<skipProb;
562 }
563
564 private String makeHeader(int start, int strand, int insert, int taxID, int fnum, long cnum, int pnum) {
565 bb.clear().append('f').under().append(fnum).under().append('c').under().append(cnum);
566 bb.under().append('s').under().append(strand).under().append('p').under().append(start);
567 bb.under().append('i').under().append(insert).under().append("tid");
568 bb.under().append(taxID).space().append(pnum+1).colon();
569 return bb.toString();
570 }
571
572 /** Number of reads retained by this thread */
573 protected long readsOutT=0;
574 /** Number of bases retained by this thread */
575 protected long basesOutT=0;
576
577 /** Number of input contigs processed by this thread */
578 protected long readsInT=0;
579 /** Number of input bases processed by this thread */
580 protected long basesInT=0;
581
582 /** True only if this thread has completed successfully */
583 boolean success=false;
584
585 /** Shared output stream */
586 private final ConcurrentReadOutputStream ros;
587 /** Thread ID */
588 final int tid;
589 final AtomicInteger nextFile;
590 private final ArrayList<String> files;
591 private Random randy;
592
593 private ByteBuilder bb=new ByteBuilder(128);
594 }
595
596 private class Genome {
597
598 public Genome(String fname_) {
599 fname=fname_;
600 }
601
602 private void load() {
603 FileFormat ff=FileFormat.testInput(fname, FileFormat.FASTA, null, true, true);
604 contigs=ConcurrentReadInputStream.getReads(-1, false, ff, null, null, null);
605 taxID=TaxTree.parseHeaderStatic2(fname, tree);
606 if(taxID<0) {taxID=TaxTree.parseHeaderStatic2(contigs.get(0).id, tree);}
607 }
608
609 ArrayList<Read> contigs;
610 String fname;
611 int taxID=-1;
612 }
613
614 /*--------------------------------------------------------------*/
615 /*---------------- Fields ----------------*/
616 /*--------------------------------------------------------------*/
617
618 /** Primary input file path */
619 private ArrayList<String> inputFiles=new ArrayList<String>();
620
621 /** Primary output file path */
622 private String out1=null;
623 /** Secondary output file path */
624 private String out2=null;
625
626 private String qfout1=null;
627 private String qfout2=null;
628
629 /** Override output file extension */
630 private String extout=null;
631
632 private String taxTreeFile=null;
633
634 /*--------------------------------------------------------------*/
635
636 /** Number of reads processed */
637 protected long readsProcessed=0;
638 /** Number of bases processed */
639 protected long basesProcessed=0;
640
641 /** Number of reads retained */
642 protected long readsOut=0;
643 /** Number of bases retained */
644 protected long basesOut=0;
645
646 private AtomicLong nextReadID=new AtomicLong(0);
647
648 private float minDepth=1;
649 private float maxDepth=256;
650 private float depthVariance=0.5f;
651 private float avgInsert=300;
652 private int readlen=150;
653 private boolean paired=true;
654 private long seed=-1;
655 private boolean varyDepthPerContig=false;
656
657 static final String[] modes={"MIN4", "EXP", "ROOT", "LINEAR"};
658 static final int MIN4=0, EXP=1, ROOT=2, LINEAR=3;
659 int depthMode=MIN4;
660
661 /*--------------------------------------------------------------*/
662 /*---------------- Final Fields ----------------*/
663 /*--------------------------------------------------------------*/
664
665 /** Primary output file */
666 private final FileFormat ffout1;
667 /** Secondary output file */
668 private final FileFormat ffout2;
669
670 private final TaxTree tree;
671
672 /*--------------------------------------------------------------*/
673 /*---------------- Common Fields ----------------*/
674 /*--------------------------------------------------------------*/
675
676 /** Print status messages to this output stream */
677 private PrintStream outstream=System.err;
678 /** Print verbose messages */
679 public static boolean verbose=false;
680 /** True if an error was encountered */
681 public boolean errorState=false;
682 /** Overwrite existing output files */
683 private boolean overwrite=true;
684 /** Append to existing output files */
685 private boolean append=false;
686
687 }