Debian Codegraph @

current/prok/MergeRibo.java

raw symbols SCIP
1 package prok;
2
3 import java.io.File;
4 import java.io.PrintStream;
5 import java.util.ArrayList;
6 import java.util.Collections;
7 import java.util.Comparator;
8 import java.util.HashMap;
9 import java.util.Map.Entry;
10 import java.util.concurrent.ConcurrentLinkedQueue;
11 import java.util.concurrent.locks.ReadWriteLock;
12 import java.util.concurrent.locks.ReentrantReadWriteLock;
13
14 import aligner.SingleStateAlignerFlat2;
15 import consensus.BaseGraph;
16 import fileIO.ByteFile;
17 import fileIO.FileFormat;
18 import fileIO.ReadWrite;
19 import shared.Parse;
20 import shared.Parser;
21 import shared.PreParser;
22 import shared.Shared;
23 import shared.Timer;
24 import shared.Tools;
25 import stream.ConcurrentReadInputStream;
26 import stream.ConcurrentReadOutputStream;
27 import stream.FASTQ;
28 import stream.FastaReadInputStream;
29 import stream.Read;
30 import structures.IntHashSet;
31 import structures.ListNum;
32 import tax.GiToTaxid;
33 import template.Accumulator;
34 import template.ThreadWaiter;
35 import tracker.ReadStats;
36
37 /**
38 * Picks one ribosomal (16S) sequence per taxID.
39 *
40 * @author Brian Bushnell
41 * @date November 19, 2015
42 *
43 */
44 public class MergeRibo implements Accumulator<MergeRibo.ProcessThread> {
45
46 /*--------------------------------------------------------------*/
47 /*---------------- Initialization ----------------*/
48 /*--------------------------------------------------------------*/
49
50 /**
51 * Code entrance from the command line.
52 * @param args Command line arguments
53 */
54 public static void main(String[] args){
55 //Start a timer immediately upon code entrance.
56 Timer t=new Timer();
57
58 //Create an instance of this class
59 MergeRibo x=new MergeRibo(args);
60
61 //Run the object
62 x.process(t);
63
64 //Close the print stream if it was redirected
65 Shared.closeStream(x.outstream);
66 }
67
68 /**
69 * Constructor.
70 * @param args Command line arguments
71 */
72 public MergeRibo(String[] args){
73
74 {//Preparse block for help, config files, and outstream
75 PreParser pp=new PreParser(args, getClass(), false);
76 args=pp.args;
77 outstream=pp.outstream;
78 }
79
80 //Set shared static variables prior to parsing
81 ReadWrite.USE_PIGZ=ReadWrite.USE_UNPIGZ=true;
82 ReadWrite.setZipThreads(Shared.threads());
83 // Shared.capBufferLen(40);//This does not help; the slowness comes from unevenness in list length during pickBest.
84 //To fix it, long lists should be sorted to be first.
85
86 BaseGraph.MAF_sub=0.251f;
87 BaseGraph.MAF_del=0.0f;
88 BaseGraph.MAF_ins=0.0f;
89 BaseGraph.MAF_noref=0.0f;
90 BaseGraph.trimDepthFraction=0.3f;
91 BaseGraph.trimNs=true;
92
93 {//Parse the arguments
94 final Parser parser=parse(args);
95 Parser.processQuality();
96
97 maxReads=parser.maxReads;
98 overwrite=ReadStats.overwrite=parser.overwrite;
99 append=ReadStats.append=parser.append;
100
101 extin=parser.extin;
102
103 out1=parser.out1;
104 extout=parser.extout;
105 }
106
107 validateParams();
108 adjustInterleaving(); //Make sure interleaving agrees with number of input and output files
109 checkFileExistence(); //Ensure files can be read and written
110 checkStatics(); //Adjust file-related static fields as needed for this program
111
112 //Create output FileFormat objects
113 ffout1=FileFormat.testOutput(out1, FileFormat.FASTA, extout, true, overwrite, append, ordered);
114
115 //Create input FileFormat objects
116 ffin=new ArrayList<FileFormat>(in.size());
117 ffalt=FileFormat.testInput(alt, FileFormat.FASTA, extin, true, true);
118 for(String s : in){
119 FileFormat ff=FileFormat.testInput(s, FileFormat.FASTA, extin, true, true);
120 ffin.add(ff);
121 }
122
123 //Determine how many threads may be used
124 threads=Shared.threads();
125 }
126
127 /*--------------------------------------------------------------*/
128 /*---------------- Initialization Helpers ----------------*/
129 /*--------------------------------------------------------------*/
130
131 /** Parse arguments from the command line */
132 private Parser parse(String[] args){
133
134 //Create a parser object
135 Parser parser=new Parser();
136
137 //Set any necessary Parser defaults here
138 //parser.foo=bar;
139
140 //Parse each argument
141 for(int i=0; i<args.length; i++){
142 String arg=args[i];
143
144 //Break arguments into their constituent parts, in the form of "a=b"
145 String[] split=arg.split("=");
146 String a=split[0].toLowerCase();
147 String b=split.length>1 ? split[1] : null;
148 if(b!=null && b.equalsIgnoreCase("null")){b=null;}
149
150 if(a.equals("verbose")){
151 verbose=Parse.parseBoolean(b);
152 }else if(a.equals("ordered")){
153 ordered=Parse.parseBoolean(b);
154 }else if(a.equals("consensus")){
155 useConsensus=Parse.parseBoolean(b);
156 }else if(a.equals("best")){
157 useConsensus=!Parse.parseBoolean(b);
158 }else if(a.equals("fast")){
159 fast=Parse.parseBoolean(b);
160 }else if(a.equals("minid")){
161 minID=Float.parseFloat(b);
162 }else if(a.equals("maxns")){
163 maxns=Integer.parseInt(b);
164 }else if(a.equals("minlen")){
165 minlen=Integer.parseInt(b);
166 }else if(a.equals("maxlen")){
167 maxlen=Integer.parseInt(b);
168 }else if(a.equals("in")){
169 Tools.addFiles(b, in);
170 }else if(a.equals("alt")){
171 alt=b;
172 }else if(a.equalsIgnoreCase("process16S") || a.equalsIgnoreCase("16S")){
173 process16S=Parse.parseBoolean(b);
174 process18S=!process16S;
175 }else if(a.equalsIgnoreCase("process18S") || a.equalsIgnoreCase("18S")){
176 process18S=Parse.parseBoolean(b);
177 process16S=!process18S;
178 }else if(a.equals("parse_flag_goes_here")){
179 long fake_variable=Parse.parseKMG(b);
180 //Set a variable here
181 }else if(parser.parse(arg, a, b)){//Parse standard flags in the parser
182 //do nothing
183 }else if(b==null && new File(arg).exists()){
184 in.add(arg);
185 }else{
186 outstream.println("Unknown parameter "+args[i]);
187 assert(false) : "Unknown parameter "+args[i];
188 }
189 }
190 assert(!in.isEmpty()) : "No input file.";
191 return parser;
192 }
193
194 /** Ensure files can be read and written */
195 private void checkFileExistence(){
196 //Ensure output files can be written
197 if(!Tools.testOutputFiles(overwrite, append, false, out1)){
198 outstream.println((out1==null)+", "+out1);
199 throw new RuntimeException("\n\noverwrite="+overwrite+"; Can't write to output files "+out1+"\n");
200 }
201
202 //Ensure input files can be read
203 if(!Tools.testInputFiles(false, true, in)){
204 throw new RuntimeException("\nCan't read some input files.\n");
205 }
206
207 // //Ensure that no file was specified multiple times
208 // if(!Tools.testForDuplicateFiles(true, out1, in.toArray(new String[0]))){
209 // throw new RuntimeException("\nSome file names were specified multiple times.\n");
210 // }
211 }
212
213 /** Make sure interleaving agrees with number of input and output files */
214 private void adjustInterleaving(){
215 FASTQ.FORCE_INTERLEAVED=FASTQ.TEST_INTERLEAVED=false;
216 }
217
218 /** Adjust file-related static fields as needed for this program */
219 private static void checkStatics(){
220 //Adjust the number of threads for input file reading
221 if(!ByteFile.FORCE_MODE_BF1 && !ByteFile.FORCE_MODE_BF2 && Shared.threads()>2){
222 ByteFile.FORCE_MODE_BF2=true;
223 }
224
225 assert(FastaReadInputStream.settingsOK());
226 }
227
228 /** Ensure parameter ranges are within bounds and required parameters are set */
229 private boolean validateParams(){
230 // assert(minfoo>0 && minfoo<=maxfoo) : minfoo+", "+maxfoo;
231 // assert(false) : "TODO";
232 assert(process16S || process18S) : "16S or 18S must be selected.";
233 assert(!process16S || !process18S) : "16S or 18S are both selected; only one may be active.";
234 return true;
235 }
236
237 /*--------------------------------------------------------------*/
238 /*---------------- Outer Methods ----------------*/
239 /*--------------------------------------------------------------*/
240
241 /** Create read streams and process all data */
242 void process(Timer t){
243
244 if(process16S){
245 Read[] data=ProkObject.loadConsensusSequenceType("16S", true, true);
246 consensus16S=data[0].bases;
247 if(verbose){System.err.println("process16S: Loaded 16S consensus, length "+consensus16S.length+": "+new String(consensus16S));}
248 }
249 if(process18S){
250 Read[] data=ProkObject.loadConsensusSequenceType("18S", true, true);
251 consensus18S=data[0].bases;
252 if(verbose){System.err.println("process18S: Loaded 18S consensus, length "+consensus18S.length+": "+new String(consensus18S));}
253 }
254
255 //Turn off read validation in the input threads to increase speed
256 final boolean vic=Read.VALIDATE_IN_CONSTRUCTOR;
257 Read.VALIDATE_IN_CONSTRUCTOR=Shared.threads()<4;
258
259 //Reset counters
260 readsProcessed=readsOut=0;
261 basesProcessed=basesOut=0;
262
263 //Align everything to global consensus
264 for(FileFormat ff : ffin) {
265 //Create a read input stream
266 final ConcurrentReadInputStream cris=makeCris(ff);
267
268 //Process the reads in separate threads
269 spawnThreads(cris, false);
270 errorState|=ReadWrite.closeStream(cris);
271 }
272
273 if(ffalt!=null){
274 //Create a read input stream
275 final ConcurrentReadInputStream cris=makeCris(ffalt);
276
277 //Process the reads in separate threads
278 spawnThreads(cris, true);
279 errorState|=ReadWrite.closeStream(cris);
280 }
281
282 // queue=new ConcurrentLinkedQueue<ArrayList<Ribo>>();
283 // for(Entry<Integer, ArrayList<Ribo>> e : listMap.entrySet()){
284 // queue.add(e.getValue());
285 // }
286 // listMap=null;
287 queue=makeQueue();
288
289 //Run a second pass to pick the best SSU per taxID
290 spawnThreads(null, false);
291
292 //Do anything necessary after processing
293 if(ffout1!=null){
294 //Optionally create a read output stream
295 final ConcurrentReadOutputStream ros=makeCros();
296 long num=0;
297 for(Ribo ribo : bestList){
298 Read r=ribo.r;
299 readsOut++;
300 basesOut+=r.length();
301 ArrayList<Read> list=new ArrayList<Read>(1);
302 list.add(r);
303 ros.add(list, num);
304 num++;
305 }
306 //Close the read streams
307 errorState|=ReadWrite.closeStream(ros);
308 }
309
310 if(verbose){outstream.println("Finished; closing streams.");}
311
312 //Write anything that was accumulated by ReadStats
313 errorState|=ReadStats.writeAll();
314
315 //Reset read validation
316 Read.VALIDATE_IN_CONSTRUCTOR=vic;
317
318 //Report timing and results
319 t.stop();
320 outstream.println(Tools.timeReadsBasesProcessed(t, readsProcessed, basesProcessed, 8));
321 outstream.println(Tools.readsBasesOut(readsProcessed, basesProcessed, readsOut, basesOut, 8, false));
322
323 //Throw an exception of there was an error in a thread
324 if(errorState){
325 throw new RuntimeException(getClass().getName()+" terminated in an error state; the output may be corrupt.");
326 }
327 }
328
329 private ConcurrentLinkedQueue<ArrayList<Ribo>> makeQueue(){
330 ArrayList<ArrayList<Ribo>> listList=new ArrayList<ArrayList<Ribo>>(listMap.size());
331 for(Entry<Integer, ArrayList<Ribo>> e : listMap.entrySet()){
332 listList.add(e.getValue());
333 }
334 listMap=null;
335 Collections.sort(listList, new ListComparator());
336 assert(listList.isEmpty() || listList.get(0).size()>=listList.get(listList.size()-1).size());
337 ConcurrentLinkedQueue<ArrayList<Ribo>> q=new ConcurrentLinkedQueue<ArrayList<Ribo>>();
338 for(ArrayList<Ribo> x : listList){
339 q.add(x);
340 }
341 return q;
342 }
343
344 private ConcurrentReadInputStream makeCris(FileFormat ff){
345 ConcurrentReadInputStream cris=ConcurrentReadInputStream.getReadInputStream(maxReads, true, ff, null);
346 cris.start(); //Start the stream
347 if(verbose){outstream.println("Started cris");}
348 boolean paired=cris.paired();
349 assert(!paired) : "This should not be paired input.";
350 return cris;
351 }
352
353 private ConcurrentReadOutputStream makeCros(){
354 if(ffout1==null){return null;}
355
356 //Select output buffer size based on whether it needs to be ordered
357 final int buff=(ordered ? Tools.mid(16, 128, (Shared.threads()*2)/3) : 8);
358
359 final ConcurrentReadOutputStream ros=ConcurrentReadOutputStream.getStream(ffout1, null, buff, null, false);
360 ros.start(); //Start the stream
361 return ros;
362 }
363
364 /*--------------------------------------------------------------*/
365 /*---------------- Thread Management ----------------*/
366 /*--------------------------------------------------------------*/
367
368 /** Spawn process threads */
369 private void spawnThreads(final ConcurrentReadInputStream cris, boolean altData){
370
371 //Do anything necessary prior to processing
372
373 //Fill a list with ProcessThreads
374 if(verbose){System.err.println("Spawning "+threads+" threads.");}
375 ArrayList<ProcessThread> alpt=new ArrayList<ProcessThread>(threads);
376 for(int i=0; i<threads; i++){
377 alpt.add(new ProcessThread(cris, i, altData));
378 }
379
380 //Start the threads and wait for them to finish
381 boolean success=ThreadWaiter.startAndWait(alpt, this);
382 if(verbose){System.err.println("Threads finished with success="+success+".");}
383 errorState&=!success;
384 }
385
386 @Override
387 public final void accumulate(ProcessThread pt){
388 readsProcessed+=pt.readsProcessedT;
389 basesProcessed+=pt.basesProcessedT;
390 errorState|=(!pt.success);
391 }
392
393 @Override
394 public final boolean success(){return !errorState;}
395
396 /*--------------------------------------------------------------*/
397 /*---------------- Inner Methods ----------------*/
398 /*--------------------------------------------------------------*/
399
400 /*--------------------------------------------------------------*/
401 /*---------------- Inner Classes ----------------*/
402 /*--------------------------------------------------------------*/
403
404 /** This class is static to prevent accidental writing to shared variables.
405 * It is safe to remove the static modifier. */
406 class ProcessThread extends Thread {
407
408 //Constructor
409 ProcessThread(final ConcurrentReadInputStream cris_, final int tid_, boolean alt_){
410 cris=cris_;
411 tid=tid_;
412 processInput=(cris!=null);
413 altData=alt_;
414 }
415
416 //Called by start()
417 @Override
418 public void run(){
419 //Do anything necessary prior to processing
420
421 if(processInput){
422 //Process the reads
423 processInner();
424 }else{
425 pickBest();
426 }
427
428 //Do anything necessary after processing
429
430 //Indicate successful exit status
431 success=true;
432 }
433
434 /** Iterate through the reads */
435 void processInner(){
436 if(verbose && tid==0){System.err.println("processInner() for tid="+tid);}
437
438 //Grab the first ListNum of reads
439 ListNum<Read> ln=cris.nextList();
440
441 //Check to ensure pairing is as expected
442 if(ln!=null && !ln.isEmpty()){
443 Read r=ln.get(0);
444 // assert(ffin1.samOrBam() || (r.mate!=null)==cris.paired()); //Disabled due to non-static access
445 }
446
447 //As long as there is a nonempty read list...
448 while(ln!=null && ln.size()>0){
449 // if(verbose){outstream.println("Fetched "+reads.size()+" reads.");} //Disabled due to non-static access
450
451 processInput(ln);
452
453 //Notify the input stream that the list was used
454 cris.returnList(ln);
455 // if(verbose){outstream.println("Returned a list.");} //Disabled due to non-static access
456
457 //Fetch a new list
458 ln=cris.nextList();
459 }
460
461 //Notify the input stream that the final list was used
462 if(ln!=null){
463 cris.returnList(ln.id, ln.list==null || ln.list.isEmpty());
464 }
465 }
466
467 void processInput(ListNum<Read> ln){
468 if(verbose && tid==0){System.err.println("processInput() for tid="+tid);}
469
470 //Grab the actual read list from the ListNum
471 final ArrayList<Read> reads=ln.list;
472
473 //Loop through each read in the list
474 for(int idx=0; idx<reads.size(); idx++){
475 final Read r1=reads.get(idx);
476
477 //Validate reads in worker threads
478 if(!r1.validated()){r1.validate(true);}
479
480 //Track the initial length for statistics
481 final int initialLength1=r1.length();
482
483 //Increment counters
484 readsProcessedT++;
485 basesProcessedT+=initialLength1;
486
487 processRead(r1);
488 }
489 }
490
491 void pickBest(){
492 if(verbose && tid==0){System.err.println("pickBest() for tid="+tid);}
493 for(ArrayList<Ribo> list=queue.poll(); list!=null; list=queue.poll()){
494 Ribo best=pickBest(list);
495 list.clear();
496 synchronized(bestList){
497 bestList.add(best);
498 }
499 }
500 }
501
502 Ribo pickBest(ArrayList<Ribo> list){
503 if(verbose && tid==0){System.err.println("pickBest(list[="+list.size()+"]) for tid="+tid);}
504 assert(list!=null && list.size()>0);
505 if(list.size()==1){return list.get(0);}
506 Collections.sort(list);
507 Collections.reverse(list);
508 assert(list.get(0).product>=list.get(1).product);
509 if(list.size()<3 || fast){return list.get(0);}
510
511 Ribo base=list.get(0);
512 int pad=Tools.max(10, (1600-base.r.length()));
513 BaseGraph bg=new BaseGraph(base.r.name(), base.r.bases, base.r.quality, base.r.numericID, pad);
514 for(Ribo r : list){
515 bg.alignAndGenerateMatch(r.r, ssa);
516 }
517 Read consensus=bg.traverse();
518 Ribo best;
519 if(useConsensus){
520 best=new Ribo(consensus, base.tid, 1);
521 }else{
522 for(Ribo r : list){
523 float id=align(r.r.bases, consensus.bases);
524 r.identity=id;
525 r.product=score(r.length(), r.identity);
526 }
527 Collections.sort(list);
528 Collections.reverse(list);
529 assert(list.get(0).product>=list.get(1).product);
530 best=list.get(0);
531 }
532 return best;
533 }
534
535 /**
536 * Process a read or a read pair.
537 * @return True if the reads should be kept, false if they should be discarded.
538 */
539 void processRead(final Read r){
540 if(verbose && tid==0){System.err.println("processRead()");}
541 if(r.length()<minlen || r.length()>maxlen){return;}
542 if(maxns>=0 && r.countNocalls()>maxns){return;}
543 Integer key=GiToTaxid.parseTaxidNumber(r.id, '|');
544 if(verbose && tid==0){System.err.println("key="+key);}
545 if(key==null || key==-1 || (altData && seenTaxID.contains(key))){return;}
546 float id=align(r);
547 if(id<minID){return;}
548 Ribo ribo=new Ribo(r, key, id);
549
550 synchronized(listMap){
551 ArrayList<Ribo> list=listMap.get(key);
552 if(list==null){
553 list=new ArrayList<Ribo>(8);
554 listMap.put(key, list);
555 }
556 list.add(ribo);
557 if(!altData){seenTaxID.add(key);}
558 }
559 }
560
561 float align(Read r){
562 float a=(process16S ? align(r.bases, consensus16S) : 0);
563 float b=(process18S ? align(r.bases, consensus18S) : 0);
564 if(verbose && tid==0){System.err.println("Aligned; a="+a+", b="+b);}
565 return Tools.max(a, b);
566 }
567
568 float align(byte[] query, byte[] ref){
569 int a=0, b=ref.length-1;
570 int[] max=ssa.fillUnlimited(query, ref, a, b, -9999);
571 if(max==null){return 0;}
572
573 final int rows=max[0];
574 final int maxCol=max[1];
575 final int maxState=max[2];
576 final float id=ssa.tracebackIdentity(query, ref, a, b, rows, maxCol, maxState, null);
577 return id;
578 }
579
580 SingleStateAlignerFlat2 ssa=new SingleStateAlignerFlat2();
581
582 /** Number of reads processed by this thread */
583 protected long readsProcessedT=0;
584 /** Number of bases processed by this thread */
585 protected long basesProcessedT=0;
586
587 /** True only if this thread has completed successfully */
588 boolean success=false;
589
590 /** Shared input stream */
591 private final ConcurrentReadInputStream cris;
592 /** Thread ID */
593 final int tid;
594
595 //Run mode
596 final boolean processInput;
597 final boolean altData;
598 }
599
600 private class Ribo implements Comparable<Ribo>{
601 Ribo(Read r_, int tid_, float identity_){
602 r=r_;
603 tid=tid_;
604 identity=identity_;
605 product=score(r.length(), identity);
606 }
607
608 @Override
609 public int compareTo(Ribo b) {
610 if(b.product>product){return -1;}
611 else if(b.product<product){return 1;}
612 else if(b.r.length()>r.length()){return -1;}
613 else if(b.r.length()<r.length()){return 1;}
614 return 0;
615 }
616
617 int length(){return r.length();}
618
619 Read r;
620 int tid;
621 float identity;
622 float product;
623 }
624
625 private class ListComparator implements Comparator<ArrayList<Ribo>> {
626
627 @Override
628 public int compare(ArrayList<Ribo> a, ArrayList<Ribo> b) {
629 return a.size()>b.size() ? -1 : a.size()<b.size() ? 1 : 0;
630 }
631
632 }
633
634 private float lengthMult(int len){
635 int idealLength=idealLength();
636 int max=Tools.max(len, idealLength, 1);
637 int min=Tools.min(len, idealLength);
638 return min/(float)max;
639 }
640
641 private float score(int len, float identity){
642 return lengthMult(len)*identity;
643 }
644
645 /*--------------------------------------------------------------*/
646 /*---------------- Fields ----------------*/
647 /*--------------------------------------------------------------*/
648
649 /** Primary input file path */
650 private ArrayList<String> in=new ArrayList<String>();
651
652 /** Alternate input file path */
653 private String alt=null;
654
655 /** Primary output file path */
656 private String out1=null;
657
658 /** Override input file extension */
659 private String extin=null;
660 /** Override output file extension */
661 private String extout=null;
662
663 ArrayList<Ribo> bestList=new ArrayList<Ribo>();
664 HashMap<Integer, ArrayList<Ribo>> listMap=new HashMap<Integer, ArrayList<Ribo>>(100000);
665 ConcurrentLinkedQueue<ArrayList<Ribo>> queue;
666
667
668 IntHashSet seenTaxID=new IntHashSet(1000000);
669
670 byte[] consensus16S;
671 byte[] consensus18S;
672
673 int idealLength(){
674 if(process16S){return consensus16S.length;}
675 return consensus18S.length;
676 }
677
678 boolean useConsensus=false;
679 boolean fast=false;
680 int maxns=-1;
681 int minlen=1;
682 int maxlen=4000;
683
684 /*--------------------------------------------------------------*/
685
686 /** Number of reads processed */
687 protected long readsProcessed=0;
688 /** Number of bases processed */
689 protected long basesProcessed=0;
690
691 /** Number of reads retained */
692 protected long readsOut=0;
693 /** Number of bases retained */
694 protected long basesOut=0;
695
696 /** Quit after processing this many input reads; -1 means no limit */
697 private long maxReads=-1;
698
699 private float minID=0.62f;
700
701 private boolean process16S=true;
702 private boolean process18S=false;
703
704 /*--------------------------------------------------------------*/
705 /*---------------- Final Fields ----------------*/
706 /*--------------------------------------------------------------*/
707
708 /** Primary input file */
709 private final ArrayList<FileFormat> ffin;
710 private final FileFormat ffalt;
711
712 /** Primary output file */
713 private final FileFormat ffout1;
714
715 final int threads;
716
717 @Override
718 public final ReadWriteLock rwlock() {return rwlock;}
719 private final ReadWriteLock rwlock=new ReentrantReadWriteLock();
720
721 /*--------------------------------------------------------------*/
722 /*---------------- Common Fields ----------------*/
723 /*--------------------------------------------------------------*/
724
725 /** Print status messages to this output stream */
726 private PrintStream outstream=System.err;
727 /** Print verbose messages */
728 public static boolean verbose=false;
729 /** True if an error was encountered */
730 public boolean errorState=false;
731 /** Overwrite existing output files */
732 private boolean overwrite=true;
733 /** Append to existing output files */
734 private boolean append=false;
735 /** Reads are output in input order */
736 private boolean ordered=false;
737
738 }