Debian Codegraph @

current/dna/ChromArrayMaker.java

raw symbols SCIP
1 package dna;
2
3 import java.io.File;
4 import java.io.IOException;
5 import java.util.ArrayList;
6 import java.util.Date;
7
8 import fileIO.FileFormat;
9 import fileIO.ReadWrite;
10 import fileIO.TextStreamWriter;
11 import shared.Parse;
12 import shared.Parser;
13 import shared.PreParser;
14 import shared.Shared;
15 import shared.Tools;
16 import stream.CrisWrapper;
17 import stream.FASTQ;
18 import stream.FastaReadInputStream;
19 import stream.Read;
20
21 /**
22 * Replaces FastaToChromArrays with a more general solution that can handle fastq.
23 * @author Brian Bushnell
24 * @date Jul 18, 2014
25 *
26 */
27 public class ChromArrayMaker {
28
29 // Example:
30 // dna.ChromArrayMaker ecoli_K12.fa 1 writeinthread=false genscaffoldinfo=true retain waitforwriting=false
31 // gzip=true chromc=false maxlen=536670912 writechroms=true minscaf=1 midpad=300 startpad=8000 stoppad=8000 nodisk=false
32
33 public static void main(String[] args){
34 main2(args);
35 }
36
37 public static ArrayList<ChromosomeArray> main2(String[] args){
38
39 {//Preparse block for help, config files, and outstream
40 PreParser pp=new PreParser(args, null, false);
41 args=pp.args;
42 //outstream=pp.outstream;
43 }
44
45 boolean oldWIT=WRITE_IN_THREAD;
46 WRITE_IN_THREAD=true;
47
48 String name=null;
49 int genome=-1;
50 int chroms=-1;
51 String infile=null;
52 boolean writeinfo=false;
53 boolean genScaffoldInfo=true;
54 boolean writeChroms=true;
55 boolean scafprefixes=Data.scaffoldPrefixes;
56
57 for(int i=0; i<args.length; i++){
58
59 final String arg=args[i];
60 final String[] split=arg.split("=");
61 String a=split[0].toLowerCase();
62 String b=split.length>1 ? split[1] : null;
63
64 if(Parser.parseZip(arg, a, b)){
65 //do nothing
66 }else if(a.equals("path") || a.equals("root") || a.equals("tempdir")){
67 Data.setPath(b);
68 }else if(a.equals("name") || a.equals("organism")){
69 name=b;
70 }else if(a.equals("in") || a.equals("input") || a.equals("ref") || a.equals("fasta")){
71 if(split.length<1 || "null".equalsIgnoreCase(b)){b=null;}
72 infile=b;
73 }else if(a.equals("build") || a.equals("genome")){
74 genome=Integer.parseInt(b);
75 }else if(a.equals("chroms")){
76 chroms=Integer.parseInt(b);
77 }else if(a.equals("writeinthread")){
78 WRITE_IN_THREAD=Parse.parseBoolean(b);
79 }else if(a.equals("nodisk")){
80 NODISK=Parse.parseBoolean(b);
81 }else if(a.equals("writeinfo")){
82 writeinfo=Parse.parseBoolean(b);
83 }else if(a.equals("padstart") || a.startsWith("startpad") || a.equals("padfront") || a.startsWith("frontpad")){
84 START_PADDING=Integer.parseInt(b);
85 }else if(a.equals("padstop") || a.startsWith("stoppad") || a.equals("padend") || a.startsWith("endpad")){
86 END_PADDING=Integer.parseInt(b);
87 }else if(a.equals("pad") || a.equals("padding")){
88 START_PADDING=END_PADDING=Integer.parseInt(b);
89 }else if(a.equals("midpad") || a.startsWith("padmid")){
90 MID_PADDING=Integer.parseInt(b);
91 }else if(a.startsWith("minscaf") || a.startsWith("mincontig")){
92 MIN_SCAFFOLD=Integer.parseInt(b);
93 }else if(a.equals("genscaffoldinfo")){
94 genScaffoldInfo=Parse.parseBoolean(b);
95 System.err.println("Set genScaffoldInfo="+genScaffoldInfo);
96 }else if(a.equals("append") || a.equals("app")){
97 append=Parse.parseBoolean(b);
98 }else if(a.equals("overwrite") || a.equals("ow")){
99 overwrite=Parse.parseBoolean(b);
100 }else if(a.equals("mergescaffolds") || a.equals("mergecontigs") || (a.equals("merge"))){
101 MERGE_SCAFFOLDS=Parse.parseBoolean(b);
102 System.err.println("Set MERGE_SCAFFOLDS="+MERGE_SCAFFOLDS);
103 }else if(a.startsWith("maxlen") || a.startsWith("chromlen")){
104 long len=Parse.parseKMG(b);
105 assert(len>0 && len<=Integer.MAX_VALUE);
106 MAX_LENGTH=(int)len;
107 }else if(a.equals("writechroms")){
108 writeChroms=Parse.parseBoolean(b);
109 }else if(a.equals("chromgz") || a.equals("gz")){
110 Data.CHROMGZ=Parse.parseBoolean(b);
111 }else if(a.equals("retain")){
112 RETAIN=Parse.parseBoolean(b);
113 }else if(a.equals("scafprefixes")){
114 scafprefixes=Parse.parseBoolean(b);
115 }else if(a.equals("waitforwriting")){
116 WAIT_FOR_WRITING=Parse.parseBoolean(b);
117 }else{
118 if(i>2){
119 System.err.println("WARNING: Unknown parameter "+args[i]);
120 }
121 }
122 }
123
124 WAIT_FOR_WRITING=(WAIT_FOR_WRITING || ReadWrite.USE_GZIP || ReadWrite.USE_PIGZ);
125
126 ArrayList<ChromosomeArray> r=RETAIN ? new ArrayList<ChromosomeArray>() : null;
127
128 // assert(false) : Arrays.toString(args);
129 // assert(RETAIN);
130
131 if(genome<0){genome=Integer.parseInt(args[1]);} //Legacy
132 if(genome<0){throw new RuntimeException("Please specify a genome build number.");}
133
134 if(writeinfo){
135 if(chroms<0){chroms=Integer.parseInt(args[2]);} //Legacy
136 if(chroms<0){throw new RuntimeException("Please the number of chroms.");}
137 writeInfo(genome, chroms, name, null, false, scafprefixes);
138 }else{
139 if(infile==null){infile=args[0].replace('\\', '/');} //Legacy
140 if(infile==null){throw new RuntimeException("Please specify an input file.");}
141 {
142 File f=new File(infile);
143 if(!f.exists() || f.isDirectory()){
144 if(!infile.startsWith("stdin")){
145 throw new RuntimeException("Not a valid file: "+f);
146 }
147 }
148 }
149 String outRoot=Data.ROOT_GENOME+genome+"/";
150
151 ChromArrayMaker ftca=new ChromArrayMaker();
152
153 {
154 boolean oldTI=FASTQ.TEST_INTERLEAVED;
155 boolean oldFI=FASTQ.FORCE_INTERLEAVED;
156 FASTQ.TEST_INTERLEAVED=false;
157 FASTQ.FORCE_INTERLEAVED=false;
158 ftca.makeChroms(infile, outRoot, name, genScaffoldInfo, writeChroms, r, scafprefixes);
159 FASTQ.TEST_INTERLEAVED=oldTI;
160 FASTQ.FORCE_INTERLEAVED=oldFI;
161 }
162 }
163
164 WRITE_IN_THREAD=oldWIT;
165 return r;
166 }
167
168 private ChromArrayMaker(){}
169
170
171 private static int[] countInfo(ChromosomeArray ca){
172 int contigs=0;
173 int startPad=0;
174 int stopPad=0;
175 int undefined=0;
176 int defined=0;//=ca.countDefinedBases();
177
178 int lastN=-1;
179 int lastDef=-1;
180
181 for(int i=0; i<=ca.maxIndex; i++){
182 byte b=ca.get(i);
183 if(AminoAcid.isFullyDefined(b)){
184 if(defined==0){startPad=i; contigs++;}
185 else if(i-lastDef>contigTrigger){contigs++;}
186 lastDef=i;
187 defined++;
188 }else{
189 lastN=i;
190 undefined++;
191 }
192 }
193
194 if(contigs>0 && lastN==ca.maxIndex){
195 stopPad=lastN-lastDef;
196 }else{
197 // System.err.println(lastN+", "+lastDef+", "+ca.maxIndex);
198 }
199
200 return new int[] {ca.chromosome, 1, contigs, (ca.maxIndex+1), defined, undefined, startPad, stopPad};
201 }
202
203 @Deprecated
204 public static void writeInfo(int genome, int chroms, String name, String source, boolean unload, boolean scafNamePrefix){
205 Data.GENOME_BUILD=genome;
206 Data.chromosomePlusMatrix=new ChromosomeArray[chroms+1];
207
208 String outRoot=Data.ROOT_GENOME+genome+"/";
209 TextStreamWriter info=new TextStreamWriter(outRoot+"info.txt", true, false, false);
210 info.start();
211 info.print("#Chromosome sizes\n");
212 try {
213 info.print("#Generated on\t"+new Date()+"\n");
214 } catch (Exception e) {
215 // TODO Auto-generated catch block
216 e.printStackTrace();
217 }
218 info.print("#Version\t"+VERSION+"\n");
219 info.print("#chrom\tscaffolds\tcontigs\tlength\tdefined\tundefined\tstartPad\tstopPad\n");
220
221
222 long bases=0;
223 long definedBases=0;
224
225 long contigSum=0;
226
227 for(int chrom=1; chrom<=chroms; chrom++){
228 ChromosomeArray ca=Data.getChromosome(chrom);
229 int[] v=countInfo(ca);
230 info.print(v[0]+"\t"+v[1]+"\t"+v[2]+"\t"+v[3]+"\t"+v[4]+"\t"+v[5]+"\t"+v[6]+"\t"+v[7]+"\n");
231
232 bases+=v[3];
233 definedBases+=v[4];
234 contigSum+=v[2];
235 if(unload){Data.unload(chrom, false);}
236 }
237 info.poison();
238 StringBuilder sb=new StringBuilder();
239 sb.append("#Summary\n");
240 try {
241 sb.append("#Generated on\t"+new Date()+"\n");
242 } catch (Exception e) {
243 // TODO Auto-generated catch block
244 e.printStackTrace();
245 }
246 sb.append("#Version\t"+VERSION+"\n");
247 sb.append("chroms\t"+(chroms)+"\n");
248 sb.append("bases\t"+bases+"\n");
249 sb.append("defined\t"+definedBases+"\n");
250 sb.append("undefined\t"+(bases-definedBases)+"\n");
251 sb.append("contigs\t"+contigSum+"\n");
252 sb.append("scaffolds\t"+chroms+"\n");
253 sb.append("interpad\t"+MID_PADDING+"\n");
254 if(name!=null){sb.append("name\t"+name+"\n");}
255 if(source!=null){sb.append("source\t"+source+"\n");}
256 if(scafNamePrefix){sb.append("scafprefixes\t"+scafNamePrefix+"\n");}//else{assert(false);}
257 ReadWrite.writeString(sb, outRoot+"summary.txt", false);
258 info.waitForFinish();
259 }
260
261 private int makeChroms(String fname, String outRoot, String genomeName, boolean genScaffolds, boolean writeChroms, ArrayList<ChromosomeArray> r,
262 boolean scafNamePrefix){
263
264 if(!NODISK){
265 File f=new File(outRoot);
266 if(!f.exists()){
267 if(!NODISK){f.mkdirs();}
268 }else if(overwrite){
269 for(File g : f.listFiles()){
270 String s=g.getName();
271 if(g.isFile() && s.contains(".chrom")){
272 System.err.println("Deleting "+s);
273 g.delete();
274 }
275 }
276 }
277
278 f=new File(outRoot.replace("ref/genome/", "ref/index/"));
279 if(!f.exists()){
280 if(!NODISK){f.mkdirs();}
281 }else if(overwrite){
282 for(File g : f.listFiles()){
283 String s=g.getName();
284 if(g.isFile() && (s.endsWith(".int2d") || s.endsWith(".block") || s.endsWith(".block2.gz") || s.endsWith(".blockB") || s.endsWith(".blockB2.gz"))){
285 System.err.println("Deleting "+s);
286 g.delete();
287 }
288 }
289 }
290 }
291
292 final FileFormat ffin=FileFormat.testInput(fname, FileFormat.FASTA, null, true, true);
293
294 final boolean OLD_SPLIT_READS=FastaReadInputStream.SPLIT_READS;
295 FastaReadInputStream.SPLIT_READS=false;
296 final int oldNum=Shared.numBuffers();
297 Shared.setBuffers(4);
298 final CrisWrapper criswrapper=new CrisWrapper(-1, false, ffin, null, null, null);
299 Shared.setBuffers(oldNum);
300
301
302 int chrom=1;
303
304 TextStreamWriter infoWriter=null, scafWriter=null;
305 ArrayList<String> infolist=null, scaflist=null;
306
307 if(NODISK){
308 infolist=new ArrayList<String>();
309 infolist.add("#Chromosome sizes");
310 try {
311 infolist.add("#Generated on\t"+new Date());
312 } catch (Exception e1) {
313 e1.printStackTrace();
314 }
315 infolist.add("#Version\t"+VERSION);
316 infolist.add("#chrom\tscaffolds\tcontigs\tlength\tdefined\tundefined\tstartPad\tstopPad");
317 }else{
318 infoWriter=new TextStreamWriter(outRoot+"info.txt", true, false, false);
319 infoWriter.start();
320 infoWriter.print("#Chromosome sizes\n");
321 try {
322 // System.err.println(new Date());
323 infoWriter.print("#Generated on\t"+new Date()+"\n");
324 } catch (Exception e1) {
325 // TODO Auto-generated catch block
326 e1.printStackTrace();
327 }
328 infoWriter.print("#Version\t"+VERSION+"\n");
329 infoWriter.print("#chrom\tscaffolds\tcontigs\tlength\tdefined\tundefined\tstartPad\tstopPad\n");
330 }
331
332 if(genScaffolds){
333 if(NODISK){
334 scaflist=new ArrayList<String>();
335 scaflist.add("#Scaffold names");
336 try {
337 scaflist.add("#Generated on\t"+new Date());
338 } catch (Exception e) {
339 // TODO Auto-generated catch block
340 e.printStackTrace();
341 }
342 scaflist.add("#Version\t"+VERSION);
343 scaflist.add("#chrom\tid\tstart\tlength\tname");
344 }else{
345 //System.err.println("*123 Making ScafWriter; "+ReadWrite.countActiveThreads()+", "+ReadWrite.USE_GZIP+", "+ReadWrite.USE_PIGZ);
346 scafWriter=new TextStreamWriter(outRoot+"scaffolds.txt.gz", true, false, false);
347 scafWriter.start();
348 scafWriter.print("#Scaffold names\n");
349 try {
350 scafWriter.print("#Generated on\t"+new Date()+"\n");
351 } catch (Exception e) {
352 // TODO Auto-generated catch block
353 e.printStackTrace();
354 }
355 scafWriter.print("#Version\t"+VERSION+"\n");
356 scafWriter.print("#chrom\tid\tstart\tlength\tname\n");
357 }
358 }
359
360
361 for(ChromosomeArray ca=makeNextChrom(criswrapper, chrom, infoWriter, scafWriter, infolist, scaflist); ca!=null;
362 ca=makeNextChrom(criswrapper, chrom, infoWriter, scafWriter, infolist, scaflist)){
363 if(ca.array.length>ca.maxIndex+1){ca.resize(ca.maxIndex+1);}
364 if(RETAIN){r.add(ca);}
365
366 if(writeChroms){
367 String x=outRoot+"chr"+chrom+Data.chromExtension();
368 if(new File(x).exists() && !overwrite){throw new RuntimeException("Tried to overwrite existing file "+x+", but overwrite=false.");}
369 ReadWrite.writeObjectInThread(ca, x, false);
370 System.err.println("Writing chunk "+chrom);
371 }
372 chrom++;
373 }
374
375 FastaReadInputStream.SPLIT_READS=OLD_SPLIT_READS;
376
377 if(infoWriter!=null){infoWriter.poison();}
378 if(scafWriter!=null){
379 //System.err.println("*123 Killing ScafWriter; "+ReadWrite.countActiveThreads()+", "+ReadWrite.USE_GZIP+", "+ReadWrite.USE_PIGZ);
380 scafWriter.poison();
381 }
382
383 StringBuilder sb=new StringBuilder();
384 sb.append("#Summary\n");
385 try {
386 sb.append("#Generated on\t"+new Date()+"\n");
387 } catch (Exception e1) {
388 // TODO Auto-generated catch block
389 e1.printStackTrace();
390 }
391 sb.append("#Version\t"+VERSION+"\n");
392 sb.append("chroms\t"+(chrom-1)+"\n");
393 sb.append("bases\t"+lengthSum+"\n");
394 assert((definedSum+undefinedSum)==lengthSum) : definedSum+", "+undefinedSum+", "+lengthSum;
395 sb.append("defined\t"+definedSum+"\n");
396 sb.append("undefined\t"+undefinedSum+"\n");
397 sb.append("contigs\t"+contigSum+"\n");
398 sb.append("scaffolds\t"+scaffoldSum+"\n");
399 sb.append("interpad\t"+MID_PADDING+"\n");
400 if(genomeName!=null){sb.append("name\t"+genomeName+"\n");}
401 if(fname!=null){
402 File f=new File(fname);
403 String cpath=null;
404 try {
405 cpath=f.getCanonicalPath();
406 } catch (IOException e) {
407 cpath=f.getAbsolutePath();
408 }
409 sb.append("source\t"+cpath+"\n");
410 sb.append("bytes\t"+f.length()+"\n");
411 sb.append("last modified\t"+f.lastModified()+"\n");
412 }
413 if(scafNamePrefix){sb.append("scafprefixes\t"+scafNamePrefix+"\n");}//else{assert(false);}
414 if(NODISK){
415 SUMMARY_LIST=new ArrayList<String>();
416 String[] split=sb.toString().split("\n");
417 for(String s : split){SUMMARY_LIST.add(s);}
418 }else{
419 ReadWrite.writeString(sb, outRoot+"summary.txt", false);
420 }
421
422 if(infoWriter!=null){infoWriter.waitForFinish();}
423 if(scafWriter!=null){
424 //System.err.println("*123 Waiting For ScafWriter; "+ReadWrite.countActiveThreads()+", "+ReadWrite.USE_GZIP+", "+ReadWrite.USE_PIGZ);
425 scafWriter.waitForFinish();
426 //System.err.println("*123 ScafWriter Finished; "+ReadWrite.countActiveThreads()+", "+ReadWrite.USE_GZIP+", "+ReadWrite.USE_PIGZ);
427 }
428
429 if(WAIT_FOR_WRITING && ReadWrite.countActiveThreads()>0){
430 System.err.println("Waiting for writing to finish.");
431 ReadWrite.waitForWritingToFinish();
432 System.err.println("Finished.");
433 //System.err.println("*123 countActiveThreads Finished; "+ReadWrite.countActiveThreads()+", "+ReadWrite.USE_GZIP+", "+ReadWrite.USE_PIGZ);
434 }
435
436 if(infolist!=null){
437 INFO_LIST=infolist;
438 LISTBUILD=Data.GENOME_BUILD;
439 }else{INFO_LIST=null;}
440 if(scaflist!=null){
441 SCAF_LIST=scaflist;
442 LISTBUILD=Data.GENOME_BUILD;
443 }else{SCAF_LIST=null;}
444
445 return chrom-1;
446 }
447
448 private ChromosomeArray makeNextChrom(CrisWrapper criswrapper, int chrom, TextStreamWriter infoWriter, TextStreamWriter scafWriter, ArrayList<String> infolist, ArrayList<String> scaflist){
449 assert(FastaReadInputStream.SPLIT_READS==false);
450 ChromosomeArray ca=new ChromosomeArray(chrom, (byte)Shared.PLUS, 0, 120000+START_PADDING);
451 ca.maxIndex=-1;
452 for(int i=0; i<START_PADDING; i++){ca.set(i, 'N');}
453
454 if(verbose){System.err.println("chrom="+chrom+", currentScaffold="+(currentScaffold==null ? "null" : currentScaffold.id));}
455
456 int scaffolds=0;
457 if(currentScaffold!=null && currentScaffold.length()>0){
458 assert(currentScaffold.length()>0);
459 assert(currentScaffold.length()+END_PADDING+ca.maxIndex<MAX_LENGTH);
460
461 if(verbose){System.err.println("A: Writing a scaffold because currentScaffold = "+currentScaffold);}
462 scaffoldSum++;
463 if(scafWriter!=null){scafWriter.print(chrom+"\t"+scaffoldSum+"\t"+(ca.maxIndex+1)+"\t"+currentScaffold.length()+"\t"+currentScaffold.id+"\n");}
464 if(scaflist!=null && currentScaffold!=null){
465 scaflist.add(chrom+"\t"+scaffoldSum+"\t"+(ca.maxIndex+1)+"\t"+currentScaffold.length()+"\t"+currentScaffold.id);
466 if(verbose){System.err.println("A: Added to scaflist: "+scaflist.get(scaflist.size()-1));}
467 }
468 ca.set(ca.maxIndex+1, currentScaffold.bases);
469 scaffolds++;
470
471 currentScaffold=null;
472 }
473
474 while((currentScaffold=criswrapper.next())!=null){
475 if(currentScaffold.length()+MID_PADDING+END_PADDING+ca.maxIndex>MAX_LENGTH){break;}
476 if(scaffolds>0 && !MERGE_SCAFFOLDS){break;}
477
478 if(scaffolds>0){
479 for(int i=0; i<MID_PADDING; i++){
480 ca.set(ca.maxIndex+1, 'N');
481 }
482 }
483 if(currentScaffold.length()>=MIN_SCAFFOLD){
484 if(verbose){System.err.println("B: Writing a scaffold because currentScaffold = "+currentScaffold);}
485 scaffoldSum++;
486 if(scafWriter!=null){scafWriter.print(chrom+"\t"+scaffoldSum+"\t"+(ca.maxIndex+1)+"\t"+currentScaffold.length()+"\t"+currentScaffold.id+"\n");}
487 if(scaflist!=null){
488 scaflist.add(chrom+"\t"+scaffoldSum+"\t"+(ca.maxIndex+1)+"\t"+currentScaffold.length()+"\t"+currentScaffold.id);
489 if(verbose){System.err.println("B: Added to scaflist: "+scaflist.get(scaflist.size()-1));}
490 }
491 ca.set(ca.maxIndex+1, currentScaffold.bases);
492 scaffolds++;
493 }
494 currentScaffold=null;
495 }
496
497 // if(verbose){System.err.println("lastHeader="+lastHeader);}
498
499 if(scaffolds==0){return null;}
500
501 if(END_PADDING>0){
502 int terminalN=0;
503 for(int i=ca.maxIndex; i>=0 && terminalN<END_PADDING; i--){
504 if(ca.get(i)=='N'){terminalN++;}
505 else{break;}
506 }
507 // System.err.println("\nAdding Ns: ref.length="+ca.maxIndex);
508 while(terminalN<=END_PADDING && ca.maxIndex<MAX_LENGTH-1){
509 // System.out.print("N");
510 ca.set(ca.maxIndex+1, 'N');
511 terminalN++;
512 }
513 // System.err.println("\nAdded Ns: ref.length="+ca.maxIndex);
514 }
515
516 int[] v=countInfo(ca);
517 v[6]=Tools.max(0, Tools.min(START_PADDING, v[6])); //In case input scaffolds had leading undefined bases
518 v[7]=Tools.max(0, Tools.min(END_PADDING, v[7])); //In case input scaffolds had trailing undefined bases
519 if(infoWriter!=null){
520 // infoWriter.print("#chrom\tscaffolds\tcontigs\tlength\tdefined\tundefined\tstartPad\tstopPad\n");
521 infoWriter.print(v[0]+"\t"+scaffolds+"\t"+v[2]+"\t"+v[3]+"\t"+v[4]+"\t"+v[5]+"\t"+v[6]+"\t"+v[7]+"\n");
522 }
523 if(infolist!=null){
524 infolist.add(v[0]+"\t"+scaffolds+"\t"+v[2]+"\t"+v[3]+"\t"+v[4]+"\t"+v[5]+"\t"+v[6]+"\t"+v[7]);
525 }
526 lengthSum+=v[3];
527 definedSum+=v[4];
528 undefinedSum+=v[5];
529 contigSum+=v[2];
530
531 assert((definedSum+undefinedSum)==lengthSum) : definedSum+", "+undefinedSum+", "+lengthSum+
532 "; "+ca.countDefinedBases()+", "+(ca.maxIndex+1)+"\n"+ca.getString(0, ca.maxIndex);
533
534 return ca;
535 }
536
537 // private String lastHeader;
538 // private String nextHeader;
539 private Read currentScaffold;
540 private long scaffoldSum=0;
541 private long lengthSum=0;
542 private long definedSum=0;
543 private long undefinedSum=0;
544 private long contigSum=0;
545
546
547 public static final int currentVersion(){return VERSION;}
548
549 public static boolean MERGE_SCAFFOLDS=true;
550 public static boolean WRITE_IN_THREAD=false;
551 public static boolean overwrite=true;
552 public static boolean append=false;
553 public static int START_PADDING=8000; //Always applied
554 public static int MID_PADDING=300; //Applied when merging scaffolds
555 public static int END_PADDING=8000; //Only applied if not enough terminal Ns
556 public static int MIN_SCAFFOLD=1;
557 public static int contigTrigger=10;
558 public static int VERSION=5;
559 public static int MAX_LENGTH=(1<<29)-200000;
560
561 public static boolean verbose=false;
562 public static boolean RETAIN=false;
563 public static boolean WAIT_FOR_WRITING=true;
564 public static boolean NODISK=false;
565 public static int LISTBUILD=-1;
566 public static ArrayList<String> INFO_LIST, SCAF_LIST, SUMMARY_LIST;
567
568 // public static boolean GENERATE_SCAFFOLD_INFO=true;
569
570 }