diff options
author | Alexandre Mestiashvili <alex@biotec.tu-dresden.de> | 2013-01-11 11:19:10 +0100 |
---|---|---|
committer | Alexandre Mestiashvili <alex@biotec.tu-dresden.de> | 2013-01-11 11:19:10 +0100 |
commit | 2507f33d9874eb98ecc841c9a6e3d0ab1feb1a04 (patch) | |
tree | 66e5b726a1d87990ec652c547149a1bcca34011b | |
parent | 6795cc21e62f2dce3ac02beae06bdb8f73559232 (diff) |
Imported Upstream version 2.0.5
133 files changed, 512 insertions, 322 deletions
@@ -1,4 +1,4 @@ -Ben Langmead <blangmea@jhsph.edu> wrote Bowtie 2, which is based partially on +Ben Langmead <langmea@cs.jhu.edu> wrote Bowtie 2, which is based partially on Bowtie. Bowtie was written by Ben Langmead and Cole Trapnell. Bowtie & Bowtie 2: http://bowtie-bio.sf.net diff --git a/MANUAL.markdown b/MANUAL.markdown index b802ab7..95438d6 100644 --- a/MANUAL.markdown +++ b/MANUAL.markdown @@ -400,7 +400,8 @@ instance, when seeking [structural variants]. The expected relative orientation of the mates is set using the [`--ff`], [`--fr`], or [`--rf`] options. The expected range of inter-mates distances (as measured from the furthest extremes of the mates; also called "outer distance") -is set with the [`-I`] and [`-X`] options. +is set with the [`-I`] and [`-X`] options. Note that setting [`-I`] and [`-X`] +far apart makes Bowtie 2 slower. See documentation for [`-I`] and [`-X`]. To declare that a pair aligns discordantly, Bowtie 2 requires that both mates align uniquely. This is a conservative threshold, but this is often desirable @@ -1520,7 +1521,15 @@ specified and a paired-end alignment consists of two 20-bp alignments in the appropriate orientation with a 20-bp gap between them, that alignment is considered valid (as long as [`-X`] is also satisfied). A 19-bp gap would not be valid in that case. If trimming options [`-3`] or [`-5`] are also used, the -[`-I`] constraint is applied with respect to the untrimmed mates. Default: 0. +[`-I`] constraint is applied with respect to the untrimmed mates. + +The larger the difference between [`-I`] and [`-X`], the slower Bowtie 2 will +run. This is because larger differences bewteen [`-I`] and [`-X`] require that +Bowtie 2 scan a larger window to determine if a concordant alignment exists. +For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very +efficient. + +Default: 0 (essentially imposing no minimum) </td></tr> <tr><td id="bowtie2-options-X"> @@ -1538,7 +1547,15 @@ proper orientation with a 60-bp gap between them, that alignment is considered valid (as long as [`-I`] is also satisfied). A 61-bp gap would not be valid in that case. If trimming options [`-3`] or [`-5`] are also used, the `-X` constraint is applied with respect to the untrimmed mates, not the trimmed -mates. Default: 500. +mates. + +The larger the difference between [`-I`] and [`-X`], the slower Bowtie 2 will +run. This is because larger differences bewteen [`-I`] and [`-X`] require that +Bowtie 2 scan a larger window to determine if a concordant alignment exists. +For typical fragment length ranges (200 to 400 nucleotides), Bowtie 2 is very +efficient. + +Default: 500. </td></tr> <tr><td id="bowtie2-options-fr"> @@ -1,5 +1,5 @@ # -# Copyright 2011, Ben Langmead <blangmea@jhsph.edu> +# Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> # # This file is part of Bowtie 2. # @@ -76,9 +76,6 @@ PTHREAD_LIB = -lpthread endif endif -PREFETCH_LOCALITY = 2 -PREF_DEF = -DPREFETCH_LOCALITY=$(PREFETCH_LOCALITY) - LIBS = SEARCH_LIBS = $(PTHREAD_LIB) BUILD_LIBS = @@ -97,6 +94,7 @@ SEARCH_CPPS = qual.cpp pat.cpp sam.cpp \ pe.cpp aln_sink.cpp dp_framer.cpp \ scoring.cpp presets.cpp unique.cpp \ simple_func.cpp \ + random_util.cpp \ aligner_bt.cpp sse_util.cpp \ aligner_swsse.cpp outq.cpp \ aligner_swsse_loc_i16.cpp \ @@ -154,7 +152,7 @@ GENERAL_LIST = $(wildcard scripts/*.sh) \ $(PTHREAD_PKG) \ bowtie2 \ AUTHORS \ - COPYING \ + LICENSE \ NEWS \ MANUAL \ MANUAL.markdown \ @@ -307,6 +305,7 @@ doc/manual.html: MANUAL.markdown --css style.css -o $@ \ --from markdown --to HTML \ --table-of-contents $^ + rm -f .tmp.head MANUAL: MANUAL.markdown perl doc/strip_markdown.pl < $^ > $@ @@ -3,8 +3,8 @@ Bowtie 2 NEWS Bowtie 2 is now available for download from the project website, http://bowtie-bio.sf.net/bowtie2. 2.0.0-beta1 is the first version released to -the public and 2.0.4 is the latest version. Bowtie 2 is licensed under -the GPLv3 license. See `COPYING' file for details. +the public and 2.0.5 is the latest version. Bowtie 2 is licensed under +the GPLv3 license. See `LICENSE' file for details. Reporting Issues ================ @@ -16,6 +16,19 @@ Please report any issues using the Sourceforge bug tracker: Version Release History ======================= +Version 2.0.5 - January 4, 2013 + * Fixed an issue that would cause excessive memory allocation when aligning + to very repetitive genomes. + * Fixed an issue that would cause a pseudo-randomness-related assert to be + thrown in debug mode under rare circumstances. + * When bowtie2-build fails, it will now delete index files created so far so + that invalid index files don't linger. + * Tokenizer no longer has limit of 10,000 tokens, which was a problem for + users trying to index a very large number of FASTA files. + * Updated manual's discussion of the -I and -X options to mention that + setting them farther apart makes Bowtie 2 slower. + * Renamed COPYING to LICENSE and created a README to be GitHub-friendly. + Version 2.0.4 - December 17, 2012 * Fixed issue whereby --un, --al, --un-conc and --al-conc options would incorrectly suppress SAM output. @@ -1 +1 @@ -2.0.4
\ No newline at end of file +2.0.5
\ No newline at end of file diff --git a/aligner_bt.cpp b/aligner_bt.cpp index 4ed1240..6247dd4 100644 --- a/aligner_bt.cpp +++ b/aligner_bt.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_bt.h b/aligner_bt.h index 2043d46..8056b7a 100644 --- a/aligner_bt.h +++ b/aligner_bt.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_cache.cpp b/aligner_cache.cpp index 0023b86..2bec5e0 100644 --- a/aligner_cache.cpp +++ b/aligner_cache.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_cache.h b/aligner_cache.h index 30df0c7..e29d355 100644 --- a/aligner_cache.h +++ b/aligner_cache.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_driver.cpp b/aligner_driver.cpp index 24bfca2..e4227d6 100644 --- a/aligner_driver.cpp +++ b/aligner_driver.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2012, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_driver.h b/aligner_driver.h index 25ebfe4..4dd7345 100644 --- a/aligner_driver.h +++ b/aligner_driver.h @@ -1,5 +1,5 @@ /* - * Copyright 2012, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2012, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_metrics.h b/aligner_metrics.h index 9bd8bb7..c0b0182 100644 --- a/aligner_metrics.h +++ b/aligner_metrics.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_report.h b/aligner_report.h index 73dccc0..6262f46 100644 --- a/aligner_report.h +++ b/aligner_report.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_result.cpp b/aligner_result.cpp index 49f9a81..a03abb6 100644 --- a/aligner_result.cpp +++ b/aligner_result.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_result.h b/aligner_result.h index 74455b1..a5b08ab 100644 --- a/aligner_result.h +++ b/aligner_result.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_seed.cpp b/aligner_seed.cpp index e628f2e..5dd122e 100644 --- a/aligner_seed.cpp +++ b/aligner_seed.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_seed.h b/aligner_seed.h index baf7cd5..1baaad6 100644 --- a/aligner_seed.h +++ b/aligner_seed.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_seed2.cpp b/aligner_seed2.cpp index 4e546b6..58415bc 100644 --- a/aligner_seed2.cpp +++ b/aligner_seed2.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_seed2.h b/aligner_seed2.h index cde3e4c..0b095ca 100644 --- a/aligner_seed2.h +++ b/aligner_seed2.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_seed_policy.cpp b/aligner_seed_policy.cpp index df7d660..495f3ef 100644 --- a/aligner_seed_policy.cpp +++ b/aligner_seed_policy.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -38,7 +38,7 @@ static int parseFuncType(const std::string& otype) { } else if(type == "G" || type == "Log") { return SIMPLE_FUNC_LOG; } - std::cerr << "Error: Bad function type '" << otype + std::cerr << "Error: Bad function type '" << otype.c_str() << "'. Should be C (constant), L (linear), " << "S (square root) or G (natural log)." << std::endl; throw 1; @@ -325,7 +325,7 @@ void SeedAlignmentPolicy::parseString( if(etoks.size() != 2) { cerr << "Error parsing alignment policy setting " << setting << "; must be bisected by = sign" << endl - << "Policy: " << s << endl; + << "Policy: " << s.c_str() << endl; assert(false); throw 1; } // LHS is tag, RHS value @@ -340,14 +340,14 @@ void SeedAlignmentPolicy::parseString( if(ctoks.size() == 0) { cerr << "Error parsing alignment policy setting " << setting << "; RHS must have at least 1 token" << endl - << "Policy: " << s << endl; + << "Policy: " << s.c_str() << endl; assert(false); throw 1; } for(size_t i = 0; i < ctoks.size(); i++) { if(ctoks[i].length() == 0) { cerr << "Error parsing alignment policy setting " << setting << "; token " << i+1 << " on RHS had length=0" << endl - << "Policy: " << s << endl; + << "Policy: " << s.c_str() << endl; assert(false); throw 1; } } @@ -357,7 +357,7 @@ void SeedAlignmentPolicy::parseString( if(ctoks.size() != 1) { cerr << "Error parsing alignment policy setting " << setting << "; RHS must have 1 token" << endl - << "Policy: " << s << endl; + << "Policy: " << s.c_str() << endl; assert(false); throw 1; } string tmp = ctoks[0]; @@ -373,9 +373,9 @@ void SeedAlignmentPolicy::parseString( else if(tag == "MMP") { if(ctoks.size() > 3) { cerr << "Error parsing alignment policy setting " - << "'" << tag << "'" + << "'" << tag.c_str() << "'" << "; RHS must have at most 3 tokens" << endl - << "Policy: '" << s << "'" << endl; + << "Policy: '" << s.c_str() << "'" << endl; assert(false); throw 1; } if(ctoks[0][0] == 'C') { @@ -414,9 +414,9 @@ void SeedAlignmentPolicy::parseString( penMmcType = COST_MODEL_ROUNDED_QUAL; } else { cerr << "Error parsing alignment policy setting " - << "'" << tag << "'" + << "'" << tag.c_str() << "'" << "; RHS must start with C, Q or R" << endl - << "Policy: '" << s << "'" << endl; + << "Policy: '" << s.c_str() << "'" << endl; assert(false); throw 1; } } @@ -429,9 +429,9 @@ void SeedAlignmentPolicy::parseString( else if(tag == "NP") { if(ctoks.size() != 1) { cerr << "Error parsing alignment policy setting " - << "'" << tag << "'" + << "'" << tag.c_str() << "'" << "; RHS must have 1 token" << endl - << "Policy: '" << s << "'" << endl; + << "Policy: '" << s.c_str() << "'" << endl; assert(false); throw 1; } if(ctoks[0][0] == 'C') { @@ -449,9 +449,9 @@ void SeedAlignmentPolicy::parseString( penNType = COST_MODEL_ROUNDED_QUAL; } else { cerr << "Error parsing alignment policy setting " - << "'" << tag << "'" + << "'" << tag.c_str() << "'" << "; RHS must start with C, Q or R" << endl - << "Policy: '" << s << "'" << endl; + << "Policy: '" << s.c_str() << "'" << endl; assert(false); throw 1; } } @@ -536,9 +536,9 @@ void SeedAlignmentPolicy::parseString( else if(tag == "SEED") { if(ctoks.size() > 2) { cerr << "Error parsing alignment policy setting " - << "'" << tag << "'; RHS must have 1 or 2 tokens, " + << "'" << tag.c_str() << "'; RHS must have 1 or 2 tokens, " << "had " << ctoks.size() << ". " - << "Policy: '" << s << "'" << endl; + << "Policy: '" << s.c_str() << "'" << endl; assert(false); throw 1; } if(ctoks.size() >= 1) { @@ -563,9 +563,9 @@ void SeedAlignmentPolicy::parseString( else if(tag == "SEEDLEN") { if(ctoks.size() > 1) { cerr << "Error parsing alignment policy setting " - << "'" << tag << "'; RHS must have 1 token, " + << "'" << tag.c_str() << "'; RHS must have 1 token, " << "had " << ctoks.size() << ". " - << "Policy: '" << s << "'" << endl; + << "Policy: '" << s.c_str() << "'" << endl; assert(false); throw 1; } if(ctoks.size() >= 1) { @@ -576,9 +576,9 @@ void SeedAlignmentPolicy::parseString( else if(tag == "DPS") { if(ctoks.size() > 1) { cerr << "Error parsing alignment policy setting " - << "'" << tag << "'; RHS must have 1 token, " + << "'" << tag.c_str() << "'; RHS must have 1 token, " << "had " << ctoks.size() << ". " - << "Policy: '" << s << "'" << endl; + << "Policy: '" << s.c_str() << "'" << endl; assert(false); throw 1; } if(ctoks.size() >= 1) { @@ -589,9 +589,9 @@ void SeedAlignmentPolicy::parseString( else if(tag == "ROUNDS") { if(ctoks.size() > 1) { cerr << "Error parsing alignment policy setting " - << "'" << tag << "'; RHS must have 1 token, " + << "'" << tag.c_str() << "'; RHS must have 1 token, " << "had " << ctoks.size() << ". " - << "Policy: '" << s << "'" << endl; + << "Policy: '" << s.c_str() << "'" << endl; assert(false); throw 1; } if(ctoks.size() >= 1) { @@ -624,8 +624,8 @@ void SeedAlignmentPolicy::parseString( else { // Unknown tag cerr << "Unexpected alignment policy setting " - << "'" << tag << "'" << endl - << "Policy: '" << s << "'" << endl; + << "'" << tag.c_str() << "'" << endl + << "Policy: '" << s.c_str() << "'" << endl; assert(false); throw 1; } } diff --git a/aligner_seed_policy.h b/aligner_seed_policy.h index 4287e88..7bdaab7 100644 --- a/aligner_seed_policy.h +++ b/aligner_seed_policy.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_sw.cpp b/aligner_sw.cpp index 5747b3d..ea3b178 100644 --- a/aligner_sw.cpp +++ b/aligner_sw.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_sw.h b/aligner_sw.h index 0d1a484..1e2c48f 100644 --- a/aligner_sw.h +++ b/aligner_sw.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_sw_common.h b/aligner_sw_common.h index c0d9bd3..14582bc 100644 --- a/aligner_sw_common.h +++ b/aligner_sw_common.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_sw_driver.cpp b/aligner_sw_driver.cpp index d194398..2d0c7b0 100644 --- a/aligner_sw_driver.cpp +++ b/aligner_sw_driver.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_sw_driver.h b/aligner_sw_driver.h index 346c5a7..ad9438b 100644 --- a/aligner_sw_driver.h +++ b/aligner_sw_driver.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -234,17 +234,19 @@ public: double rd = rnd.nextFloat() * mass_; double mass_sofar = 0.0f; size_t sz = masses_.size(); + size_t last_unelim = std::numeric_limits<size_t>::max(); for(size_t i = 0; i < sz; i++) { if(!elim_[i]) { + last_unelim = i; mass_sofar += masses_[i]; - if(rd < mass_sofar || i == sz - 1) { + if(rd < mass_sofar) { // This is the one we hit return i; } } } - assert(false); - return 0; + assert_neq(std::numeric_limits<size_t>::max(), last_unelim); + return last_unelim; } protected: diff --git a/aligner_sw_nuc.h b/aligner_sw_nuc.h index ecca06c..6bec1de 100644 --- a/aligner_sw_nuc.h +++ b/aligner_sw_nuc.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_swsse.cpp b/aligner_swsse.cpp index 702ca36..d4f7d78 100644 --- a/aligner_swsse.cpp +++ b/aligner_swsse.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_swsse.h b/aligner_swsse.h index 6e17a6c..f99f97f 100644 --- a/aligner_swsse.h +++ b/aligner_swsse.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_swsse_ee_i16.cpp b/aligner_swsse_ee_i16.cpp index 6afaae0..f5796a4 100644 --- a/aligner_swsse_ee_i16.cpp +++ b/aligner_swsse_ee_i16.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_swsse_ee_u8.cpp b/aligner_swsse_ee_u8.cpp index 9146792..0060a3d 100644 --- a/aligner_swsse_ee_u8.cpp +++ b/aligner_swsse_ee_u8.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_swsse_loc_i16.cpp b/aligner_swsse_loc_i16.cpp index eddf28b..1887bd5 100644 --- a/aligner_swsse_loc_i16.cpp +++ b/aligner_swsse_loc_i16.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aligner_swsse_loc_u8.cpp b/aligner_swsse_loc_u8.cpp index 5d81501..71da4ec 100644 --- a/aligner_swsse_loc_u8.cpp +++ b/aligner_swsse_loc_u8.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/aln_sink.cpp b/aln_sink.cpp index 23ca1da..13183fe 100644 --- a/aln_sink.cpp +++ b/aln_sink.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -657,6 +657,7 @@ void AlnSinkWrap::finishRead( RandomSource& rnd, // pseudo-random generator ReportingMetrics& met, // reporting metrics const PerReadMetrics& prm, // per-read metrics + const Scoring& sc, // scoring scheme bool suppressSeedSummary, // = true bool suppressAlignments) // = false { @@ -766,6 +767,7 @@ void AlnSinkWrap::finishRead( assert(!select1_.empty()); g_.reportHits( obuf_, + staln_, threadid_, rd1_, rd2_, @@ -781,7 +783,8 @@ void AlnSinkWrap::finishRead( &flags1, &flags2, prm, - mapq_); + mapq_, + sc); if(pairMax) { met.nconcord_rep++; } else { @@ -855,6 +858,7 @@ void AlnSinkWrap::finishRead( assert(!select1_.empty()); g_.reportHits( obuf_, + staln_, threadid_, rd1_, rd2_, @@ -870,7 +874,8 @@ void AlnSinkWrap::finishRead( &flags1, &flags2, prm, - mapq_); + mapq_, + sc); met.nconcord_0++; met.ndiscord++; init_ = false; @@ -1066,6 +1071,7 @@ void AlnSinkWrap::finishRead( assert(!select1_.empty()); g_.reportHits( obuf_, + staln_, threadid_, rd1_, repRs2 != NULL ? rd2_ : NULL, @@ -1081,7 +1087,8 @@ void AlnSinkWrap::finishRead( &flags1, repRs2 != NULL ? &flags2 : NULL, prm, - mapq_); + mapq_, + sc); assert_lt(select1_[0], rs1u_.size()); refid = rs1u_[select1_[0]].refid(); refoff = rs1u_[select1_[0]].refoff(); @@ -1095,6 +1102,7 @@ void AlnSinkWrap::finishRead( assert(!select2_.empty()); g_.reportHits( obuf_, + staln_, threadid_, rd2_, repRs1 != NULL ? rd1_ : NULL, @@ -1110,7 +1118,8 @@ void AlnSinkWrap::finishRead( &flags2, repRs1 != NULL ? &flags1 : NULL, prm, - mapq_); + mapq_, + sc); assert_lt(select2_[0], rs2u_.size()); refid = rs2u_[select2_[0]].refid(); refoff = rs2u_[select2_[0]].refoff(); @@ -1147,6 +1156,7 @@ void AlnSinkWrap::finishRead( (repRs2 != NULL) ? repRs2->fw() : false); // opp fw g_.reportUnaligned( obuf_, // string to write output to + staln_, threadid_, rd1_, // read 1 NULL, // read 2 @@ -1156,8 +1166,9 @@ void AlnSinkWrap::finishRead( ssm2, &flags1, // flags 1 NULL, // flags 2 - prm, + prm, // per-read metrics mapq_, // MAPQ calculator + sc, // scoring scheme true); // get lock? } if(rd2_ != NULL && nunpair2 == 0) { @@ -1191,6 +1202,7 @@ void AlnSinkWrap::finishRead( (repRs1 != NULL) ? repRs1->fw() : false); // opp fw g_.reportUnaligned( obuf_, // string to write output to + staln_, threadid_, rd2_, // read 1 NULL, // read 2 @@ -1200,13 +1212,13 @@ void AlnSinkWrap::finishRead( ssm2, &flags2, // flags 1 NULL, // flags 2 - prm, + prm, // per-read metrics mapq_, // MAPQ calculator + sc, // scoring scheme true); // get lock? } } // if(suppress alignments) init_ = false; - //g_.outq().finishRead(obuf_, rdid_, threadid_); return; } @@ -1234,7 +1246,6 @@ bool AlnSinkWrap::report( bool one = (rs1 != NULL); const AlnRes* rsa = one ? rs1 : rs2; const AlnRes* rsb = one ? rs2 : rs1; - //assert(!st_.done()); if(paired) { assert(readIsPair()); st_.foundConcordant(); @@ -1291,8 +1302,6 @@ bool AlnSinkWrap::prepareDiscordants() { assert(rs2_.empty()); rs1_.push_back(rs1u_[0]); rs2_.push_back(rs2u_[0]); - //rs1u_.clear(); - //rs2u_.clear(); return true; } return false; @@ -1626,6 +1635,7 @@ void AlnSink::appendSeedSummary( */ void AlnSinkSam::appendMate( BTString& o, // append to this string + StackedAln& staln, // store stacked alignment struct here const Read& rd, const Read* rdo, const TReadId rdid, @@ -1636,15 +1646,16 @@ void AlnSinkSam::appendMate( const SeedAlSumm& ssmo, const AlnFlags& flags, const PerReadMetrics& prm, - const Mapq& mapqCalc) + const Mapq& mapqCalc, + const Scoring& sc) { if(rs == NULL && samc_.omitUnalignedReads()) { return; } char buf[1024]; char mapqInps[1024]; - StackedAln staln; if(rs != NULL) { + staln.reset(); rs->initStacked(rd, staln); staln.leftAlign(false /* not past MMs */); } @@ -1833,6 +1844,7 @@ void AlnSinkSam::appendMate( summ, // summary of alignments for this read ssm, // seed alignment summary prm, // per-read metrics + sc, // scoring scheme mapqInps); // inputs to MAPQ calculation } else { samc_.printEmptyOptFlags( @@ -1842,7 +1854,8 @@ void AlnSinkSam::appendMate( flags, // alignment flags summ, // summary of alignments for this read ssm, // seed alignment summary - prm); // per-read metrics + prm, // per-read metrics + sc); // scoring scheme } o.append('\n'); } @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -622,6 +622,7 @@ public: */ virtual void append( BTString& o, + StackedAln& staln, size_t threadId, const Read *rd1, const Read *rd2, @@ -635,6 +636,7 @@ public: const AlnFlags* flags2, const PerReadMetrics& prm, const Mapq& mapq, + const Scoring& sc, bool report2) = 0; /** @@ -649,6 +651,7 @@ public: */ virtual void reportHits( BTString& o, // write to this buffer + StackedAln& staln, // StackedAln to write stacked alignment size_t threadId, // which thread am I? const Read *rd1, // mate #1 const Read *rd2, // mate #2 @@ -665,6 +668,7 @@ public: const AlnFlags* flags2, // flags for mate #2 const PerReadMetrics& prm, // per-read metrics const Mapq& mapq, // MAPQ generator + const Scoring& sc, // scoring scheme bool getLock = true) // true iff lock held by caller { // There are a few scenarios: @@ -696,27 +700,27 @@ public: assert_gt(select2->size(), 0); AlnRes* r1pri = ((rs1 != NULL) ? &rs1->get(select1[0]) : NULL); AlnRes* r2pri = ((rs2 != NULL) ? &rs2->get((*select2)[0]) : NULL); - append(o, threadId, rd1, rd2, rdid, r1pri, r2pri, summ, ssm1, ssm2, - flags1, flags2, prm, mapq, true); + append(o, staln, threadId, rd1, rd2, rdid, r1pri, r2pri, summ, + ssm1, ssm2, flags1, flags2, prm, mapq, sc, true); flagscp1.setPrimary(false); flagscp2.setPrimary(false); for(size_t i = 1; i < select1.size(); i++) { AlnRes* r1 = ((rs1 != NULL) ? &rs1->get(select1[i]) : NULL); - append(o, threadId, rd1, rd2, rdid, r1, r2pri, summ, - ssm1, ssm2, flags1, flags2, prm, mapq, false); + append(o, staln, threadId, rd1, rd2, rdid, r1, r2pri, summ, + ssm1, ssm2, flags1, flags2, prm, mapq, sc, false); } for(size_t i = 1; i < select2->size(); i++) { AlnRes* r2 = ((rs2 != NULL) ? &rs2->get((*select2)[i]) : NULL); - append(o, threadId, rd2, rd1, rdid, r2, r1pri, summ, - ssm2, ssm1, flags2, flags1, prm, mapq, false); + append(o, staln, threadId, rd2, rd1, rdid, r2, r1pri, summ, + ssm2, ssm1, flags2, flags1, prm, mapq, sc, false); } } else { // Handle cases 1-4 for(size_t i = 0; i < select1.size(); i++) { AlnRes* r1 = ((rs1 != NULL) ? &rs1->get(select1[i]) : NULL); AlnRes* r2 = ((rs2 != NULL) ? &rs2->get(select1[i]) : NULL); - append(o, threadId, rd1, rd2, rdid, r1, r2, summ, - ssm1, ssm2, flags1, flags2, prm, mapq, true); + append(o, staln, threadId, rd1, rd2, rdid, r1, r2, summ, + ssm1, ssm2, flags1, flags2, prm, mapq, sc, true); if(flags1 != NULL) { flagscp1.setPrimary(false); } @@ -733,6 +737,7 @@ public: */ virtual void reportUnaligned( BTString& o, // write to this string + StackedAln& staln, // StackedAln to write stacked alignment size_t threadId, // which thread am I? const Read *rd1, // mate #1 const Read *rd2, // mate #2 @@ -744,11 +749,12 @@ public: const AlnFlags* flags2, // flags for mate #2 const PerReadMetrics& prm, // per-read metrics const Mapq& mapq, // MAPQ calculator + const Scoring& sc, // scoring scheme bool report2, // report alns for both mates? bool getLock = true) // true iff lock held by caller { - append(o, threadId, rd1, rd2, rdid, NULL, NULL, summ, - ssm1, ssm2, flags1, flags2, prm, mapq, report2); + append(o, staln, threadId, rd1, rd2, rdid, NULL, NULL, summ, + ssm1, ssm2, flags1, flags2, prm, mapq, sc, report2); } /** @@ -1026,6 +1032,7 @@ public: RandomSource& rnd, // pseudo-random generator ReportingMetrics& met, // reporting metrics const PerReadMetrics& prm, // per-read metrics + const Scoring& sc, // scoring scheme bool suppressSeedSummary = true, bool suppressAlignments = false); @@ -1258,6 +1265,7 @@ protected: EList<std::pair<TAlScore, size_t> > selectBuf_; BTString obuf_; + StackedAln staln_; }; /** @@ -1294,6 +1302,7 @@ public: */ virtual void append( BTString& o, // write output to this string + StackedAln& staln, // StackedAln to write stacked alignment size_t threadId, // which thread am I? const Read* rd1, // mate #1 const Read* rd2, // mate #2 @@ -1307,18 +1316,19 @@ public: const AlnFlags* flags2, // flags for mate #2 const PerReadMetrics& prm, // per-read metrics const Mapq& mapq, // MAPQ calculator + const Scoring& sc, // scoring scheme bool report2) // report alns for both mates { assert(rd1 != NULL || rd2 != NULL); if(rd1 != NULL) { assert(flags1 != NULL); - appendMate(o, *rd1, rd2, rdid, rs1, rs2, summ, ssm1, ssm2, - *flags1, prm, mapq); + appendMate(o, staln, *rd1, rd2, rdid, rs1, rs2, summ, ssm1, ssm2, + *flags1, prm, mapq, sc); } if(rd2 != NULL && report2) { assert(flags2 != NULL); - appendMate(o, *rd2, rd1, rdid, rs2, rs1, summ, ssm2, ssm1, - *flags2, prm, mapq); + appendMate(o, staln, *rd2, rd1, rdid, rs2, rs1, summ, ssm2, ssm1, + *flags2, prm, mapq, sc); } } @@ -1331,6 +1341,7 @@ protected: */ void appendMate( BTString& o, + StackedAln& staln, const Read& rd, const Read* rdo, const TReadId rdid, @@ -1341,7 +1352,8 @@ protected: const SeedAlSumm& ssmo, const AlnFlags& flags, const PerReadMetrics& prm, // per-read metrics - const Mapq& mapq); // MAPQ calculator + const Mapq& mapq, // MAPQ calculator + const Scoring& sc); // scoring scheme const SamConfig& samc_; // settings & routines for SAM output BTDnaString dseq_; // buffer for decoded read sequence diff --git a/alphabet.cpp b/alphabet.cpp index 23b5fc2..7613557 100644 --- a/alphabet.cpp +++ b/alphabet.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/assert_helpers.h b/assert_helpers.h index 6b3ce95..688181a 100644 --- a/assert_helpers.h +++ b/assert_helpers.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/binary_sa_search.h b/binary_sa_search.h index 1832932..25ceea0 100644 --- a/binary_sa_search.h +++ b/binary_sa_search.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/blockwise_sa.h b/blockwise_sa.h index 0c2bf9a..d819d23 100644 --- a/blockwise_sa.h +++ b/blockwise_sa.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -164,7 +164,7 @@ protected: /// Optionally output a verbose message void verbose(const string& s) const { if(this->verbose()) { - this->log() << s; + this->log() << s.c_str(); this->log().flush(); } } @@ -1,7 +1,7 @@ #!/usr/bin/env perl # -# Copyright 2011, Ben Langmead <blangmea@jhsph.edu> +# Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> # # This file is part of Bowtie 2. # @@ -34,6 +34,19 @@ use Getopt::Long; use FindBin qw($Bin); use POSIX; +my %signo = (); +my @signame = (); +{ + # Get signal info + use Config; + my $i = 0; + for my $name (split(' ', $Config{sig_name})) { + $signo{$name} = $i; + $signame[$i] = $name; + $i++; + } +} + (-x "$Bin/bowtie2-align.exe") || (-x "$Bin/bowtie2-align") || die "Error: Expected bowtie2 to be in same directory with bowtie2-align:\n$Bin"; @@ -441,4 +454,18 @@ if(defined($cap_out)) { $ret = system($cmd); } if(!$keep) { for(@to_delete) { unlink($_); } } + +if ($ret == -1) { + print STDERR "Failed to execute bowtie2-align: $!\n"; + exit 1; +} elsif ($ret & 127) { + my $signm = "(unknown)"; + $signm = $signame[$ret & 127] if defined($signame[$ret & 127]); + my $ad = ""; + $ad = "(core dumped)" if (($ret & 128) != 0); + printf STDERR "bowtie2-align died with signal %d (%s) $ad\n", ($ret & 127), $signm; + exit 1; +} elsif($ret != 0) { + printf STDERR "bowtie2-align exited with value %d\n", $ret >> 8; +} exit $ret >> 8; diff --git a/bowtie_build_main.cpp b/bowtie_build_main.cpp index 6a15bae..03228c7 100644 --- a/bowtie_build_main.cpp +++ b/bowtie_build_main.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/bowtie_main.cpp b/bowtie_main.cpp index fa4f8c4..844c8ca 100644 --- a/bowtie_main.cpp +++ b/bowtie_main.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/bt2_build.cpp b/bt2_build.cpp index 52f8b4d..cca4246 100644 --- a/bt2_build.cpp +++ b/bt2_build.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -50,7 +50,6 @@ static int noDc; static int entireSA; static int seed; static int showVersion; -static bool doubleEbwt; // Ebwt parameters static int32_t lineRate; static int32_t linesPerSide; @@ -63,7 +62,6 @@ static bool packed; static bool writeRef; static bool justRef; static bool reverseEach; -bool color; static void resetOptions() { verbose = true; // be talkative (default) @@ -77,7 +75,6 @@ static void resetOptions() { entireSA = 0; // 1 = disable blockwise SA seed = 0; // srandom seed showVersion = 0; // just print version and quit? - doubleEbwt = true; // build forward and reverse Ebwts // Ebwt parameters lineRate = 6; // a "line" is 64 bytes linesPerSide = 1; // 1 64-byte line on a side @@ -89,7 +86,6 @@ static void resetOptions() { packed = false; // writeRef = true; // write compact reference to .3.bt2/.4.bt2 justRef = false; // *just* write compact reference, don't index - color = false; reverseEach = false; } @@ -111,7 +107,7 @@ enum { * Print a detailed usage message to the provided output stream. */ static void printUsage(ostream& out) { - out << "Bowtie 2 version " << string(BOWTIE2_VERSION) << " by Ben Langmead (blangmea@jhsph.edu)" << endl; + out << "Bowtie 2 version " << string(BOWTIE2_VERSION).c_str() << " by Ben Langmead (langmea@cs.jhu.edu, www.cs.jhu.edu/~langmea)" << endl; out << "Usage: bowtie2-build [options]* <reference_in> <bt2_index_base>" << endl << " reference_in comma-separated list of files with ref sequences" << endl << " bt2_index_base write .bt2 data to files with this dir/basename" << endl @@ -284,6 +280,25 @@ static void parseOptions(int argc, const char **argv) { } } +EList<string> filesWritten; + +/** + * Delete all the index files that we tried to create. For when we had to + * abort the index-building process due to an error. + */ +static void deleteIdxFiles( + const string& outfile, + bool doRef, + bool justRef) +{ + + for(size_t i = 0; i < filesWritten.size(); i++) { + cerr << "Deleting \"" << filesWritten[i].c_str() + << "\" file written during aborted indexing attempt." << endl; + remove(filesWritten[i].c_str()); + } +} + /** * Drive the index construction process and optionally sanity-check the * result. @@ -298,13 +313,13 @@ static void driver( { EList<FileBuf*> is(MISC_CAT); bool bisulfite = false; - RefReadInParams refparams(color, reverse, nsToAs, bisulfite); + RefReadInParams refparams(false, reverse, nsToAs, bisulfite); assert_gt(infiles.size(), 0); if(format == CMDLINE) { // Adapt sequence strings to stringstreams open for input stringstream *ss = new stringstream(); for(size_t i = 0; i < infiles.size(); i++) { - (*ss) << ">" << i << endl << infiles[i] << endl; + (*ss) << ">" << i << endl << infiles[i].c_str() << endl; } FileBuf *fb = new FileBuf(ss); assert(fb != NULL); @@ -318,13 +333,13 @@ static void driver( for(size_t i = 0; i < infiles.size(); i++) { FILE *f = fopen(infiles[i].c_str(), "r"); if (f == NULL) { - cerr << "Error: could not open "<< infiles[i] << endl; + cerr << "Error: could not open "<< infiles[i].c_str() << endl; throw 1; } FileBuf *fb = new FileBuf(f); assert(fb != NULL); if(fb->peek() == -1 || fb->eof()) { - cerr << "Warning: Empty fasta file: '" << infile << "'" << endl; + cerr << "Warning: Empty fasta file: '" << infile.c_str() << "'" << endl; continue; } assert(!fb->eof()); @@ -347,6 +362,8 @@ static void driver( if(verbose) cout << "Reading reference sizes" << endl; Timer _t(cout, " Time reading reference sizes: ", verbose); if(!reverse && (writeRef || justRef)) { + filesWritten.push_back(outfile + ".3.bt2"); + filesWritten.push_back(outfile + ".4.bt2"); sztot = BitPairReference::szsFromFasta(is, outfile, bigEndian, refparams, szs, sanityCheck); } else { sztot = BitPairReference::szsFromFasta(is, string(), bigEndian, refparams, szs, sanityCheck); @@ -357,10 +374,12 @@ static void driver( assert_gt(sztot.second, 0); assert_gt(szs.size(), 0); // Construct index from input strings and parameters + filesWritten.push_back(outfile + ".1.bt2"); + filesWritten.push_back(outfile + ".2.bt2"); Ebwt ebwt( TStr(), packed, - refparams.color ? 1 : 0, + 0, 1, // TODO: maybe not? lineRate, offRate, // suffix-array sampling rate @@ -392,7 +411,7 @@ static void driver( // multiple texts, what we'll get back is the joined, // padded string, not a list) ebwt.loadIntoMemory( - refparams.color ? 1 : 0, + 0, reverse ? (refparams.reverse == REF_READ_REVERSE) : 0, true, // load SA sample? true, // load ftab? @@ -432,6 +451,7 @@ extern "C" { * main function. Parses command-line arguments. */ int bowtie_build(int argc, const char **argv) { + string outfile; try { // Reset all global state, including getopt state opterr = optind = 1; @@ -439,12 +459,11 @@ int bowtie_build(int argc, const char **argv) { string infile; EList<string> infiles(MISC_CAT); - string outfile; parseOptions(argc, argv); argv0 = argv[0]; if(showVersion) { - cout << argv0 << " version " << string(BOWTIE2_VERSION) << endl; + cout << argv0 << " version " << string(BOWTIE2_VERSION).c_str() << endl; if(sizeof(void*) == 4) { cout << "32-bit" << endl; } else if(sizeof(void*) == 8) { @@ -490,7 +509,7 @@ int bowtie_build(int argc, const char **argv) { // Optionally summarize if(verbose) { cout << "Settings:" << endl - << " Output files: \"" << outfile << ".*.bt2\"" << endl + << " Output files: \"" << outfile.c_str() << ".*.bt2\"" << endl << " Line rate: " << lineRate << " (line is " << (1<<lineRate) << " bytes)" << endl << " Lines per side: " << linesPerSide << " (side is " << ((1<<lineRate)*linesPerSide) << " bytes)" << endl << " Offset rate: " << offRate << " (one in " << (1<<offRate) << ")" << endl @@ -523,9 +542,9 @@ int bowtie_build(int argc, const char **argv) { #endif cout << " Random seed: " << seed << endl; cout << " Sizeofs: void*:" << sizeof(void*) << ", int:" << sizeof(int) << ", long:" << sizeof(long) << ", size_t:" << sizeof(size_t) << endl; - cout << "Input files DNA, " << file_format_names[format] << ":" << endl; + cout << "Input files DNA, " << file_format_names[format].c_str() << ":" << endl; for(size_t i = 0; i < infiles.size(); i++) { - cout << " " << infiles[i] << endl; + cout << " " << infiles[i].c_str() << endl; } } // Seed random number generator @@ -549,24 +568,22 @@ int bowtie_build(int argc, const char **argv) { } } int reverseType = reverseEach ? REF_READ_REVERSE_EACH : REF_READ_REVERSE; - if(doubleEbwt) { - srand(seed); - Timer timer(cout, "Total time for backward call to driver() for mirror index: ", verbose); - if(!packed) { - try { - driver<SString<char> >(infile, infiles, outfile + ".rev", false, reverseType); - } catch(bad_alloc& e) { - if(autoMem) { - cerr << "Switching to a packed string representation." << endl; - packed = true; - } else { - throw e; - } + srand(seed); + Timer timer(cout, "Total time for backward call to driver() for mirror index: ", verbose); + if(!packed) { + try { + driver<SString<char> >(infile, infiles, outfile + ".rev", false, reverseType); + } catch(bad_alloc& e) { + if(autoMem) { + cerr << "Switching to a packed string representation." << endl; + packed = true; + } else { + throw e; } } - if(packed) { - driver<S2bDnaString>(infile, infiles, outfile + ".rev", true, reverseType); - } + } + if(packed) { + driver<S2bDnaString>(infile, infiles, outfile + ".rev", true, reverseType); } return 0; } catch(std::exception& e) { @@ -574,6 +591,7 @@ int bowtie_build(int argc, const char **argv) { cerr << "Command: "; for(int i = 0; i < argc; i++) cerr << argv[i] << " "; cerr << endl; + deleteIdxFiles(outfile, writeRef || justRef, justRef); return 1; } catch(int e) { if(e != 0) { @@ -582,6 +600,7 @@ int bowtie_build(int argc, const char **argv) { for(int i = 0; i < argc; i++) cerr << argv[i] << " "; cerr << endl; } + deleteIdxFiles(outfile, writeRef || justRef, justRef); return e; } } diff --git a/bt2_idx.cpp b/bt2_idx.cpp index 80ba7f4..284d910 100644 --- a/bt2_idx.cpp +++ b/bt2_idx.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -265,14 +265,14 @@ string adjustEbwtBase(const string& cmdline, { string str = ebwtFileBase; ifstream in; - if(verbose) cout << "Trying " << str << endl; + if(verbose) cout << "Trying " << str.c_str() << endl; in.open((str + ".1.bt2").c_str(), ios_base::in | ios::binary); if(!in.is_open()) { if(verbose) cout << " didn't work" << endl; in.close(); if(getenv("BOWTIE2_INDEXES") != NULL) { str = string(getenv("BOWTIE2_INDEXES")) + "/" + ebwtFileBase; - if(verbose) cout << "Trying " << str << endl; + if(verbose) cout << "Trying " << str.c_str() << endl; in.open((str + ".1.bt2").c_str(), ios_base::in | ios::binary); if(!in.is_open()) { if(verbose) cout << " didn't work" << endl; @@ -283,7 +283,7 @@ string adjustEbwtBase(const string& cmdline, } } if(!in.is_open()) { - cerr << "Could not locate a Bowtie index corresponding to basename \"" << ebwtFileBase << "\"" << endl; + cerr << "Could not locate a Bowtie index corresponding to basename \"" << ebwtFileBase.c_str() << "\"" << endl; throw 1; } return str; @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -58,11 +58,6 @@ using namespace std; #define EBWT_EXT ".bt2" -#ifndef PREFETCH_LOCALITY -// No locality by default -#define PREFETCH_LOCALITY 2 -#endif - // From ccnt_lut.cpp, automatically generated by gen_lookup_tables.pl extern uint8_t cCntLUT_4[4][4][256]; @@ -602,14 +597,14 @@ public: // Open output files ofstream fout1(_in1Str.c_str(), ios::binary); if(!fout1.good()) { - cerr << "Could not open index file for writing: \"" << _in1Str << "\"" << endl + cerr << "Could not open index file for writing: \"" << _in1Str.c_str() << "\"" << endl << "Please make sure the directory exists and that permissions allow writing by" << endl << "Bowtie." << endl; throw 1; } ofstream fout2(_in2Str.c_str(), ios::binary); if(!fout2.good()) { - cerr << "Could not open index file for writing: \"" << _in2Str << "\"" << endl + cerr << "Could not open index file for writing: \"" << _in2Str.c_str() << "\"" << endl << "Please make sure the directory exists and that permissions allow writing by" << endl << "Bowtie." << endl; throw 1; @@ -632,21 +627,21 @@ public: // Close output files fout1.flush(); int64_t tellpSz1 = (int64_t)fout1.tellp(); - VMSG_NL("Wrote " << fout1.tellp() << " bytes to primary EBWT file: " << _in1Str); + VMSG_NL("Wrote " << fout1.tellp() << " bytes to primary EBWT file: " << _in1Str.c_str()); fout1.close(); bool err = false; if(tellpSz1 > fileSize(_in1Str.c_str())) { err = true; - cerr << "Index is corrupt: File size for " << _in1Str << " should have been " << tellpSz1 + cerr << "Index is corrupt: File size for " << _in1Str.c_str() << " should have been " << tellpSz1 << " but is actually " << fileSize(_in1Str.c_str()) << "." << endl; } fout2.flush(); int64_t tellpSz2 = (int64_t)fout2.tellp(); - VMSG_NL("Wrote " << fout2.tellp() << " bytes to secondary EBWT file: " << _in2Str); + VMSG_NL("Wrote " << fout2.tellp() << " bytes to secondary EBWT file: " << _in2Str.c_str()); fout2.close(); if(tellpSz2 > fileSize(_in2Str.c_str())) { err = true; - cerr << "Index is corrupt: File size for " << _in2Str << " should have been " << tellpSz2 + cerr << "Index is corrupt: File size for " << _in2Str.c_str() << " should have been " << tellpSz2 << " but is actually " << fileSize(_in2Str.c_str()) << "." << endl; } if(err) { @@ -1028,7 +1023,7 @@ public: // Now write reference sequence names on the end assert_eq(this->_refnames.size(), this->_nPat); for(size_t i = 0; i < this->_refnames.size(); i++) { - out1 << this->_refnames[i] << endl; + out1 << this->_refnames[i].c_str() << endl; } out1 << '\0'; out1.flush(); out2.flush(); @@ -2273,7 +2268,7 @@ private: /// debugging) void verbose(const string& s) const { if(this->verbose()) { - this->log() << s; + this->log() << s.c_str(); this->log().flush(); } } diff --git a/bt2_inspect.cpp b/bt2_inspect.cpp index d16a46c..92302c8 100644 --- a/bt2_inspect.cpp +++ b/bt2_inspect.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -62,7 +62,7 @@ static struct option long_options[] = { * Print a summary usage message to the provided output stream. */ static void printUsage(ostream& out) { - out << "Bowtie 2 version " << string(BOWTIE2_VERSION) << " by Ben Langmead (blangmea@jhsph.edu)" << endl; + out << "Bowtie 2 version " << string(BOWTIE2_VERSION).c_str() << " by Ben Langmead (langmea@cs.jhu.edu, www.cs.jhu.edu/~langmea)" << endl; out << "Usage: bowtie2-inspect [options]* <bt2_base>" << endl << " <bt2_base> bt2 filename minus trailing .1.bt2/.2.bt2" << endl @@ -142,19 +142,19 @@ static void print_fasta_record( const string& seq) { fout << ">"; - fout << defline << endl; + fout << defline.c_str() << endl; if(across > 0) { size_t i = 0; while (i + across < seq.length()) { - fout << seq.substr(i, across) << endl; + fout << seq.substr(i, across).c_str() << endl; i += across; } if (i < seq.length()) - fout << seq.substr(i) << endl; + fout << seq.substr(i).c_str() << endl; } else { - fout << seq << endl; + fout << seq.c_str() << endl; } } @@ -174,7 +174,7 @@ static void print_ref_sequence( int myacross = across > 0 ? across : 60; size_t incr = myacross * 1000; uint32_t *buf = new uint32_t[(incr + 128)/4]; - fout << ">" << name << "\n"; + fout << ">" << name.c_str() << "\n"; ASSERT_ONLY(SStringExpandable<uint32_t> destU32); for(size_t i = 0; i < len; i += incr) { size_t amt = min(incr, len-i); @@ -299,7 +299,7 @@ static void print_index_sequence_names(const string& fname, ostream& fout) EList<string> p_refnames; readEbwtRefnames(fname, p_refnames); for(size_t i = 0; i < p_refnames.size(); i++) { - cout << p_refnames[i] << endl; + cout << p_refnames[i].c_str() << endl; } } @@ -343,7 +343,7 @@ static void print_index_summary( assert_eq(ebwt.nPat(), p_refnames.size()); for(size_t i = 0; i < p_refnames.size(); i++) { cout << "Sequence-" << (i+1) - << '\t' << p_refnames[i] + << '\t' << p_refnames[i].c_str() << '\t' << (ebwt.plen()[i] + (color ? 1 : 0)) << endl; } @@ -451,8 +451,8 @@ int main(int argc, char **argv) { // Optionally summarize if(verbose) { - cout << "Input ebwt file: \"" << ebwtFile << "\"" << endl; - cout << "Output file: \"" << outfile << "\"" << endl; + cout << "Input ebwt file: \"" << ebwtFile.c_str() << "\"" << endl; + cout << "Output file: \"" << outfile.c_str() << "\"" << endl; cout << "Local endianness: " << (currentlyBigEndian()? "big":"little") << endl; #ifdef NDEBUG cout << "Assertions: disabled" << endl; @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -60,32 +60,32 @@ void Ebwt::readIntoMemory( // Initialize our primary and secondary input-stream fields if(_in1 != -1) close(_in1); if(_verbose || startVerbose) { - cerr << "Opening \"" << _in1Str << "\"" << endl; + cerr << "Opening \"" << _in1Str.c_str() << "\"" << endl; } if((_in1 = open(_in1Str.c_str(), O_RDONLY)) < 0) { - cerr << "Could not open index file " << _in1Str << endl; + cerr << "Could not open index file " << _in1Str.c_str() << endl; } if(loadSASamp) { if(_in2 != -1) close(_in2); if(_verbose || startVerbose) { - cerr << "Opening \"" << _in2Str << "\"" << endl; + cerr << "Opening \"" << _in2Str.c_str() << "\"" << endl; } if((_in2 = open(_in2Str.c_str(), O_RDONLY)) < 0) { - cerr << "Could not open index file " << _in2Str << endl; + cerr << "Could not open index file " << _in2Str.c_str() << endl; } } #else // Initialize our primary and secondary input-stream fields if(_in1 != NULL) fclose(_in1); - if(_verbose || startVerbose) cerr << "Opening \"" << _in1Str << "\"" << endl; + if(_verbose || startVerbose) cerr << "Opening \"" << _in1Str.c_str() << "\"" << endl; if((_in1 = fopen(_in1Str.c_str(), "rb")) == NULL) { - cerr << "Could not open index file " << _in1Str << endl; + cerr << "Could not open index file " << _in1Str.c_str() << endl; } if(loadSASamp) { if(_in2 != NULL) fclose(_in2); - if(_verbose || startVerbose) cerr << "Opening \"" << _in2Str << "\"" << endl; + if(_verbose || startVerbose) cerr << "Opening \"" << _in2Str.c_str() << "\"" << endl; if((_in2 = fopen(_in2Str.c_str(), "rb")) == NULL) { - cerr << "Could not open index file " << _in2Str << endl; + cerr << "Could not open index file " << _in2Str.c_str() << endl; } } #endif diff --git a/bt2_search.cpp b/bt2_search.cpp index c2a3dc3..d5fa9b6 100644 --- a/bt2_search.cpp +++ b/bt2_search.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -124,6 +124,7 @@ static bool samNoSQ; // don't print @SQ header lines static bool sam_print_as; static bool sam_print_xs; // XS:i static bool sam_print_xss; // Xs:i and Ys:i +static bool sam_print_yn; // YN:i and Yn:i static bool sam_print_xn; static bool sam_print_cs; static bool sam_print_cq; @@ -309,6 +310,7 @@ static void resetOptions() { sam_print_as = true; sam_print_xs = true; sam_print_xss = false; // Xs:i and Ys:i + sam_print_yn = false; // YN:i and Yn:i sam_print_xn = true; sam_print_cs = false; sam_print_cq = false; @@ -649,13 +651,13 @@ static void printArgDesc(ostream& out) { * Print a summary usage message to the provided output stream. */ static void printUsage(ostream& out) { - out << "Bowtie 2 version " << string(BOWTIE2_VERSION) << " by Ben Langmead (langmea@cs.jhu.edu, www.cs.jhu.edu/~langmea)" << endl; + out << "Bowtie 2 version " << string(BOWTIE2_VERSION).c_str() << " by Ben Langmead (langmea@cs.jhu.edu, www.cs.jhu.edu/~langmea)" << endl; string tool_name = "bowtie2-align"; if(wrapper == "basic-0") { tool_name = "bowtie2"; } out << "Usage: " << endl - << " " << tool_name << " [options]* -x <bt2-idx> {-1 <m1> -2 <m2> | -U <r>} [-S <sam>]" << endl + << " " << tool_name.c_str() << " [options]* -x <bt2-idx> {-1 <m1> -2 <m2> | -U <r>} [-S <sam>]" << endl << endl << " <bt2-idx> Index filename prefix (minus trailing .X.bt2)." << endl << " NOTE: Bowtie 1 and Bowtie 2 indexes are not compatible." << endl @@ -882,7 +884,7 @@ static string applyPreset(const string& sorig, Presets& presets) { s.replace(found, strlen("%LOCAL%"), localAlign ? "-local" : ""); } if(gVerbose) { - cerr << "Applying preset: '" << s << "' using preset menu '" + cerr << "Applying preset: '" << s.c_str() << "' using preset menu '" << presets.name() << "'" << endl; } string pol; @@ -1157,6 +1159,7 @@ static void parseOption(int next_option, const char *arg) { sam_print_zu = true; sam_print_xp = true; sam_print_xss = true; + sam_print_yn = true; break; } case ARG_SHOW_RAND_SEED: { @@ -1458,7 +1461,7 @@ static void parseOptions(int argc, const char **argv) { polstr = polstr.substr(1); } if(gVerbose) { - cerr << "Final policy string: '" << polstr << "'" << endl; + cerr << "Final policy string: '" << polstr.c_str() << "'" << endl; } size_t failStreakTmp = 0; SeedAlignmentPolicy::parseString( @@ -1540,7 +1543,7 @@ static void parseOptions(int argc, const char **argv) { for(size_t i = 0; i < mates1.size(); i++) { for(size_t j = 0; j < mates2.size(); j++) { if(mates1[i] == mates2[j] && !gQuiet) { - cerr << "Warning: Same mate file \"" << mates1[i] << "\" appears as argument to both -1 and -2" << endl; + cerr << "Warning: Same mate file \"" << mates1[i].c_str() << "\" appears as argument to both -1 and -2" << endl; } } } @@ -2474,7 +2477,7 @@ struct PerfMetrics { if(o != NULL) { o->writeChars(buf); } if(o != NULL) { o->write('\n'); } - if(metricsStderr) cerr << stderrSs.str() << endl; + if(metricsStderr) cerr << stderrSs.str().c_str() << endl; if(!total) mergeIncrementals(); } @@ -2565,7 +2568,7 @@ static inline void printMmsSkipMsg( << "' because length (" << (mate1 ? ps.bufa().patFw.length() : ps.bufb().patFw.length()) << ") <= # seed mismatches (" << seedmms << ")" << endl; } - cerr << os.str(); + cerr << os.str().c_str(); } static inline void printLenSkipMsg( @@ -2582,7 +2585,7 @@ static inline void printLenSkipMsg( os << "Warning: skipping read '" << (mate1 ? ps.bufa().name : ps.bufb().name) << "' because it was < 2 characters long" << endl; } - cerr << os.str(); + cerr << os.str().c_str(); } static inline void printLocalScoreMsg( @@ -2601,7 +2604,7 @@ static inline void printLocalScoreMsg( << "--local mode for read '" << (mate1 ? ps.bufa().name : ps.bufb().name) << "; setting to 0 instead" << endl; } - cerr << os.str(); + cerr << os.str().c_str(); } static inline void printEEScoreMsg( @@ -2620,7 +2623,7 @@ static inline void printEEScoreMsg( << "--end-to-end mode for read '" << (mate1 ? ps.bufa().name : ps.bufb().name) << "; setting to 0 instead" << endl; } - cerr << os.str(); + cerr << os.str().c_str(); } /** @@ -3748,6 +3751,7 @@ static void* multiseedSearchWorker(void *vp) { rnd, // pseudo-random generator rpm, // reporting metrics prm, // per-read metrics + sc, // scoring scheme !seedSumm, // suppress seed summaries? seedSumm); // suppress alignments? assert(!retry || msinkwrap.empty()); @@ -4091,6 +4095,7 @@ static void* multiseedSearchWorker_2p5(void *vp) { rnd, // pseudo-random generator rpm, // reporting metrics prm, // per-read metrics + sc, // scoring scheme !seedSumm, // suppress seed summaries? seedSumm); // suppress alignments? } // if(rdid >= skipReads && rdid < qUpto) @@ -4387,6 +4392,7 @@ static void driver( sam_print_as, sam_print_xs, sam_print_xss, + sam_print_yn, sam_print_xn, sam_print_cs, sam_print_cq, @@ -4570,7 +4576,7 @@ int bowtie(int argc, const char **argv) { // Get output filename if(optind < argc && outfile.empty()) { outfile = argv[optind++]; - cerr << "Warning: Output file '" << outfile + cerr << "Warning: Output file '" << outfile.c_str() << "' was specified without -S. This will not work in " << "future Bowtie 2 versions. Please use -S instead." << endl; @@ -4593,16 +4599,16 @@ int bowtie(int argc, const char **argv) { // Optionally summarize if(gVerbose) { - cout << "Input bt2 file: \"" << bt2index << "\"" << endl; - cout << "Query inputs (DNA, " << file_format_names[format] << "):" << endl; + cout << "Input bt2 file: \"" << bt2index.c_str() << "\"" << endl; + cout << "Query inputs (DNA, " << file_format_names[format].c_str() << "):" << endl; for(size_t i = 0; i < queries.size(); i++) { - cout << " " << queries[i] << endl; + cout << " " << queries[i].c_str() << endl; } cout << "Quality inputs:" << endl; for(size_t i = 0; i < qualities.size(); i++) { - cout << " " << qualities[i] << endl; + cout << " " << qualities[i].c_str() << endl; } - cout << "Output file: \"" << outfile << "\"" << endl; + cout << "Output file: \"" << outfile.c_str() << "\"" << endl; cout << "Local endianness: " << (currentlyBigEndian()? "big":"little") << endl; cout << "Sanity checking: " << (sanityCheck? "enabled":"disabled") << endl; #ifdef NDEBUG diff --git a/bt2_util.cpp b/bt2_util.cpp index e421d5d..51327d7 100644 --- a/bt2_util.cpp +++ b/bt2_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/ccnt_lut.cpp b/ccnt_lut.cpp index 6141fd8..9422449 100644 --- a/ccnt_lut.cpp +++ b/ccnt_lut.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/diff_sample.cpp b/diff_sample.cpp index 91a7ad0..b722702 100644 --- a/diff_sample.cpp +++ b/diff_sample.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/diff_sample.h b/diff_sample.h index c057e37..66b0b17 100644 --- a/diff_sample.h +++ b/diff_sample.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -530,7 +530,7 @@ private: void verbose(const string& s) const { if(this->verbose()) { - this->log() << s; + this->log() << s.c_str(); this->log().flush(); } } diff --git a/dp_framer.cpp b/dp_framer.cpp index eee67f4..d7e359a 100644 --- a/dp_framer.cpp +++ b/dp_framer.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/dp_framer.h b/dp_framer.h index 045da01..4209f41 100644 --- a/dp_framer.h +++ b/dp_framer.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -21,6 +21,32 @@ MemoryTally gMemTally; +/** + * Tally a memory allocation of size amt bytes. + */ +void MemoryTally::add(int cat, uint64_t amt) { + ThreadSafe ts(&lock_); + tots_[cat] += amt; + tot_ += amt; + if(tots_[cat] > peaks_[cat]) { + peaks_[cat] = tots_[cat]; + } + if(tot_ > peak_) { + peak_ = tot_; + } +} + +/** + * Tally a memory free of size amt bytes. + */ +void MemoryTally::del(int cat, uint64_t amt) { + ThreadSafe ts(&lock_); + assert_geq(tots_[cat], amt); + assert_geq(tot_, amt); + tots_[cat] -= amt; + tot_ -= amt; +} + #ifdef MAIN_DS #include <limits> @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -46,28 +46,12 @@ public: /** * Tally a memory allocation of size amt bytes. */ - void add(int cat, uint64_t amt) { - ThreadSafe ts(&lock_); - tots_[cat] += amt; - tot_ += amt; - if(tots_[cat] > peaks_[cat]) { - peaks_[cat] = tots_[cat]; - } - if(tot_ > peak_) { - peak_ = tot_; - } - } + void add(int cat, uint64_t amt); /** * Tally a memory free of size amt bytes. */ - void del(int cat, uint64_t amt) { - ThreadSafe ts(&lock_); - assert_geq(tots_[cat], amt); - assert_geq(tot_, amt); - tots_[cat] -= amt; - tot_ -= amt; - } + void del(int cat, uint64_t amt); /** * Return the total amount of memory allocated. @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/endian_swap.h b/endian_swap.h index f7039be..e5626ff 100644 --- a/endian_swap.h +++ b/endian_swap.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/example/reads/simulate.pl b/example/reads/simulate.pl index 53294e9..0f09f32 100644 --- a/example/reads/simulate.pl +++ b/example/reads/simulate.pl @@ -1,7 +1,7 @@ #!/usr/bin/env perl ## -# Copyright 2011, Ben Langmead <blangmea@jhsph.edu> +# Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> # # This file is part of Bowtie 2. # @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -533,7 +533,7 @@ public: { out_ = fopen(out.c_str(), binary ? "wb" : "w"); if(out_ == NULL) { - std::cerr << "Error: Could not open alignment output file " << out << std::endl; + std::cerr << "Error: Could not open alignment output file " << out.c_str() << std::endl; throw 1; } } @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/group_walk.cpp b/group_walk.cpp index e50f865..4abb1de 100644 --- a/group_walk.cpp +++ b/group_walk.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/group_walk.h b/group_walk.h index d8cfe40..fc215fb 100644 --- a/group_walk.h +++ b/group_walk.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/ival_list.cpp b/ival_list.cpp index 18ccf08..acbe460 100644 --- a/ival_list.cpp +++ b/ival_list.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/ival_list.h b/ival_list.h index e8dff17..354e585 100644 --- a/ival_list.h +++ b/ival_list.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/multikey_qsort.cpp b/multikey_qsort.cpp index 9ff1f24..36fdd7d 100644 --- a/multikey_qsort.cpp +++ b/multikey_qsort.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/multikey_qsort.h b/multikey_qsort.h index 4566820..4b69942 100644 --- a/multikey_qsort.h +++ b/multikey_qsort.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -922,7 +922,7 @@ protected: in = stdin; } else if((in = fopen(infiles_[filecur_].c_str(), "rb")) == NULL) { if(!errs_[filecur_]) { - cerr << "Warning: Could not open read file \"" << infiles_[filecur_] << "\" for reading; skipping..." << endl; + cerr << "Warning: Could not open read file \"" << infiles_[filecur_].c_str() << "\" for reading; skipping..." << endl; errs_[filecur_] = true; } filecur_++; @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/presets.cpp b/presets.cpp index 5507395..9fef89c 100644 --- a/presets.cpp +++ b/presets.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -82,6 +82,6 @@ void PresetsV0::apply( policy += ";IVAL=S,1,0.50"; } else { - cerr << "Unknown preset: " << preset << endl; + cerr << "Unknown preset: " << preset.c_str() << endl; } } @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/random_source.cpp b/random_source.cpp index c5eb0f3..0311f91 100644 --- a/random_source.cpp +++ b/random_source.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/random_source.h b/random_source.h index 755fcce..9304d98 100644 --- a/random_source.h +++ b/random_source.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/random_util.cpp b/random_util.cpp new file mode 100644 index 0000000..2c5ed7d --- /dev/null +++ b/random_util.cpp @@ -0,0 +1,24 @@ +/* + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> + * + * This file is part of Bowtie 2. + * + * Bowtie 2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Bowtie 2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Bowtie 2. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "random_util.h" + +const size_t Random1toN::SWAPLIST_THRESH = 128; +const size_t Random1toN::CONVERSION_THRESH = 16; +const float Random1toN::CONVERSION_FRAC = 0.10f; diff --git a/random_util.h b/random_util.h index 7f4823e..39f8c04 100644 --- a/random_util.h +++ b/random_util.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -20,6 +20,7 @@ #ifndef RANDOM_UTIL_H_ #define RANDOM_UTIL_H_ +#include <algorithm> #include "random_source.h" #include "ds.h" @@ -37,18 +38,24 @@ public: // A set with fewer than this many elements should kick us into swap-list // mode immediately. Otherwise we start in seen-list mode and then // possibly proceed to swap-list mode later. - static const size_t SWAPLIST_THRESH = 128; + static const size_t SWAPLIST_THRESH; - // Convert seen-list to swap-list after this many - static const size_t CONVERSION_THRESH = 16; + // Convert seen-list to swap-list after this many entries in the seen-list. + static const size_t CONVERSION_THRESH; + + // Convert seen-list to swap-list after this (this times n_) many entries + // in the seen-list. + static const float CONVERSION_FRAC; Random1toN(int cat = 0) : sz_(0), n_(0), cur_(0), - list_(SWAPLIST_THRESH, cat), seen_(CONVERSION_THRESH, cat) {} + list_(SWAPLIST_THRESH, cat), seen_(CONVERSION_THRESH, cat), + thresh_(0) {} Random1toN(size_t n, int cat = 0) : sz_(0), n_(n), cur_(0), - list_(SWAPLIST_THRESH, cat), seen_(CONVERSION_THRESH, cat) {} + list_(SWAPLIST_THRESH, cat), seen_(CONVERSION_THRESH, cat), + thresh_(0) {} /** * Initialize the set of pseudo-randoms to be given out without replacement. @@ -60,6 +67,7 @@ public: cur_ = 0; list_.clear(); seen_.clear(); + thresh_ = std::max(CONVERSION_THRESH, (size_t)(CONVERSION_FRAC * n)); } /** @@ -69,6 +77,7 @@ public: void reset() { sz_ = n_ = cur_ = 0; swaplist_ = converted_ = false; list_.clear(); seen_.clear(); + thresh_ = 0; } /** @@ -120,7 +129,8 @@ public: cur_++; assert_leq(cur_, n_); // Move on to using the swap-list? - if(seen_.size() >= CONVERSION_THRESH && cur_ < n_) { + assert_gt(thresh_, 0); + if(seen_.size() >= thresh_ && cur_ < n_) { // Add all elements not already in the seen list to the // swap-list assert(!seen_.empty()); @@ -204,6 +214,8 @@ protected: EList<T> list_; // pseudo-random swapping list EList<T> seen_; // prior to swaplist_ mode, list of // pseudo-randoms given out + size_t thresh_; // conversion threshold for this instantiation, which + // depends both on CONVERSION_THRESH and on n_ }; #endif @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/read_qseq.cpp b/read_qseq.cpp index bc8bf7b..ced6c68 100644 --- a/read_qseq.cpp +++ b/read_qseq.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/ref_coord.cpp b/ref_coord.cpp index c5f3b1c..738c6fa 100644 --- a/ref_coord.cpp +++ b/ref_coord.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/ref_coord.h b/ref_coord.h index 060f1ae..4cd140e 100644 --- a/ref_coord.h +++ b/ref_coord.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/ref_read.cpp b/ref_read.cpp index 1e2b12e..2b97986 100644 --- a/ref_read.cpp +++ b/ref_read.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/reference.cpp b/reference.cpp index 97a74ba..a1dc0c9 100644 --- a/reference.cpp +++ b/reference.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -17,6 +17,7 @@ * along with Bowtie 2. If not, see <http://www.gnu.org/licenses/>. */ +#include <string> #include <string.h> #include "reference.h" #include "mem_ids.h" @@ -52,7 +53,7 @@ BitPairReference::BitPairReference( #ifdef BOWTIE_MM int f3, f4; if((f3 = open(s3.c_str(), O_RDONLY)) < 0) { - cerr << "Could not open reference-string index file " << s3 << " for reading." << endl; + cerr << "Could not open reference-string index file " << s3.c_str() << " for reading." << endl; cerr << "This is most likely because your index was built with an older version" << endl << "(<= 0.9.8.1) of bowtie-build. Please re-run bowtie-build to generate a new" << endl << "index (or download one from the Bowtie website) and try again." << endl; @@ -60,14 +61,14 @@ BitPairReference::BitPairReference( return; } if((f4 = open(s4.c_str(), O_RDONLY)) < 0) { - cerr << "Could not open reference-string index file " << s4 << " for reading." << endl; + cerr << "Could not open reference-string index file " << s4.c_str() << " for reading." << endl; loaded_ = false; return; } char *mmFile = NULL; if(useMm_) { if(verbose_ || startVerbose) { - cerr << " Memory-mapping reference index file " << s4 << ": "; + cerr << " Memory-mapping reference index file " << s4.c_str() << ": "; logTime(cerr); } struct stat sbuf; @@ -128,7 +129,7 @@ BitPairReference::BitPairReference( uint32_t sz; sz = readU32(f3, swap); if(sz == 0) { - cerr << "Error: number of reference records is 0 in " << s3 << endl; + cerr << "Error: number of reference records is 0 in " << s3.c_str() << endl; throw 1; } @@ -193,7 +194,7 @@ BitPairReference::BitPairReference( sanityBuf_ = new uint8_t[cumsz >> 2]; size_t ret = fread(sanityBuf_, 1, cumsz >> 2, ftmp); if(ret != (cumsz >> 2)) { - cerr << "Only read " << ret << " bytes (out of " << (cumsz >> 2) << ") from reference index file " << s4 << endl; + cerr << "Only read " << ret << " bytes (out of " << (cumsz >> 2) << ") from reference index file " << s4.c_str() << endl; throw 1; } fclose(ftmp); @@ -226,7 +227,7 @@ BitPairReference::BitPairReference( // Open the bitpair-encoded reference file FILE *f4 = fopen(s4.c_str(), "rb"); if(f4 == NULL) { - cerr << "Could not open reference-string index file " << s4 << " for reading." << endl; + cerr << "Could not open reference-string index file " << s4.c_str() << " for reading." << endl; cerr << "This is most likely because your index was built with an older version" << endl << "(<= 0.9.8.1) of bowtie-build. Please re-run bowtie-build to generate a new" << endl << "index (or download one from the Bowtie website) and try again." << endl; @@ -237,7 +238,7 @@ BitPairReference::BitPairReference( size_t ret = fread(buf_, 1, cumsz >> 2, f4); // Didn't read all of it? if(ret != (cumsz >> 2)) { - cerr << "Only read " << ret << " bytes (out of " << (cumsz >> 2) << ") from reference index file " << s4 << endl; + cerr << "Only read " << ret << " bytes (out of " << (cumsz >> 2) << ") from reference index file " << s4.c_str() << endl; throw 1; } // Make sure there's no more @@ -593,7 +594,7 @@ BitPairReference::szsFromFasta( // hold the size records. ofstream fout3(file3.c_str(), ios::binary); if(!fout3.good()) { - cerr << "Could not open index file for writing: \"" << file3 << "\"" << endl + cerr << "Could not open index file for writing: \"" << file3.c_str() << "\"" << endl << "Please make sure the directory exists and that permissions allow writing by" << endl << "Bowtie." << endl; throw 1; diff --git a/reference.h b/reference.h index 07b016b..711cff3 100644 --- a/reference.h +++ b/reference.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -120,11 +120,12 @@ void SamConfig::printAlignedOptFlags( bool first, // first opt flag printed is first overall? const Read& rd, // the read AlnRes& res, // individual alignment result - StackedAln& staln, // stacked alignment + StackedAln& staln, // stacked alignment buffer const AlnFlags& flags, // alignment flags const AlnSetSumm& summ, // summary of alignments for this read const SeedAlSumm& ssm, // seed alignment summary const PerReadMetrics& prm, // per-read metrics + const Scoring& sc, // scoring scheme const char *mapqInp) // inputs to MAPQ calculation const { @@ -138,9 +139,9 @@ void SamConfig::printAlignedOptFlags( } if(print_xs_) { // XS:i: Suboptimal alignment score - AlnScore sc = summ.secbestMate(rd.mate < 2); - if(sc.valid()) { - itoa10<TAlScore>(sc.score(), buf); + AlnScore sco = summ.secbestMate(rd.mate < 2); + if(sco.valid()) { + itoa10<TAlScore>(sco.score(), buf); WRITE_SEP(); o.append("XS:i:"); o.append(buf); @@ -232,6 +233,20 @@ void SamConfig::printAlignedOptFlags( o.append("YS:i:"); o.append(buf); } + if(print_yn_) { + // YN:i: Minimum valid score for this mate + TAlScore mn = sc.scoreMin.f<TAlScore>(rd.length()); + itoa10<TAlScore>(mn, buf); + WRITE_SEP(); + o.append("YN:i:"); + o.append(buf); + // Yn:i: Perfect score for this mate + TAlScore pe = sc.perfectScore(rd.length()); + itoa10<TAlScore>(pe, buf); + WRITE_SEP(); + o.append("Yn:i:"); + o.append(buf); + } if(print_xss_) { // Xs:i: Best invalid alignment score of this mate bool one = true; @@ -495,10 +510,25 @@ void SamConfig::printEmptyOptFlags( const AlnFlags& flags, // alignment flags const AlnSetSumm& summ, // summary of alignments for this read const SeedAlSumm& ssm, // seed alignment summary - const PerReadMetrics& prm) // per-read metrics + const PerReadMetrics& prm, // per-read metrics + const Scoring& sc) // scoring scheme const { char buf[1024]; + if(print_yn_) { + // YN:i: Minimum valid score for this mate + TAlScore mn = sc.scoreMin.f<TAlScore>(rd.length()); + itoa10<TAlScore>(mn, buf); + WRITE_SEP(); + o.append("YN:i:"); + o.append(buf); + // Yn:i: Perfect score for this mate + TAlScore pe = sc.perfectScore(rd.length()); + itoa10<TAlScore>(pe, buf); + WRITE_SEP(); + o.append("Yn:i:"); + o.append(buf); + } if(print_zs_) { // ZS:i: Pseudo-random seed for read itoa10<uint32_t>(rd.seed, buf); @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -25,6 +25,7 @@ #include "read.h" #include "util.h" #include "aligner_result.h" +#include "scoring.h" enum { // Comments use language from v1.4-r962 spec @@ -70,6 +71,7 @@ public: bool print_as, bool print_xs, bool print_xss, + bool print_yn, bool print_xn, bool print_cs, bool print_cq, @@ -116,6 +118,7 @@ public: print_as_(print_as), // alignment score of best alignment print_xs_(print_xs), // alignment score of second-best alignment print_xss_(print_xss), + print_yn_(print_yn), // minimum valid score and perfect score print_xn_(print_xn), print_cs_(print_cs), print_cq_(print_cq), @@ -286,6 +289,7 @@ public: const AlnSetSumm& summ, // summary of alignments for this read const SeedAlSumm& ssm, // seed alignment summary const PerReadMetrics& prm, // per-read metics + const Scoring& sc, // scoring scheme const char *mapqInp) // inputs to MAPQ calculation const; @@ -299,7 +303,8 @@ public: const AlnFlags& flags, // alignment flags const AlnSetSumm& summ, // summary of alignments for this read const SeedAlSumm& ssm, // seed alignment summary - const PerReadMetrics& prm) // per-read metrics + const PerReadMetrics& prm, // per-read metrics + const Scoring& sc) // scoring scheme const; /** @@ -337,6 +342,7 @@ protected: bool print_as_; // AS:i: Alignment score generated by aligner bool print_xs_; // XS:i: Suboptimal alignment score bool print_xss_;// Xs:i: Best invalid alignment score found + bool print_yn_; // YN:i:, Yn:i: minimum valid score and perfect score bool print_xn_; // XN:i: Number of ambiguous bases in the referenece // Other optional flags diff --git a/scoring.cpp b/scoring.cpp index 0f80338..1348821 100644 --- a/scoring.cpp +++ b/scoring.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/scripts/convert_quals.pl b/scripts/convert_quals.pl index ba73439..abf344b 100755 --- a/scripts/convert_quals.pl +++ b/scripts/convert_quals.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -# Copyright 2011, Ben Langmead <blangmea@jhsph.edu> +# Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> # # This file is part of Bowtie 2. # diff --git a/scripts/gen_2b_occ_lookup.pl b/scripts/gen_2b_occ_lookup.pl index c9303a2..a6e8ff5 100755 --- a/scripts/gen_2b_occ_lookup.pl +++ b/scripts/gen_2b_occ_lookup.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -# Copyright 2011, Ben Langmead <blangmea@jhsph.edu> +# Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> # # This file is part of Bowtie 2. # diff --git a/scripts/gen_occ_lookup.pl b/scripts/gen_occ_lookup.pl index af6296f..daba33f 100755 --- a/scripts/gen_occ_lookup.pl +++ b/scripts/gen_occ_lookup.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -# Copyright 2011, Ben Langmead <blangmea@jhsph.edu> +# Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> # # This file is part of Bowtie 2. # diff --git a/scripts/gen_solqual_lookup.pl b/scripts/gen_solqual_lookup.pl index 218d364..a1d5cd1 100755 --- a/scripts/gen_solqual_lookup.pl +++ b/scripts/gen_solqual_lookup.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -# Copyright 2011, Ben Langmead <blangmea@jhsph.edu> +# Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> # # This file is part of Bowtie 2. # diff --git a/scripts/infer_fraglen.pl b/scripts/infer_fraglen.pl index 535e84e..65ebe86 100755 --- a/scripts/infer_fraglen.pl +++ b/scripts/infer_fraglen.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # -# Copyright 2011, Ben Langmead <blangmea@jhsph.edu> +# Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> # # This file is part of Bowtie 2. # diff --git a/search_globals.h b/search_globals.h index fbcbb1e..bd2704f 100644 --- a/search_globals.h +++ b/search_globals.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/sequence_io.h b/sequence_io.h index c1129d3..5a2cd6f 100644 --- a/sequence_io.h +++ b/sequence_io.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/simple_func.cpp b/simple_func.cpp index c1edd89..a5b0859 100644 --- a/simple_func.cpp +++ b/simple_func.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -33,7 +33,7 @@ int SimpleFunc::parseType(const std::string& otype) { } else if(type == "G" || type == "Log") { return SIMPLE_FUNC_LOG; } - std::cerr << "Error: Bad function type '" << otype + std::cerr << "Error: Bad function type '" << otype.c_str() << "'. Should be C (constant), L (linear), " << "S (square root) or G (natural log)." << std::endl; throw 1; diff --git a/simple_func.h b/simple_func.h index a69f0a3..ca76869 100644 --- a/simple_func.h +++ b/simple_func.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/sse_util.cpp b/sse_util.cpp index 7e1aa82..d6310cf 100644 --- a/sse_util.cpp +++ b/sse_util.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/sstring.cpp b/sstring.cpp index 7b461c1..3b26587 100644 --- a/sstring.cpp +++ b/sstring.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * diff --git a/threading.h b/threading.h index ce6693b..8890b75 100644 --- a/threading.h +++ b/threading.h @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -58,7 +58,7 @@ public: oss << _msg << setfill ('0') << setw (2) << hours << ":" << setfill ('0') << setw (2) << minutes << ":" << setfill ('0') << setw (2) << seconds << endl; - out << oss.str(); + out << oss.str().c_str(); } private: @@ -81,7 +81,7 @@ static inline void logTime(std::ostream& os, bool nl = true) { << setfill('0') << setw(2) << current->tm_sec; if(nl) oss << std::endl; - os << oss.str(); + os << oss.str().c_str(); } #endif /*TIMER_H_*/ @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -22,6 +22,7 @@ #include <string> #include <sstream> +#include <limits> using namespace std; @@ -30,8 +31,11 @@ using namespace std; * from C++ Programming HOWTO 7.3. */ template<typename T> -static inline void tokenize(const string& s, const string& delims, - T& ss, size_t max = 9999) +static inline void tokenize( + const string& s, + const string& delims, + T& ss, + size_t max = std::numeric_limits<size_t>::max()) { //string::size_type lastPos = s.find_first_not_of(delims, 0); string::size_type lastPos = 0; @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * @@ -1,5 +1,5 @@ /* - * Copyright 2011, Ben Langmead <blangmea@jhsph.edu> + * Copyright 2011, Ben Langmead <langmea@cs.jhu.edu> * * This file is part of Bowtie 2. * |