1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578
|
package align2;
import java.io.File;
import java.util.ArrayList;
import java.util.Locale;
import bloom.BloomFilter;
import dna.ChromosomeArray;
import dna.Data;
import fileIO.ReadWrite;
import jgi.CoveragePileup;
import shared.Shared;
import shared.Timer;
import shared.Tools;
import stream.FastaReadInputStream;
import stream.ReadStreamWriter;
import stream.SamLine;
/**
* Based on TestIndex11f
*
* @author Brian Bushnell
* @date Jan 3, 2013
*
*/
public final class BBMap5 extends AbstractMapper {
public static void main(String[] args){
Timer t=new Timer();
BBMap5 mapper=new BBMap5(args);
args=Tools.condenseStrict(args);
if(!INDEX_LOADED){mapper.loadIndex();}
if(Data.scaffoldPrefixes){mapper.processAmbig2();}
mapper.testSpeed(args);
ReadWrite.waitForWritingToFinish();
t.stop();
outstream.println("\nTotal time: \t"+t);
clearStatics();
}
public BBMap5(String[] args){
super(args);
}
@Override
public void setDefaults(){
ReadWrite.USE_PIGZ=ReadWrite.USE_UNPIGZ=false;
ReadWrite.USE_BGZIP=ReadWrite.USE_UNBGZIP=true;
ReadWrite.PREFER_BGZIP=true;
ReadWrite.ZIPLEVEL=2;
MAKE_MATCH_STRING=true;
keylen=13;
MINIMUM_ALIGNMENT_SCORE_RATIO=0.56f;
keyDensity=1.9f;//2.3f;
maxKeyDensity=3f;//4f;
minKeyDensity=1.5f;//1.8f;
maxDesiredKeys=15;
SLOW_ALIGN_PADDING=4;
SLOW_RESCUE_PADDING=4+SLOW_ALIGN_PADDING;
TIP_SEARCH_DIST=100;
MSA_TYPE="MultiStateAligner11ts";
MAX_SITESCORES_TO_PRINT=5;
PRINT_SECONDARY_ALIGNMENTS=false;
AbstractIndex.MIN_APPROX_HITS_TO_KEEP=1;
}
@Override
public String[] preparse(String[] args){
if(fast){
ArrayList<String> list=new ArrayList<String>();
list.add("tipsearch="+TIP_SEARCH_DIST/5);
list.add("maxindel=80");
list.add("minhits=2");
list.add("bwr=0.18");
list.add("bw=40");
list.add("minratio=0.65");
list.add("midpad=150");
list.add("minscaf=50");
list.add("quickmatch=t");
list.add("rescuemismatches=15");
list.add("rescuedist=800");
list.add("maxsites=3");
list.add("maxsites2=100");
// list.add("k=13");
BBIndex5.setFractionToExclude(BBIndex5.FRACTION_GENOME_TO_EXCLUDE*1.25f);
for(String s : args){if(s!=null){list.add(s);}}
args=list.toArray(new String[list.size()]);
keyDensity*=0.9f;
maxKeyDensity*=0.9f;
minKeyDensity*=0.9f;
}else if(vslow){
ArrayList<String> list=new ArrayList<String>();
list.add("tipsearch="+(TIP_SEARCH_DIST*3)/2);
list.add("minhits=1");
list.add("minratio=0.25");
list.add("rescuemismatches=50");
list.add("rescuedist=3000");
BBIndex5.setFractionToExclude(0);
for(String s : args){if(s!=null){list.add(s);}}
args=list.toArray(new String[list.size()]);
SLOW_ALIGN_PADDING=SLOW_ALIGN_PADDING*2+2;
SLOW_RESCUE_PADDING=SLOW_RESCUE_PADDING*2+2;
AbstractIndex.SLOW=true;
AbstractIndex.VSLOW=true;
keyDensity*=2.5f;
maxKeyDensity*=2.5f;
minKeyDensity*=2.5f;
}else if(slow){
//TODO: Unfinished
ArrayList<String> list=new ArrayList<String>();
BBIndex5.setFractionToExclude(BBIndex5.FRACTION_GENOME_TO_EXCLUDE*0.4f);
for(String s : args){if(s!=null){list.add(s);}}
args=list.toArray(new String[list.size()]);
AbstractIndex.SLOW=true;
keyDensity*=1.2f;
maxKeyDensity*=1.2f;
minKeyDensity*=1.2f;
}
if(excludeFraction>=0){
BBIndex5.setFractionToExclude(excludeFraction);
}
return args;
}
@Override
void postparse(String[] args){
if(MSA.bandwidthRatio>0 && MSA.bandwidthRatio<.2){
SLOW_ALIGN_PADDING=Tools.min(SLOW_ALIGN_PADDING, 3);
SLOW_RESCUE_PADDING=Tools.min(SLOW_RESCUE_PADDING, 6);
}
if(maxIndel1>-1){
TIP_SEARCH_DIST=Tools.min(TIP_SEARCH_DIST, maxIndel1);
BBIndex5.MAX_INDEL=maxIndel1;
}
if(maxIndel2>-1){
BBIndex5.MAX_INDEL2=maxIndel2;
}
if(minApproxHits>-1){
BBIndex5.MIN_APPROX_HITS_TO_KEEP=minApproxHits;
}
if(expectedSites>-1){
BBMapThread5.setExpectedSites(expectedSites);
outstream.println("Set EXPECTED_SITES to "+expectedSites);
}
if(fractionGenomeToExclude>=0){
BBIndex5.setFractionToExclude(fractionGenomeToExclude);
}
{
final String a=(args.length>0 ? args[0] : null);
final String b=(args.length>1 ? args[1] : null);
if(in1==null && a!=null && a.indexOf('=')<0 && (a.startsWith("stdin") || new File(a).exists())){in1=a;}
if(in2==null && b!=null && b.indexOf('=')<0 && new File(b).exists()){in2=b;}
if(ERROR_ON_NO_OUTPUT && !OUTPUT_READS && in1!=null){throw new RuntimeException("Error: no output file, and ERROR_ON_NO_OUTPUT="+ERROR_ON_NO_OUTPUT);}
}
assert(synthReadlen<BBMapThread5.ALIGN_ROWS);
if(MSA.bandwidth>0){
int halfwidth=MSA.bandwidth/2;
TIP_SEARCH_DIST=Tools.min(TIP_SEARCH_DIST, halfwidth/2);
BBIndex5.MAX_INDEL=Tools.min(BBIndex5.MAX_INDEL, halfwidth/2);
BBIndex5.MAX_INDEL2=Tools.min(BBIndex5.MAX_INDEL2, halfwidth);
SLOW_ALIGN_PADDING=Tools.min(SLOW_ALIGN_PADDING, halfwidth/4);
SLOW_RESCUE_PADDING=Tools.min(SLOW_RESCUE_PADDING, halfwidth/4);
}
if(PRINT_SECONDARY_ALIGNMENTS){
REMOVE_DUPLICATE_BEST_ALIGNMENTS=false;
BBIndex5.QUIT_AFTER_TWO_PERFECTS=false;
}
if(in1!=null){
if(ambigMode==AMBIG_BEST){
REMOVE_DUPLICATE_BEST_ALIGNMENTS=false;
if(!PRINT_SECONDARY_ALIGNMENTS){BBIndex5.QUIT_AFTER_TWO_PERFECTS=true;}
outstream.println("Retaining first best site only for ambiguous mappings.");
}else if(ambigMode==AMBIG_ALL){
PRINT_SECONDARY_ALIGNMENTS=ReadStreamWriter.OUTPUT_SAM_SECONDARY_ALIGNMENTS=true;
REMOVE_DUPLICATE_BEST_ALIGNMENTS=false;
BBIndex5.QUIT_AFTER_TWO_PERFECTS=false;
SamLine.MAKE_NH_TAG=true;
ambiguousAll=true;
outstream.println("Retaining all best sites for ambiguous mappings.");
}else if(ambigMode==AMBIG_RANDOM){
REMOVE_DUPLICATE_BEST_ALIGNMENTS=false;
BBIndex5.QUIT_AFTER_TWO_PERFECTS=false;
ambiguousRandom=true;
outstream.println("Choosing a site randomly for ambiguous mappings.");
}else if(ambigMode==AMBIG_TOSS){
REMOVE_DUPLICATE_BEST_ALIGNMENTS=true;
BBIndex5.QUIT_AFTER_TWO_PERFECTS=true;
outstream.println("Ambiguously mapped reads will be considered unmapped.");
}else{
throw new RuntimeException("Unknown ambiguous mapping mode: "+ambigMode);
}
}
}
@Override
public void setup(){
assert(!useRandomReads || maxReads>0 || (in1!=null && in1.equals("sequential"))) : "Please specify number of reads to use.";
if(minid!=-1){
MINIMUM_ALIGNMENT_SCORE_RATIO=MSA.minIdToMinRatio(minid, MSA_TYPE);
outstream.println("Set MINIMUM_ALIGNMENT_SCORE_RATIO to "+String.format(Locale.ROOT, "%.3f",MINIMUM_ALIGNMENT_SCORE_RATIO));
}
if(!setxs){SamLine.MAKE_XS_TAG=(SamLine.INTRON_LIMIT<1000000000);}
if(setxs && !setintron){SamLine.INTRON_LIMIT=10;}
if(outFile==null && outFile2==null && outFileM==null && outFileM2==null && outFileU==null && outFileU2==null
&& outFileB==null && outFileB2==null && splitterOutputs==null && BBSplitter.streamTable==null){
outstream.println("No output file.");
OUTPUT_READS=false;
}else{
OUTPUT_READS=true;
if(bamscript!=null){
BBSplitter.makeBamScript(bamscript, splitterOutputs, outFile, outFile2, outFileM, outFileM2, outFileU, outFileU2, outFileB, outFileB2);
}
}
FastaReadInputStream.MIN_READ_LEN=Tools.max(keylen+2, FastaReadInputStream.MIN_READ_LEN);
assert(FastaReadInputStream.settingsOK());
if(build<0){throw new RuntimeException("Must specify a build number, e.g. build=1");}
else{Data.GENOME_BUILD=build;}
if(blacklist!=null && blacklist.size()>0){
Timer t=new Timer();
t.start();
for(String s : blacklist){
Blacklist.addToBlacklist(s);
}
t.stop();
outstream.println("Created blacklist:\t"+t);
t.start();
}
if(ziplevel!=-1){ReadWrite.ZIPLEVEL=ziplevel;}
if(reference!=null){RefToIndex.makeIndex(reference, build, outstream, keylen);}
}
@Override
void processAmbig2(){
assert(Data.scaffoldPrefixes) : "Only process this block if there are multiple references.";
if(BBSplitter.AMBIGUOUS2_MODE==BBSplitter.AMBIGUOUS2_SPLIT){
REMOVE_DUPLICATE_BEST_ALIGNMENTS=false;
BBIndex5.QUIT_AFTER_TWO_PERFECTS=false;
outstream.println("Reads that map to multiple references will be written to special output streams.");
}else if(BBSplitter.AMBIGUOUS2_MODE==BBSplitter.AMBIGUOUS2_FIRST){
REMOVE_DUPLICATE_BEST_ALIGNMENTS=false;
BBIndex5.QUIT_AFTER_TWO_PERFECTS=false;
outstream.println("Reads that map to multiple references will be written to the first reference's stream only.");
}else if(BBSplitter.AMBIGUOUS2_MODE==BBSplitter.AMBIGUOUS2_TOSS){
BBIndex5.QUIT_AFTER_TWO_PERFECTS=true;
outstream.println("Reads that map to multiple references will be considered unmapped.");
}else if(BBSplitter.AMBIGUOUS2_MODE==BBSplitter.AMBIGUOUS2_RANDOM){
REMOVE_DUPLICATE_BEST_ALIGNMENTS=false;
BBIndex5.QUIT_AFTER_TWO_PERFECTS=false;
outstream.println("Reads that map to multiple references will be written to a random stream.");
}else if(BBSplitter.AMBIGUOUS2_MODE==BBSplitter.AMBIGUOUS2_ALL){
REMOVE_DUPLICATE_BEST_ALIGNMENTS=false;
BBIndex5.QUIT_AFTER_TWO_PERFECTS=false;
outstream.println("Reads that map to multiple references will be written to all relevant output streams.");
}else{
BBSplitter.AMBIGUOUS2_MODE=BBSplitter.AMBIGUOUS2_FIRST;
}
}
@Override
void loadIndex(){
Timer t=new Timer();
if(build>-1){
Data.setGenome(build);
AbstractIndex.MINCHROM=1;
AbstractIndex.MAXCHROM=Data.numChroms;
if(minChrom<0){minChrom=1;}
if(maxChrom<0 || maxChrom>Data.numChroms){maxChrom=Data.numChroms;}
outstream.println("Set genome to "+Data.GENOME_BUILD);
if(RefToIndex.AUTO_CHROMBITS){
int maxLength=Tools.max(Data.chromLengths);
RefToIndex.chrombits=Integer.numberOfLeadingZeros(maxLength); //Different for v5!
RefToIndex.chrombits=Tools.min(RefToIndex.chrombits, 16);
}
if(RefToIndex.chrombits!=-1){
BBIndex5.setChromBits(RefToIndex.chrombits);
if(verbose_stats>0){outstream.println("Set CHROMBITS to "+RefToIndex.chrombits);}
}
}
assert(minChrom>=AbstractIndex.MINCHROM && maxChrom<=AbstractIndex.MAXCHROM) :
minChrom+", "+maxChrom+", "+AbstractIndex.MINCHROM+", "+AbstractIndex.MAXCHROM;
AbstractIndex.MINCHROM=minChrom;
AbstractIndex.MAXCHROM=maxChrom;
if(targetGenomeSize>0){
long bases=Data.numDefinedBases;
long x=Tools.max(1, Math.round(0.25f+bases*1d/targetGenomeSize));
BBMapThread5.setExpectedSites((int)x);
outstream.println("Set EXPECTED_SITES to "+x);
}
assert(!(PERFECTMODE && SEMIPERFECTMODE));
if(PERFECTMODE){setPerfectMode();}
if(SEMIPERFECTMODE){setSemiperfectMode();}
//Optional section for discrete timing of chrom array loading
if(SLOW_ALIGN || AbstractIndex.USE_EXTENDED_SCORE || useRandomReads || MAKE_MATCH_STRING){
outstream.println();
if(RefToIndex.chromlist==null){
Data.loadChromosomes(minChrom, maxChrom);
}else{
assert(RefToIndex.chromlist.size()==maxChrom-minChrom+1) : RefToIndex.chromlist.size();
for(ChromosomeArray cha : RefToIndex.chromlist){
Data.chromosomePlusMatrix[cha.chromosome]=cha;
}
}
if(Shared.TRIM_RNAME){Data.trimScaffoldNames();}
t.stop();
outstream.println("Loaded Reference:\t"+t);
t.start();
}
RefToIndex.chromlist=null;
t.start();
BBIndex5.loadIndex(minChrom, maxChrom, keylen, !RefToIndex.NODISK, RefToIndex.NODISK);
{
long len=Data.numDefinedBases;
if(len<300000000){
BBIndex5.MAX_HITS_REDUCTION2+=1;
BBIndex5.MAXIMUM_MAX_HITS_REDUCTION+=1;
if(len<30000000){
BBIndex5.setFractionToExclude(BBIndex5.FRACTION_GENOME_TO_EXCLUDE*0.5f);
BBIndex5.MAXIMUM_MAX_HITS_REDUCTION+=1;
BBIndex5.HIT_REDUCTION_DIV=Tools.max(BBIndex5.HIT_REDUCTION_DIV-1, 3);
}else if(len<100000000){
BBIndex5.setFractionToExclude(BBIndex5.FRACTION_GENOME_TO_EXCLUDE*0.6f);
}else{
BBIndex5.setFractionToExclude(BBIndex5.FRACTION_GENOME_TO_EXCLUDE*0.75f);
}
}
}
t.stop();
outstream.println("Generated Index:\t"+t);
t.start();
if(!SLOW_ALIGN && !AbstractIndex.USE_EXTENDED_SCORE && !useRandomReads && !MAKE_MATCH_STRING){
for(int chrom=minChrom; chrom<=maxChrom; chrom++){
Data.unload(chrom, true);
}
}
if(ReadWrite.countActiveThreads()>0){
ReadWrite.waitForWritingToFinish();
t.stop();
outstream.println("Finished Writing:\t"+t);
t.start();
}
if(coverageBinned!=null || coverageBase!=null || coverageHist!=null || coverageStats!=null || coverageRPKM!=null || normcov!=null || normcovOverall!=null || calcCov){
String[] cvargs=("covhist="+coverageHist+"\tcovstats="+coverageStats+"\tbasecov="+coverageBase+"\tbincov="+coverageBinned+"\tphyscov="+coveragePhysical+
"\t32bit="+cov32bit+"\tnzo="+covNzo+"\ttwocolumn="+covTwocolumn+"\tsecondary="+PRINT_SECONDARY_ALIGNMENTS+"\tcovminscaf="+coverageMinScaf+
"\tksb="+covKsb+"\tbinsize="+covBinSize+"\tk="+covK+"\tstartcov="+covStartOnly+"\tstopcov="+covStopOnly+"\tstrandedcov="+covStranded+"\trpkm="+coverageRPKM+
"\tnormcov="+normcov+"\tnormcovo="+normcovOverall+(in1==null ? "" : "\tin1="+in1)+(in2==null ? "" : "\tin2="+in2)+
(covSetbs ? ("\tbitset="+covBitset+"\tarrays="+covArrays) : "")).split("\t");
pileup=new CoveragePileup(cvargs);
pileup.createDataStructures();
pileup.loadScaffoldsFromIndex(minChrom, maxChrom);
}
if(!forceanalyze && (in1==null || maxReads==0)){return;}
BBIndex5.analyzeIndex(minChrom, maxChrom, BBIndex5.FRACTION_GENOME_TO_EXCLUDE, keylen);
t.stop();
outstream.println("Analyzed Index: \t"+t);
t.start();
if(makeBloomFilter){
String serialPath=RefToIndex.bloomLoc(build);
File serialFile=new File(serialPath);
if(bloomSerial && !RefToIndex.NODISK && serialFile.exists()){
bloomFilter=ReadWrite.read(BloomFilter.class, RefToIndex.bloomLoc(build), true);
t.stop("Loaded Bloom Filter: ");
}else{
if(bloomSerial){System.out.println("Could not read "+serialPath+", generating filter from reference.");}
bloomFilter=new BloomFilter(true, bloomFilterK, bloomFilterK, 1, bloomFilterHashes, bloomFilterMinHits, true);
t.stop("Made Bloom Filter: ");
if(bloomSerial && !RefToIndex.NODISK && !RefToIndex.FORCE_READ_ONLY){
// && serialFile.canWrite()
try {
ReadWrite.writeObjectInThread(bloomFilter, serialPath, true);
outstream.println("Writing Bloom Filter.");
} catch (Throwable e) {
e.printStackTrace();
outstream.println("Can't Write Bloom Filter.");
}
}
}
outstream.println(bloomFilter.filter.toShortString());
t.start();
}
}
@Override
public void testSpeed(String[] args){
if(in1==null || maxReads==0){
outstream.println("No reads to process; quitting.");
return;
}
Timer t=new Timer();
final boolean paired=openStreams(t, args);
if(paired){BBIndex5.QUIT_AFTER_TWO_PERFECTS=false;}
t.start();
if(Shared.USE_JNI){
final int threads=Shared.threads();
adjustThreadsforMemory(105);
if(Shared.threads()<threads*0.9){
outstream.println("Disabling JNI due to low system memory.");
Shared.USE_JNI=false;
Shared.setThreads(threads);
}
}
if(!Shared.USE_JNI){
adjustThreadsforMemory(65);
}
AbstractMapThread.CALC_STATISTICS=CALC_STATISTICS;
AbstractMapThread[] mtts=new AbstractMapThread[Shared.threads()];
for(int i=0; i<mtts.length; i++){
try {
mtts[i]=new BBMapThread5(cris, keylen,
pileup, SLOW_ALIGN, CORRECT_THRESH, minChrom,
maxChrom, keyDensity, maxKeyDensity, minKeyDensity, maxDesiredKeys, REMOVE_DUPLICATE_BEST_ALIGNMENTS,
SAVE_AMBIGUOUS_XY, MINIMUM_ALIGNMENT_SCORE_RATIO, TRIM_LIST, MAKE_MATCH_STRING, QUICK_MATCH_STRINGS, rosA, rosM, rosU, rosB,
SLOW_ALIGN_PADDING, SLOW_RESCUE_PADDING, OUTPUT_MAPPED_ONLY, DONT_OUTPUT_BLACKLISTED_READS, MAX_SITESCORES_TO_PRINT, PRINT_SECONDARY_ALIGNMENTS,
REQUIRE_CORRECT_STRANDS_PAIRS, SAME_STRAND_PAIRS, KILL_BAD_PAIRS, rcompMate,
PERFECTMODE, SEMIPERFECTMODE, FORBID_SELF_MAPPING, TIP_SEARCH_DIST,
ambiguousRandom, ambiguousAll, KFILTER, MIN_IDFILTER, qtrimLeft, qtrimRight, untrim, TRIM_QUALITY, minTrimLength,
LOCAL_ALIGN, RESCUE, STRICT_MAX_INDEL, MSA_TYPE, bloomFilter);
} catch (Exception e) {
e.printStackTrace();
abort(mtts, "Aborting due to prior error.");
}
mtts[i].idmodulo=idmodulo;
if(verbose){
mtts[i].verbose=verbose;
mtts[i].index().verbose=verbose;
}
}
cris.start(); //4567
outstream.println("Processing reads in "+(paired ? "paired" : "single")+"-ended mode.");
outstream.println("Started read stream.");
/* The threads are started after initialization to prevent resource competition between initialization and mapping */
for(int i=0; i<mtts.length; i++){mtts[i].start();}
outstream.println("Started "+mtts.length+" mapping thread"+(mtts.length==1 ? "" : "s")+".");
final int broken=shutDownThreads(mtts, false);
if(printStats){outstream.println("\n\n ------------------ Results ------------------ ");}
closeStreams(cris, rosA, rosM, rosU, rosB);
outstream.println();
if(printSettings){printSettings(keylen);}
printOutput(mtts, t, keylen, paired, false, pileup, scafNzo, sortStats, statsOutputFile);
if(broken>0 || errorState){throw new RuntimeException("BBMap terminated in an error state; the output may be corrupt.");}
}
@Override
void setSemiperfectMode() {
assert(SEMIPERFECTMODE);
if(SEMIPERFECTMODE){
TRIM_LIST=false;
keyDensity/=2;
maxKeyDensity/=2;
minKeyDensity=1.1f;
maxDesiredKeys/=2;
MINIMUM_ALIGNMENT_SCORE_RATIO=0.45f;
BBIndex5.setSemiperfectMode();
}
}
@Override
void setPerfectMode() {
assert(PERFECTMODE);
if(PERFECTMODE){
TRIM_LIST=false;
keyDensity/=2;
maxKeyDensity/=2;
minKeyDensity=1.1f;
maxDesiredKeys/=2;
MINIMUM_ALIGNMENT_SCORE_RATIO=1.0f;
BBIndex5.setPerfectMode();
}
}
@Override
void printSettings(int k){
printSettings0(k, BBIndex5.MAX_INDEL, MINIMUM_ALIGNMENT_SCORE_RATIO);
if(verbose_stats>=2){
outstream.println("Key Density: \t"+keyDensity+" ("+minKeyDensity+" ~ "+maxKeyDensity+")");
outstream.println("Max keys: \t"+maxDesiredKeys);
outstream.println("Block Subsections: \t"+BBIndex5.CHROMS_PER_BLOCK);
outstream.println("Fraction To Remove: \t"+String.format(Locale.ROOT, "%.4f", (BBIndex5.REMOVE_FREQUENT_GENOME_FRACTION ? BBIndex5.FRACTION_GENOME_TO_EXCLUDE : 0)));
// sysout.println("ADD_SCORE_Z: \t"+Index5.ADD_SCORE_Z);
outstream.println("Hits To Keep: \t"+BBIndex5.MIN_APPROX_HITS_TO_KEEP);
}
if(verbose_stats>=3){
outstream.println("Remove Clumpy: \t"+BBIndex5.REMOVE_CLUMPY);
if(BBIndex5.REMOVE_CLUMPY){
outstream.println("CLUMPY_MAX_DIST: \t"+BBIndex5.CLUMPY_MAX_DIST);
outstream.println("CLUMPY_MIN_LENGTH: \t"+BBIndex5.CLUMPY_MIN_LENGTH_INDEX);
outstream.println("CLUMPY_FRACTION: \t"+BBIndex5.CLUMPY_FRACTION);
}
outstream.println("Remove Long Lists: \t"+BBIndex5.TRIM_LONG_HIT_LISTS);
if(BBIndex5.TRIM_LONG_HIT_LISTS){
outstream.println("HIT_FRACTION_TO_RETAIN:\t"+BBIndex5.HIT_FRACTION_TO_RETAIN);
}
outstream.println("Trim By Greedy: \t"+BBIndex5.TRIM_BY_GREEDY);
outstream.println("Trim By Total Sites: \t"+BBIndex5.TRIM_BY_TOTAL_SITE_COUNT);
if(BBIndex5.TRIM_BY_TOTAL_SITE_COUNT){
outstream.println("MAX_AVG_SITES: \t"+BBIndex5.MAX_AVERAGE_LIST_TO_SEARCH);
outstream.println("MAX_AVG_SITES_2: \t"+BBIndex5.MAX_AVERAGE_LIST_TO_SEARCH2);
outstream.println("MAX_SHORTEST_SITE: \t"+BBIndex5.MAX_SHORTEST_LIST_TO_SEARCH);
}
outstream.println("Index Min Score: \t"+BBIndex5.MIN_SCORE_MULT);
outstream.println("Dynamic Trim: \t"+BBIndex5.DYNAMICALLY_TRIM_LOW_SCORES);
if(BBIndex5.DYNAMICALLY_TRIM_LOW_SCORES){
outstream.println("DYNAMIC_SCORE_THRESH: \t"+BBIndex5.DYNAMIC_SCORE_THRESH);
}
}
}
}
|