[med-svn] [Git][med-team/bowtie][upstream] 2 commits: New upstream version 1.3.1+dfsg
Andreas Tille (@tille)
gitlab at salsa.debian.org
Tue Sep 14 06:14:45 BST 2021
Andreas Tille pushed to branch upstream at Debian Med / bowtie
Commits:
f1445fa7 by Andreas Tille at 2021-09-14T06:48:20+02:00
New upstream version 1.3.1+dfsg
- - - - -
9bf01743 by Andreas Tille at 2021-09-14T06:53:39+02:00
New upstream version 1.3.1
- - - - -
23 changed files:
- + .github/workflows/random_tests.yml
- + .github/workflows/simple_tests.yml
- .travis.yml
- Makefile
- NEWS
- VERSION
- bowtie-inspect
- bt2_locks.cpp
- bt2_locks.h
- doc/website/manual.ssi
- doc/website/recent_news.ssi
- doc/website/rhsidebar.ssi
- ebwt.h
- ebwt_search_util.h
- + genomes/.cvsignore
- hit.h
- + mem_ids.h
- multikey_qsort.h
- scripts/bowtie-hbb.sh
- shmem.h
- threading.h
- tinythread.cpp
- util.h
Changes:
=====================================
.github/workflows/random_tests.yml
=====================================
@@ -0,0 +1,53 @@
+name: Run bowtie random tests for all commits to master on Ubuntu and MacOS
+on:
+ push:
+ branches:
+ - 'master'
+ paths:
+ - '**.c'
+ - '**.h'
+ - '**.cpp'
+ - 'bowtie'
+ - 'bowtie-build'
+ - 'bowtie-inspect'
+ - 'Makefile'
+ - 'scripts/test/**'
+ pull_request:
+ branches:
+ - 'master'
+ paths:
+ - '**.c'
+ - '**.h'
+ - '**.cpp'
+ - 'bowtie'
+ - 'bowtie-build'
+ - 'bowtie-inspect'
+ - 'Makefile'
+ - 'scripts/test/**'
+jobs:
+ setup:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out repository code
+ uses: actions/checkout at v2
+ - name: Install zlib development files
+ run: |
+ sudo apt-get update
+ sudo apt-get install zlib1g-dev
+ linux:
+ runs-on: ubuntu-latest
+ needs: setup
+ steps:
+ - uses: actions/checkout at v2
+ - name: Run random tests
+ run: |
+ make allall
+ make random-test
+ macos:
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout at v2
+ - name: Run random tests
+ run: |
+ make allall
+ make random-test
=====================================
.github/workflows/simple_tests.yml
=====================================
@@ -0,0 +1,54 @@
+name: Run bowtie simple tests on Ubuntu and MacOS
+on:
+ push:
+ branches:
+ - 'bug_fixes'
+ - 'master'
+ paths:
+ - '**.c'
+ - '**.h'
+ - '**.cpp'
+ - 'bowtie'
+ - 'bowtie-build'
+ - 'bowtie-inspect'
+ - 'Makefile'
+ - 'scripts/test/**'
+ pull_request:
+ branches:
+ - 'master'
+ paths:
+ - '**.c'
+ - '**.h'
+ - '**.cpp'
+ - 'bowtie'
+ - 'bowtie-build'
+ - 'bowtie-inspect'
+ - 'Makefile'
+ - 'scripts/test/**'
+jobs:
+ setup:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out repository code
+ uses: actions/checkout at v2
+ - name: Install zlib development files
+ run: |
+ sudo apt-get update
+ sudo apt-get install zlib1g-dev
+ linux:
+ runs-on: ubuntu-latest
+ needs: setup
+ steps:
+ - uses: actions/checkout at v2
+ - name: Run simple tests
+ run: |
+ make allall
+ make simple-test
+ macos:
+ runs-on: macos-latest
+ steps:
+ - uses: actions/checkout at v2
+ - name: Run simple tests
+ run: |
+ make allall
+ make simple-test
=====================================
.travis.yml
=====================================
@@ -1,4 +1,4 @@
-dist: xenial
+dist: bionic
language: cpp
sudo: required
branches:
@@ -7,45 +7,6 @@ branches:
- bug_fixes
matrix:
include:
- # Linux (gcc4.9)
- - os: linux
- language: python
- python: "3.4"
- addons:
- apt:
- sources:
- - ubuntu-toolchain-r-test
- packages:
- - g++-4.9
- - zlib1g-dev
- env:
- - CC=gcc-4.9
- - CXX=g++-4.9
- # Linux (gcc8)
- - os: linux
- language: python
- python: "3.8"
- addons:
- apt:
- sources:
- - ubuntu-toolchain-r-test
- packages:
- - g++-8
- - zlib1g-dev
- env:
- - CC=gcc-8
- - CXX=g++-8
- - CXXFLAGS="-fuse-ld=gold"
- # MacOS
- - os: osx
- osx_image: xcode11.2
- compiler: clang
- env:
- - CC=clang
- - CXX=clang++
- - NPROC="$(sysctl -n hw.activecpu)"
- before_install:
- - brew unlink python at 2
# ARM 64-bit
- os: linux
arch: arm64
=====================================
Makefile
=====================================
@@ -7,7 +7,7 @@ bindir = $(prefix)/bin
ARCH = $(shell uname -m)
INC = $(if $(RELEASE_BUILD),-I$(CURDIR)/.include) -I third_party
-LIBS = $(LDFLAGS) $(if $(RELEASE_BUILD),-L$(CURDIR)/.lib) -lz
+LIBS = $(LDFLAGS) $(if $(RELEASE_BUILD),-L$(CURDIR)/.lib) -lz -lpthread
HEADERS = $(wildcard *.h)
BOWTIE_MM = 1
BOWTIE_SHARED_MEM = 1
@@ -65,25 +65,9 @@ SHMEM_DEF =
ifeq (1,$(BOWTIE_SHARED_MEM))
SHMEM_DEF = -DBOWTIE_SHARED_MEM
endif
-PTHREAD_PKG =
-PTHREAD_LIB =
-PTHREAD_DEF =
ifeq (1,$(MINGW))
- PTHREAD_LIB =
override EXTRA_FLAGS += -static-libgcc -static-libstdc++
-else
- PTHREAD_LIB = -lpthread
-endif
-
-ifeq (1,$(NO_SPINLOCK))
- override EXTRA_FLAGS += -DNO_SPINLOCK
-endif
-
-
-LIBS += $(PTHREAD_LIB)
-ifeq (1, $(WITH_TBBMALLOC))
- LIBS += -ltbbmalloc
endif
POPCNT_CAPABILITY ?= 1
@@ -92,7 +76,6 @@ ifeq (aarch64,$(shell uname -m))
endif
ifeq (1, $(POPCNT_CAPABILITY))
override EXTRA_FLAGS += -DPOPCNT_CAPABILITY
- INC += -I third_party
endif
PREFETCH_LOCALITY = 2
@@ -113,15 +96,16 @@ ifeq (1,$(WITH_THREAD_PROFILING))
endif
OTHER_CPPS = ccnt_lut.cpp ref_read.cpp alphabet.cpp shmem.cpp \
- edit.cpp ebwt.cpp
+ edit.cpp ebwt.cpp bt2_locks.cpp
-ifneq (1, $(NO_SPINLOCK))
- OTHER_CPPS += bt2_locks.cpp
+ifeq (1,$(WITH_QUEUELOCK))
+ NO_SPINLOCK = 1
+ override EXTRA_FLAGS += -DWITH_QUEUELOCK
endif
-ifeq (1,$(WITH_QUEUELOCK))
- OTHER_CPPS += bt2_locks.cpp
- override EXTRA_FLAGS += -DWITH_QUEUELOCK=1
+ifeq (1,$(NO_SPINLOCK))
+$(info $(NO_SPINLOCK))
+ override EXTRA_FLAGS += -DNO_SPINLOCK
endif
ifeq (1,$(WITH_FINE_TIMER))
@@ -242,8 +226,8 @@ DEFS=-fno-strict-aliasing \
$(SHMEM_DEF)
ALL_FLAGS = $(EXTRA_FLAGS) $(CFLAGS) $(CXXFLAGS)
-DEBUG_DEFS = -DCOMPILER_OPTIONS="\"$(DEBUG_FLAGS) $(ALL_FLAGS)\""
-RELEASE_DEFS = -DCOMPILER_OPTIONS="\"$(RELEASE_FLAGS) $(ALL_FLAGS)\""
+DEBUG_DEFS = -DCOMPILER_OPTIONS="\"$(DEBUG_FLAGS) $(EXTRA_FLAGS) $(CFLAGS) $(CXXFLAGS)\""
+RELEASE_DEFS = -DCOMPILER_OPTIONS="\"$(RELEASE_FLAGS) $(EXTRA_FLAGS) $(CFLAGS) $(CXXFLAGS)\""
#
# bowtie-build targets
=====================================
NEWS
=====================================
@@ -5,7 +5,7 @@ Bowtie NEWS
Bowtie is now available for download. 0.9.0 is the first version to
be released under the OSI Artistic License (see `LICENSE') and freely
-available to the public for download. The current version is 1.3.0.
+available to the public for download. The current version is 1.3.1.
Reporting Issues
================
@@ -23,6 +23,18 @@ Keep up with our releases on the GitHub releases page:
Version Release History
=======================
+Version 1.3.1 - Sep 13, 2021
+
+ * Fixed an overflow issue in `bowtie-build` that would sometimes
+ yield corrupt "large" (64-bit) indexes; the resulting index
+ would sometimes cause `bowtie` to hang. Note: `bowtie2-build`
+ does not have this issue.
+ * Fixed an issue in `bowtie` causing XM:i SAM optional field to
+ sometimes be off by 1 when using the `-m/-M` flags.
+ * Fixed an issue that would sometimes cause deadlocks in `bowtie`
+ when running multithreaded.
+ * Fixed an issue causing build errors when compiling against
+ a pre-C++11 standard.
Version 1.3.0 - Jul 22, 2020
=====================================
VERSION
=====================================
@@ -1 +1 @@
-1.3.0
+1.3.1
=====================================
bowtie-inspect
=====================================
@@ -21,7 +21,6 @@
import os
-import imp
import inspect
from importlib.machinery import SourceFileLoader
import logging
=====================================
bt2_locks.cpp
=====================================
@@ -1,21 +1,21 @@
-#include "bt2_locks.h"
-
#if (__cplusplus >= 201103L)
-void mcs_lock::lock() {
+#include "bt2_locks.h"
+
+void mcs_lock::lock(mcs_node &node) {
node.next = nullptr;
- node.unlocked = false;
- mcs_node *pred = q.exchange(&node, std::memory_order_release);
+ mcs_node *pred = q.exchange(&node, std::memory_order_acq_rel);
if (pred) {
- pred->next = &node;
+ node.unlocked = false;
+ pred->next.store(&node, std::memory_order_release);
spin_while_eq(node.unlocked, false);
}
node.unlocked.load(std::memory_order_acquire);
}
-void mcs_lock::unlock() {
- if (!node.next) {
+void mcs_lock::unlock(mcs_node &node) {
+ if (!node.next.load(std::memory_order_acquire)) {
mcs_node *node_ptr = &node;
if (q.compare_exchange_strong(node_ptr,
(mcs_node *)nullptr,
@@ -23,10 +23,9 @@ void mcs_lock::unlock() {
return;
spin_while_eq(node.next, (mcs_node *)nullptr);
}
- node.next->unlocked.store(true, std::memory_order_release);
+ node.next.load(std::memory_order_acquire)->unlocked.store(true, std::memory_order_release);
}
-thread_local mcs_lock::mcs_node mcs_lock::node;
void spin_lock::lock() {
cpu_backoff backoff;
@@ -37,4 +36,5 @@ void spin_lock::lock() {
void spin_lock::unlock() {
flag.clear(std::memory_order_release);
}
+
#endif
=====================================
bt2_locks.h
=====================================
@@ -12,13 +12,17 @@
class cpu_backoff {
public:
cpu_backoff(): count(1) {}
- void pause() {
+ inline void pause() {
if (count <= LOOPS_BEFORE_YIELD) {
for (int32_t i = 0; i < count; i++) {
#ifdef __aarch64__
__asm__ __volatile__("yield" ::: "memory");
-#else
+#elif __ppc__
+ __asm__ __volatile__("or 27,27,27" ::: "memory");
+#elif __x86_64__
__asm__ __volatile__("pause;");
+#else
+ // do nothing
#endif
}
count *= 2;
@@ -44,27 +48,27 @@ class mcs_lock {
public:
mcs_lock(): q(nullptr) {}
struct mcs_node {
- mcs_node *next;
+ std::atomic<mcs_node *> next;
std::atomic_bool unlocked;
};
- void lock();
- void unlock();
- typedef mcs_node* mcs_node_ptr;
+ void lock(mcs_node &node);
+ void unlock(mcs_node &node);
+ typedef std::atomic<mcs_node *> mcs_node_ptr;
private:
- void spin_while_eq(const volatile mcs_node_ptr& value, mcs_node *expected) {
+ void spin_while_eq(const volatile mcs_node_ptr& value, const volatile mcs_node *expected) {
cpu_backoff backoff;
- while (value == expected)
+ while (value.load(std::memory_order_acquire) == expected)
backoff.pause();
}
- void spin_while_eq(const volatile std::atomic_bool& value, bool expected) {
+ void spin_while_eq(const volatile std::atomic_bool& value, const volatile bool expected) {
cpu_backoff backoff;
while (value.load(std::memory_order_acquire) == expected)
backoff.pause();
}
std::atomic<mcs_node *> q;
- static thread_local mcs_node node;
};
-#endif
+
+#endif // if (__cplusplus >= 201103L)
#endif // __MCS_LOCK_H__
=====================================
doc/website/manual.ssi
=====================================
@@ -1,5 +1,5 @@
<h1>Table of Contents</h1>
-<p>Bowtie 1.3.0</p>
+<p>Bowtie 1.3.1</p>
<nav id="TOC" role="doc-toc">
<ul>
=====================================
doc/website/recent_news.ssi
=====================================
@@ -1,3 +1,11 @@
+<h2>1.3.1 - 09/13/2021</h2>
+<ul>
+ <li>Fixed an overflow issue in <code>bowtie-build</code> that would sometimes yield corrupt "large" (64-bit) indexes; the resulting index would sometimes cause <code>bowtie</code> to hang. Note: <code>bowtie2-build</code> does not have this issue.</li>
+ <li>Fixed an issue in <code>bowtie</code> causing XM:i SAM optional field to sometimes be off by 1 when using the <code><a href="manual.shtml#bowtie-options-m">-m</a>/<a href="manual.shtml#bowtie-options-M">-M</a></code> flags.</li>
+ <li>Fixed an issue that would sometimes cause deadlocks in <code>bowtie</code> when running multithreaded.</li>
+ <li>Fixed an issue causing build errors when compiling against a pre-C++11 standard.</li>
+</ul>
+
<h2>1.3.0 - 07/22/2020</h2>
<ul>
<li>Fixed an issue causing <code>bowtie</code> to report incorrect results when using a Bowtie 2 index.</li>
=====================================
doc/website/rhsidebar.ssi
=====================================
@@ -18,10 +18,10 @@
</tr>
<tr>
<td>
- <a href="https://sourceforge.net/projects/bowtie-bio/files/bowtie/1.3.0">Bowtie 1.3.0</a>
+ <a href="https://sourceforge.net/projects/bowtie-bio/files/bowtie/1.3.1">Bowtie 1.3.1</a>
</td>
<td align="right">
- 07/22/20
+ 09/13/21
</td>
</tr>
<tr>
=====================================
ebwt.h
=====================================
@@ -36,6 +36,7 @@
#include "threading.h"
#include "timer.h"
#include "word_io.h"
+#include "mem_ids.h"
#ifdef POPCNT_CAPABILITY
#include "processor_support.h"
@@ -206,7 +207,7 @@ public:
uint32_t sideSz() const { return _sideSz; }
uint32_t sideBwtSz() const { return _sideBwtSz; }
uint32_t sideBwtLen() const { return _sideBwtLen; }
- uint32_t numSidePairs() const { return _numSidePairs; } /* check */
+ TIndexOffU numSidePairs() const { return _numSidePairs; } /* check */
TIndexOffU numSides() const { return _numSides; }
TIndexOffU numLines() const { return _numLines; }
TIndexOffU ebwtTotLen() const { return _ebwtTotLen; }
@@ -310,7 +311,7 @@ public:
uint32_t _sideSz;
uint32_t _sideBwtSz;
uint32_t _sideBwtLen;
- uint32_t _numSidePairs;
+ TIndexOffU _numSidePairs;
TIndexOffU _numSides;
TIndexOffU _numLines;
TIndexOffU _ebwtTotLen;
@@ -754,17 +755,17 @@ public:
dcv <<= 1;
TIndexOffU sz = (TIndexOffU)DifferenceCoverSample<TStr>::simulateAllocs(s, dcv >> 1);
if(nthreads > 1) sz *= (nthreads + 1);
- AutoArray<uint8_t> tmp(sz);
+ AutoArray<uint8_t> tmp(sz, EBWT_CAT);
dcv >>= 1;
// Likewise with the KarkkainenBlockwiseSA
sz = (TIndexOffU)KarkkainenBlockwiseSA<TStr>::simulateAllocs(s, bmax);
- AutoArray<uint8_t> tmp2(sz);
+ AutoArray<uint8_t> tmp2(sz, EBWT_CAT);
// Now throw in the 'ftab' and 'isaSample' structures
// that we'll eventually allocate in buildToDisk
- AutoArray<TIndexOffU> ftab(_eh._ftabLen * 2);
+ AutoArray<TIndexOffU> ftab(_eh._ftabLen * 2, EBWT_CAT);
AutoArray<uint8_t> side(_eh._sideSz);
// Grab another 20 MB out of caution
- AutoArray<uint32_t> extra(20*1024*1024);
+ AutoArray<uint32_t> extra(20*1024*1024, EBWT_CAT);
// If we made it here without throwing bad_alloc, then we
// passed the memory-usage stress test
VMSG(" Passed! Constructing with these parameters: --bmax " << bmax << " --dcv " << dcv);
@@ -3996,13 +3997,14 @@ void Ebwt::buildToDisk(InorderBlockwiseSA<TStr>& sa,
assert(sa.suffixItrIsReset());
// assert_leq((int)ValueSize<Dna>::VALUE, 4);
- TIndexOffU len = eh._len;
- TIndexOffU ftabLen = eh._ftabLen;
- TIndexOffU sideSz = eh._sideSz;
- TIndexOffU ebwtTotSz = eh._ebwtTotSz;
- TIndexOffU fchr[] = {0, 0, 0, 0, 0};
- TIndexOffU* ftab = NULL;
- TIndexOffU zOff = OFF_MASK;
+ TIndexOffU len = eh._len;
+ TIndexOffU ftabLen = eh._ftabLen;
+ TIndexOffU sideSz = eh._sideSz;
+ TIndexOffU ebwtTotSz = eh._ebwtTotSz;
+ TIndexOffU fchr[] = {0, 0, 0, 0, 0};
+ EList<TIndexOffU> ftab(EBWT_CAT);
+ TIndexOffU zOff = OFF_MASK;
+
// Save # of occurrences of each character as we walk along the bwt
TIndexOffU occ[4] = {0, 0, 0, 0};
@@ -4013,42 +4015,42 @@ void Ebwt::buildToDisk(InorderBlockwiseSA<TStr>& sa,
// The absorbed rows represent suffixes shorter than the ftabChars
// cutoff.
uint8_t absorbCnt = 0;
- uint8_t *absorbFtab;
+ EList<uint8_t> absorbFtab(EBWT_CAT);
+
try {
VMSG_NL("Allocating ftab, absorbFtab");
- ftab = new TIndexOffU[ftabLen];
- memset(ftab, 0, OFF_SIZE * ftabLen);
- absorbFtab = new uint8_t[ftabLen];
- memset(absorbFtab, 0, ftabLen);
+ ftab.resize(ftabLen);
+ ftab.fillZero();
+ absorbFtab.resize(ftabLen);
+ absorbFtab.fillZero();
+
} catch(bad_alloc &e) {
cerr << "Out of memory allocating ftab[] or absorbFtab[] "
<< "in Ebwt::buildToDisk() at " << __FILE__ << ":"
<< __LINE__ << endl;
throw e;
}
- assert(ftab != NULL);
- assert(absorbFtab != NULL);
// Allocate the side buffer; holds a single side as its being
// constructed and then written to disk. Reused across all sides.
#ifdef SIXTY4_FORMAT
- uint64_t *ebwtSide = NULL;
+ EList<uint64_t> ebwtSide(EBWT_CAT);
#else
- uint8_t *ebwtSide = NULL;
+ EList<uint8_t> ebwtSide(EBWT_CAT);
#endif
try {
#ifdef SIXTY4_FORMAT
- ebwtSide = new uint64_t[sideSz >> 3];
+ ebwtSide.resize(sideSz >> 3);
#else
- ebwtSide = new uint8_t[sideSz];
+ ebwtSide.resize(sideSz);
#endif
+
} catch(bad_alloc &e) {
cerr << "Out of memory allocating ebwtSide[] in "
<< "Ebwt::buildToDisk() at " << __FILE__ << ":"
<< __LINE__ << endl;
throw e;
}
- assert(ebwtSide != NULL);
// Allocate a buffer to hold the ISA sample, which we accumulate in
// the loop and then output at the end. We can't write output the
@@ -4244,7 +4246,7 @@ void Ebwt::buildToDisk(InorderBlockwiseSA<TStr>& sa,
// Write 'G' and 'T'
assert_leq(occSave[0], occ[2]);
assert_leq(occSave[1], occ[3]);
- TIndexOffU *u32side = reinterpret_cast<TIndexOffU*>(ebwtSide);
+ TIndexOffU *u32side = reinterpret_cast<TIndexOffU*>(ebwtSide.ptr());
side += sideSz;
assert_leq(side, eh._ebwtTotSz);
#ifdef BOWTIE_64BIT_INDEX
@@ -4255,14 +4257,14 @@ void Ebwt::buildToDisk(InorderBlockwiseSA<TStr>& sa,
u32side[(sideSz >> 2)-1] = endianizeU<TIndexOffU>(occSave[1], this->toBe());
#endif
// Write forward side to primary file
- out1.write((const char *)ebwtSide, sideSz);
+ out1.write((const char *)ebwtSide.ptr(), sideSz);
} else if (sideCur == -1) {
// Backward side boundary
assert_eq(0, si % eh._sideBwtLen);
sideCur = 0;
assert(!fw); fw = true;
// Write 'A' and 'C'
- TIndexOffU *u32side = reinterpret_cast<TIndexOffU*>(ebwtSide);
+ TIndexOffU *u32side = reinterpret_cast<TIndexOffU*>(ebwtSide.ptr());
side += sideSz;
assert_leq(side, eh._ebwtTotSz);
#ifdef BOWTIE_64BIT_INDEX
@@ -4275,11 +4277,10 @@ void Ebwt::buildToDisk(InorderBlockwiseSA<TStr>& sa,
occSave[0] = occ[2]; // save 'G' count
occSave[1] = occ[3]; // save 'T' count
// Write backward side to primary file
- out1.write((const char *)ebwtSide, sideSz);
+ out1.write((const char *)ebwtSide.ptr(), sideSz);
}
}
VMSG_NL("Exited Ebwt loop");
- assert(ftab != NULL);
assert_neq(zOff, OFF_MASK);
if(absorbCnt > 0) {
// Absorb any trailing, as-yet-unabsorbed short suffixes into
@@ -4331,20 +4332,20 @@ void Ebwt::buildToDisk(InorderBlockwiseSA<TStr>& sa,
}
assert_leq(eftabLen, (TIndexOffU)eh._ftabChars*2);
eftabLen = eh._ftabChars*2;
- TIndexOffU *eftab = NULL;
+ EList<TIndexOffU> eftab(EBWT_CAT);
try {
- eftab = new TIndexOffU[eftabLen];
- memset(eftab, 0, OFF_SIZE * eftabLen);
+ eftab.resize(eftabLen);
+ eftab.fillZero();
} catch(bad_alloc &e) {
cerr << "Out of memory allocating eftab[] "
<< "in Ebwt::buildToDisk() at " << __FILE__ << ":"
<< __LINE__ << endl;
throw e;
}
- assert(eftab != NULL);
+
TIndexOffU eftabCur = 0;
for(TIndexOffU i = 1; i < ftabLen; i++) {
- TIndexOffU lo = ftab[i] + Ebwt::ftabHi(ftab, eftab, len, ftabLen, eftabLen, i-1);
+ TIndexOffU lo = ftab[i] + Ebwt::ftabHi(ftab.ptr(), eftab.ptr(), len, ftabLen, eftabLen, i-1);
if(absorbFtab[i] > 0) {
// Skip a number of short pattern indicated by absorbFtab[i]
TIndexOffU hi = lo + absorbFtab[i];
@@ -4352,13 +4353,13 @@ void Ebwt::buildToDisk(InorderBlockwiseSA<TStr>& sa,
eftab[eftabCur*2] = lo;
eftab[eftabCur*2+1] = hi;
ftab[i] = (eftabCur++) ^ OFF_MASK; // insert pointer into eftab
- assert_eq(lo, Ebwt::ftabLo(ftab, eftab, len, ftabLen, eftabLen, i));
- assert_eq(hi, Ebwt::ftabHi(ftab, eftab, len, ftabLen, eftabLen, i));
+ assert_eq(lo, Ebwt::ftabLo(ftab.ptr(), eftab.ptr(), len, ftabLen, eftabLen, i));
+ assert_eq(hi, Ebwt::ftabHi(ftab.ptr(), eftab.ptr(), len, ftabLen, eftabLen, i));
} else {
ftab[i] = lo;
}
}
- assert_eq(Ebwt::ftabHi(ftab, eftab, len, ftabLen, eftabLen, ftabLen-1), len+1);
+ assert_eq(Ebwt::ftabHi(ftab.ptr(), eftab.ptr(), len, ftabLen, eftabLen, ftabLen-1), len+1);
// Write ftab to primary file
for(TIndexOffU i = 0; i < ftabLen; i++) {
writeU<TIndexOffU>(out1, ftab[i], this->toBe());
@@ -4379,9 +4380,6 @@ void Ebwt::buildToDisk(InorderBlockwiseSA<TStr>& sa,
}
delete[] isaSample;
}
- delete[] ftab;
- delete[] eftab;
- delete[] absorbFtab;
// Note: if you'd like to sanity-check the Ebwt, you'll have to
// read it back into memory first!
=====================================
ebwt_search_util.h
=====================================
@@ -34,7 +34,7 @@ struct QueryMutation {
* into the spillover list, a non-tail entry in the spillover list, or
* a tail entry in the spillover list.
*/
-typedef union {
+typedef union PartialAlignment {
struct {
uint64_t pos0 : 16; // mismatched pos 1
uint64_t pos1 : 16; // mismatched pos 2
=====================================
genomes/.cvsignore
=====================================
@@ -0,0 +1 @@
+NC_008253.bfa
=====================================
hit.h
=====================================
@@ -288,16 +288,21 @@ public:
numMaxed += ptNumMaxed_[i];
}
- uint64_t tot = numAligned + numUnaligned + numMaxed;
+ uint64_t tot = numAligned + numUnaligned;
+ if (!sampleMax_)
+ tot += numMaxed;
double alPct = 0.0, unalPct = 0.0, maxPct = 0.0;
if(tot > 0) {
- alPct = 100.0 * (double)(numAligned + numMaxed) / (double)tot;
+ if (sampleMax_)
+ alPct = 100.0 * (double)(numAligned) / (double)tot;
+ else
+ alPct = 100.0 * (double)(numAligned + numMaxed) / (double)tot;
unalPct = 100.0 * (double)numUnaligned / (double)tot;
maxPct = 100.0 * (double)numMaxed / (double)tot;
}
cerr << "# reads processed: " << tot << endl;
cerr << "# reads with at least one alignment: "
- << numAligned + numMaxed << " (" << fixed << setprecision(2)
+ << numAligned + (sampleMax_ ? 0 : numMaxed) << " (" << fixed << setprecision(2)
<< alPct << "%)" << endl;
cerr << "# reads that failed to align: "
<< numUnaligned << " (" << fixed << setprecision(2)
@@ -770,7 +775,6 @@ public:
if(paired) {
xms /= 2;
}
- xms++;
_sink.reportHits(NULL, &_bufferedHits, 0, _bufferedHits.size(),
threadId_, mapq, xms, true, p);
_sink.dumpAlign(p);
=====================================
mem_ids.h
=====================================
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2011, Ben Langmead <langmea at 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/>.
+ */
+
+// For holding index data
+#define EBWT_CAT ((int) 1)
+// For holding index-building data
+#define EBWTB_CAT ((int) 2)
+// For holding cache data
+#define CA_CAT ((int) 3)
+// For holding group-walk-left bookkeeping data
+#define GW_CAT ((int) 4)
+// For holding alignment bookkeeping data
+#define AL_CAT ((int) 5)
+// For holding dynamic programming bookkeeping data
+#define DP_CAT ((int) 6)
+// For holding alignment results and other hit objects
+#define RES_CAT ((int) 7)
+#define MISC_CAT ((int) 9)
+#define DEBUG_CAT ((int)10)
=====================================
multikey_qsort.h
=====================================
@@ -1,6 +1,7 @@
#ifndef MULTIKEY_QSORT_H_
#define MULTIKEY_QSORT_H_
+#include <algorithm>
#include <iostream>
#include "alphabet.h"
@@ -292,26 +293,38 @@ bool assertPartitionedSuf2(
#endif
/**
- * Assert that the seqan::String s of suffix offsets into seqan::String
- * 'host' is a seemingly legitimate suffix-offset list (at this time,
- * we just check that it doesn't list any suffix twice).
+ * Assert that string s of suffix offsets into string 'host' is a seemingly
+ * legitimate suffix-offset list (at this time, we just check that it doesn't
+ * list any suffix twice).
*/
+
static inline void sanityCheckInputSufs(TIndexOffU *s, size_t slen) {
assert_gt(slen, 0);
- for(size_t i = 0; i < slen; i++) {
- // Actually, it's convenient to allow the caller to provide
- // suffix offsets thare are off the end of the host string.
- // See, e.g., build() in diff_sample.cpp.
- //assert_lt(s[i], length(host));
- for(size_t j = i+1; j < slen; j++) {
- assert_neq(s[i], s[j]);
+ // Try keeping the running time <1min
+ if (slen > 4096) {
+ TIndexOffU *s_copy = new TIndexOffU[slen];
+ assert(s_copy != NULL);
+ std::copy(s, s + slen, s_copy);
+ std::sort(s_copy, s_copy + slen);
+ for (size_t i = 0; i < slen - 1; i++)
+ assert_neq(s_copy[i], s_copy[i + 1]);
+ delete[] s_copy;
+ } else {
+ for(size_t i = 0; i < slen; i++) {
+ // Actually, it's convenient to allow the caller to provide
+ // suffix offsets thare are off the end of the host string.
+ // See, e.g., build() in diff_sample.cpp.
+ //assert_lt(s[i], length(host));
+ for(size_t j = i+1; j < slen; j++) {
+ assert_neq(s[i], s[j]);
+ }
}
}
}
/**
- * Assert that the seqan::String s of suffix offsets into seqan::String
- * 'host' really are in lexicographical order up to depth 'upto'.
+ * Assert that the string s of suffix offsets into 'host' really are in
+ * lexicographical order up to depth 'upto'.
*/
template <typename T>
void sanityCheckOrderedSufs(const T& host,
=====================================
scripts/bowtie-hbb.sh
=====================================
@@ -44,7 +44,17 @@ fi
# this variant creates static binaries with PIC
source /hbb_exe_gc_hardened/activate
-make bowtie-bin.zip
+mkdir /mybin
+echo 'res=`echo $@ | sed "s/-L.*$//"`; /opt/rh/devtoolset-8/root/usr/bin/ar $res;' > /mybin/ar
+chmod +x /mybin/ar && export PATH=/mybin:$PATH
+
+# make static-libs
+# if [ $? -ne 0 ] ; then
+# echo "Unable to build tbb and/or zlib static dependencies"
+# exit 1
+# fi
+
+make bowtie-bin.zip RELEASE_BUILD=1
if [ $? -ne 0 ] ; then
echo "Unable to create bowtie package"
exit 1
=====================================
shmem.h
=====================================
@@ -10,6 +10,7 @@
#ifdef BOWTIE_SHARED_MEM
+#include <iostream>
#include <string>
#include <sys/shm.h>
#include <unistd.h>
@@ -102,7 +103,7 @@ bool allocSharedMem(std::string fname,
cerr << "shmctl returned " << ret << " for IPC_STAT and errno is " << errno << endl;
throw 1;
}
- if(ds.shm_segsz != shmemLen) {
+ if((size_t)ds.shm_segsz != shmemLen) {
cerr << "Warning: shared-memory chunk's segment size (" << ds.shm_segsz
<< ") doesn't match expected size (" << shmemLen << ")" << endl
<< "Deleting old shared memory block and trying again." << endl;
=====================================
threading.h
=====================================
@@ -19,13 +19,17 @@
#ifdef NO_SPINLOCK
# if (__cplusplus >= 201103L)
# ifdef WITH_QUEUELOCK
- #include "bt2_locks.h"
-# define MUTEX_T mcs_lock
+# include "bt2_locks.h"
+# define MUTEX_T mcs_lock
# else
-# define MUTEX_T std::mutex
+# define MUTEX_T std::mutex
# endif
# else
-# define MUTEX_T tthread::mutex
+# ifdef WITH_QUEUELOCK
+# error "QUEUELOCK requires C++11 or newer."
+# else
+# define MUTEX_T tthread::mutex
+# endif
# endif
#else
# if (__cplusplus >= 201103L)
@@ -57,24 +61,56 @@ struct thread_tracking_pair {
/**
* Wrap a lock; obtain lock upon construction, release upon destruction.
*/
+// class ThreadSafe {
+// public:
+
+// ThreadSafe(MUTEX_T* ptr_mutex) :
+// ptr_mutex_(ptr_mutex)
+// {
+// assert(ptr_mutex_ != NULL);
+// ptr_mutex_->lock();
+// }
+
+// ~ThreadSafe() {
+// ptr_mutex_->unlock();
+// }
+
+// private:
+// MUTEX_T *ptr_mutex_;
+// };
class ThreadSafe {
public:
- ThreadSafe(MUTEX_T* ptr_mutex) :
- ptr_mutex_(ptr_mutex)
- {
- assert(ptr_mutex_ != NULL);
- ptr_mutex_->lock();
- }
+ ThreadSafe(MUTEX_T *mutex) :
+#if (__cplusplus >= 201103L && defined(NO_SPINLOCK) && defined(WITH_QUEUELOCK))
+ node_{},
+#endif
+ mutex_(mutex) {
+#if (__cplusplus >= 201103L && defined(NO_SPINLOCK) && defined(WITH_QUEUELOCK))
+ mutex_->lock(node_);
+#else
+ mutex_->lock();
+#endif
+
+ }
~ThreadSafe() {
- ptr_mutex_->unlock();
+#if (__cplusplus >= 201103L && defined(NO_SPINLOCK) && defined(WITH_QUEUELOCK))
+ mutex_->unlock(node_);
+#else
+ mutex_->unlock();
+#endif
}
private:
- MUTEX_T *ptr_mutex_;
+
+#if (__cplusplus >= 201103L && defined(NO_SPINLOCK) && defined(WITH_QUEUELOCK))
+ MUTEX_T::mcs_node node_;
+#endif
+ MUTEX_T *mutex_;
};
+
#if defined(_TTHREAD_WIN32_)
#define SLEEP(x) Sleep(x)
#else
=====================================
tinythread.cpp
=====================================
@@ -21,6 +21,8 @@ freely, subject to the following restrictions:
distribution.
*/
+#if (__cplusplus < 201103L)
+
#include <exception>
#include "tinythread.h"
@@ -301,3 +303,5 @@ thread::id this_thread::get_id()
}
}
+
+#endif
=====================================
util.h
=====================================
@@ -47,7 +47,7 @@ char* itoa10(const T& value, char* result) {
// Only apply negative sign for base 10
if(std::numeric_limits<T>::is_signed) {
// Avoid compiler warning in cases where T is unsigned
- if (value <= 0 && value != 0) *out++ = '-';
+ if (value < 0) *out++ = '-';
}
std::reverse( result, out );
*out = 0; // terminator
View it on GitLab: https://salsa.debian.org/med-team/bowtie/-/compare/fb3a91ce60d73bf653156f07370b7b34ba81ad97...9bf017434a90cf99f756c6ce9e222a7ed0c86a44
--
View it on GitLab: https://salsa.debian.org/med-team/bowtie/-/compare/fb3a91ce60d73bf653156f07370b7b34ba81ad97...9bf017434a90cf99f756c6ce9e222a7ed0c86a44
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210914/7d35bd6c/attachment-0001.htm>
More information about the debian-med-commit
mailing list