Permalink
Browse files

many changes that fix LFS bugs and make implicit casts explicit

  • Loading branch information...
1 parent 6020d5e commit b8d3cc010513158c10273a73aea77eb630e067b5 @BenLangmead committed Jun 25, 2014
Showing with 535 additions and 556 deletions.
  1. +11 −10 Makefile
  2. +10 −10 SeqAn-1.1/seqan/index/index_sa_lss.h
  3. +2 −2 aligner.h
  4. +1 −1 binary_sa_search.h
  5. +31 −29 blockwise_sa.h
  6. +1 −1 bowtie_build_main.cpp
  7. +1 −1 bowtie_inspect.cpp
  8. +1 −1 bowtie_main.cpp
  9. +1 −1 color_dec.cpp
  10. +32 −22 diff_sample.h
  11. +3 −3 ebwt.h
  12. +1 −34 ebwt_search.cpp
  13. +40 −40 ebwt_search_backtrack.h
  14. +4 −4 ebwt_search_util.h
  15. +20 −20 hit.cpp
  16. +14 −15 hit.h
  17. +5 −5 hit_set.h
  18. +2 −4 log.h
  19. +109 −107 multikey_qsort.h
  20. +24 −24 pat.h
  21. +1 −1 range_cache.h
  22. +3 −3 range_source.h
  23. +208 −208 ref_aligner.h
  24. +3 −3 ref_read.cpp
  25. +3 −3 sam.cpp
  26. +1 −1 search_exact.c
  27. +3 −3 timer.h
View
@@ -100,16 +100,17 @@ SEARCH_FRAGMENTS = $(wildcard search_*_phase*.c)
VERSION = $(shell cat VERSION)
BITS=32
-# cygwin will stay 32 bit for now.
-ifeq (1,$(MINGW))
- # msys will always be 32 bit so look at the cpu arch.
- ifneq (,$(findstring AMD64,$(PROCESSOR_ARCHITEW6432)))
- BITS=64
- else
- ifneq (,$(findstring AMD64,$(PROCESSOR_ARCHITECTURE)))
- BITS=64
- endif
- endif
+ifeq (x86_64,$(shell uname -m))
+ BITS=64
+endif
+# msys will always be 32 bit so look at the cpu arch instead.
+ifneq (,$(findstring AMD64,$(PROCESSOR_ARCHITEW6432)))
+ ifeq (1,$(MINGW))
+ BITS=64
+ endif
+endif
+ifeq (32,$(BITS))
+ $(error bowtie2 compilation requires a 64-bit platform )
endif
ifeq (1,$(LINUX))
@@ -57,7 +57,7 @@ struct _Context_LSS
{
TValue g;
- g=pm-I; /* group number.*/
+ g=(TValue)(pm-I); /* group number.*/
V[*pl]=g; /* update group number of first position.*/
if (pl==pm)
*pl=-1; /* one element, sorted group.*/
@@ -90,7 +90,7 @@ struct _Context_LSS
pa=pb; /* continue sorting rest of the subarray.*/
}
if (pa==pn) { /* check if last part is single element.*/
- V[*pa]=pa-I;
+ V[*pa]=(TValue)(pa-I);
*pa=-1; /* sorted group.*/
}
}
@@ -157,17 +157,17 @@ struct _Context_LSS
--pc;
}
pn=p+n;
- if ((s=pa-p)>(t=pb-pa))
+ if ((s=(TValue)(pa-p))>(t=(TValue)(pb-pa)))
s=t;
for (pl=p, pm=pb-s; s; --s, ++pl, ++pm)
SEQAN_LSSSWAP(pl, pm);
- if ((s=pd-pc)>(t=pn-pd-1))
+ if ((s=(TValue)(pd-pc))>(t=(TValue)(pn-pd-1)))
s=t;
for (pl=pb, pm=pn-s; s; --s, ++pl, ++pm)
SEQAN_LSSSWAP(pl, pm);
- s=pb-pa;
- t=pd-pc;
+ s=(TValue)(pb-pa);
+ t=(TValue)(pd-pc);
if (s>0)
sort_split(p, s);
update_group(p+s, p+n-t-1);
@@ -197,13 +197,13 @@ struct _Context_LSS
for (pi=p+k-1, i=n; pi>=p; --pi) {
d=x[c=*pi]; /* c is position, d is next in list.*/
x[c]=g=i; /* last position equals group number.*/
- if (d>=0) { /* if more than one element in group.*/
+ if (d == 0 || d > 0) { /* if more than one element in group.*/
p[i--]=c; /* p is permutation for the sorted x.*/
do {
d=x[c=d]; /* next in linked list.*/
x[c]=g; /* group number in x.*/
p[i--]=c; /* permutation in p.*/
- } while (d>=0);
+ } while (d == 0 || d > 0);
} else
p[i--]=-1; /* one element, sorted group.*/
}
@@ -305,7 +305,7 @@ struct _Context_LSS
pi=I; /* pi is first position of group.*/
sl=0; /* sl is negated length of sorted groups.*/
do {
- if ((s=*pi)<0) {
+ if ((s=*pi) <= 0 && (s=*pi) != 0) {
pi-=s; /* skip over sorted group.*/
sl+=s; /* add negated length to sl.*/
} else {
@@ -314,7 +314,7 @@ struct _Context_LSS
sl=0;
}
pk=I+V[s]+1; /* pk-1 is last position of unsorted group.*/
- sort_split(pi, pk-pi);
+ sort_split(pi, (TValue)(pk-pi));
pi=pk; /* next group.*/
}
} while (pi<=I+n);
View
@@ -944,7 +944,7 @@ class PairedBWAlignerV1 : public Aligner {
patsrc_->bufa().qual) :
(off1 ? patsrc_->bufb().qualRev :
patsrc_->bufa().qualRev);
- uint32_t qlen = seqan::length(seq); // length of outstanding mate
+ uint32_t qlen = (uint32_t)seqan::length(seq); // length of outstanding mate
uint32_t alen = (off1 ? patsrc_->bufa().length() :
patsrc_->bufb().length());
int minins = minInsert_;
@@ -1894,7 +1894,7 @@ class PairedBWAlignerV2 : public Aligner {
patsrc_->bufa().qual) :
(range.mate1 ? patsrc_->bufb().qualRev :
patsrc_->bufa().qualRev);
- uint32_t qlen = seqan::length(seq); // length of outstanding mate
+ uint32_t qlen = (uint32_t)seqan::length(seq); // length of outstanding mate
uint32_t alen = (range.mate1 ? patsrc_->bufa().length() :
patsrc_->bufb().length());
int minins = minInsert_;
View
@@ -30,7 +30,7 @@ TIndexOffU binarySASearch(const TStr& host,
const String<TSufElt>& sa)
{
TIndexOffU lLcp = 0, rLcp = 0; // greatest observed LCPs on left and right
- TIndexOffU l = 0, r = length(sa)+1; // binary-search window
+ TIndexOffU l = 0, r = (TIndexOffU)length(sa)+1; // binary-search window
TIndexOffU hostLen = TIndexOffU(length(host));
while(true) {
assert_gt(r, l);
View
@@ -25,19 +25,19 @@ using namespace seqan;
// Helpers for printing verbose messages
#ifndef VMSG_NL
-#define VMSG_NL(args...) \
+#define VMSG_NL(...) \
if(this->verbose()) { \
stringstream tmp; \
- tmp << args << endl; \
+ tmp << __VA_ARGS__ << endl; \
this->verbose(tmp.str()); \
}
#endif
#ifndef VMSG
-#define VMSG(args...) \
+#define VMSG(...) \
if(this->verbose()) { \
stringstream tmp; \
- tmp << args; \
+ tmp << __VA_ARGS__; \
this->verbose(tmp.str()); \
}
#endif
@@ -49,7 +49,7 @@ template<typename TStr>
class BlockwiseSA {
public:
BlockwiseSA(const TStr& __text,
- TIndexOffU __bucketSz,
+ TIndexOffU __bucketSz,
bool __sanityCheck = false,
bool __passMemExc = false,
bool __verbose = false,
@@ -130,7 +130,7 @@ class BlockwiseSA {
bool sanityCheck() const { return _sanityCheck; }
bool verbose() const { return _verbose; }
ostream& log() const { return _logger; }
- uint32_t size() const { return length(_text)+1; }
+ size_t size() const { return length(_text)+1; }
protected:
/// Reset back to the first block
@@ -148,7 +148,7 @@ class BlockwiseSA {
/// 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();
}
}
@@ -172,7 +172,7 @@ template<typename TStr>
class InorderBlockwiseSA : public BlockwiseSA<TStr> {
public:
InorderBlockwiseSA(const TStr& __text,
- TIndexOffU __bucketSz,
+ TIndexOffU __bucketSz,
bool __sanityCheck = false,
bool __passMemExc = false,
bool __verbose = false,
@@ -191,7 +191,7 @@ class KarkkainenBlockwiseSA : public InorderBlockwiseSA<TStr> {
typedef DifferenceCoverSample<TStr> TDC;
KarkkainenBlockwiseSA(const TStr& __text,
- TIndexOffU __bucketSz,
+ TIndexOffU __bucketSz,
uint32_t __dcV,
uint32_t __seed = 0,
bool __sanityCheck = false,
@@ -288,15 +288,15 @@ class KarkkainenBlockwiseSA : public InorderBlockwiseSA<TStr> {
* Defined in blockwise_sa.cpp
*/
inline bool tieBreakingLcp(TIndexOffU aOff,
- TIndexOffU bOff,
- TIndexOffU& lcp,
+ TIndexOffU bOff,
+ TIndexOffU& lcp,
bool& lcpIsSoft);
/**
* Compare two suffixes using the difference-cover sample.
*/
inline bool suffixCmp(TIndexOffU cmp,
- TIndexOffU i,
+ TIndexOffU i,
int64_t& j,
int64_t& k,
bool& kSoft,
@@ -320,8 +320,8 @@ void KarkkainenBlockwiseSA<TStr>::qsort(String<TIndexOffU>& bucket) {
typedef typename Value<TStr>::Type TAlphabet;
const TStr& t = this->text();
TIndexOffU *s = begin(bucket);
- uint32_t slen = seqan::length(bucket);
- TIndexOffU len = seqan::length(t);
+ TIndexOffU slen = (TIndexOffU)seqan::length(bucket);
+ TIndexOffU len = (TIndexOffU)seqan::length(t);
if(_dc != NULL) {
// Use the difference cover as a tie-breaker if we have it
VMSG_NL(" (Using difference cover)");
@@ -350,8 +350,8 @@ template<>
void KarkkainenBlockwiseSA<String<Dna, Packed<> > >::qsort(String<TIndexOffU>& bucket) {
const String<Dna, Packed<> >& t = this->text();
TIndexOffU *s = begin(bucket);
- uint32_t slen = (uint32_t)seqan::length(bucket);
- TIndexOffU len = seqan::length(t);
+ TIndexOffU slen = (TIndexOffU)seqan::length(bucket);
+ TIndexOffU len = (TIndexOffU)seqan::length(t);
if(_dc != NULL) {
// Use the difference cover as a tie-breaker if we have it
VMSG_NL(" (Using difference cover)");
@@ -555,7 +555,7 @@ void KarkkainenBlockwiseSA<TStr>::buildSamples() {
// VMSG_NL("Iterated too many times; trying again...");
// buildSamples();
// }
- VMSG_NL("Avg bucket size: " << ((float)(len-length(_sampleSuffs)) / (length(_sampleSuffs)+1)) << " (target: " << bsz << ")");
+ VMSG_NL("Avg bucket size: " << ((double)(len-length(_sampleSuffs)) / (length(_sampleSuffs)+1)) << " (target: " << bsz << ")");
}
/**
@@ -579,8 +579,8 @@ static TIndexOffU suffixLcp(const T& t, TIndexOffU aOff, TIndexOffU bOff) {
*/
template<typename TStr> inline
bool KarkkainenBlockwiseSA<TStr>::tieBreakingLcp(TIndexOffU aOff,
- TIndexOffU bOff,
- TIndexOffU& lcp,
+ TIndexOffU bOff,
+ TIndexOffU& lcp,
bool& lcpIsSoft)
{
const TStr& t = this->text();
@@ -619,10 +619,11 @@ bool KarkkainenBlockwiseSA<TStr>::tieBreakingLcp(TIndexOffU aOff,
* filled in then calculate it from scratch.
*/
template<typename T>
-static TIndexOffU lookupSuffixZ(const T& t,
- TIndexOffU zOff,
- TIndexOffU off,
- const String<TIndexOffU>& z)
+static TIndexOffU lookupSuffixZ(
+ const T& t,
+ TIndexOffU zOff,
+ TIndexOffU off,
+ const String<TIndexOffU>& z)
{
if(zOff < length(z)) {
TIndexOffU ret = z[zOff];
@@ -638,12 +639,13 @@ static TIndexOffU lookupSuffixZ(const T& t,
* false -> i > cmp
*/
template<typename TStr> inline
-bool KarkkainenBlockwiseSA<TStr>::suffixCmp(TIndexOffU cmp,
- TIndexOffU i,
- int64_t& j,
- int64_t& k,
- bool& kSoft,
- const String<TIndexOffU>& z)
+bool KarkkainenBlockwiseSA<TStr>::suffixCmp(
+ TIndexOffU cmp,
+ TIndexOffU i,
+ int64_t& j,
+ int64_t& k,
+ bool& kSoft,
+ const String<TIndexOffU>& z)
{
const TStr& t = this->text();
TIndexOffU len = TIndexOffU(length(t));
View
@@ -43,7 +43,7 @@ int main(int argc, const char **argv) {
myargs[i] = args[i].c_str();
}
if(args.size() == 1) continue;
- lastret = bowtie_build(args.size(), myargs);
+ lastret = bowtie_build((int)args.size(), myargs);
free(myargs);
}
if(lastret == -1) {
View
@@ -397,7 +397,7 @@ void print_index_summary(
cout << "FTab-Chars" << '\t' << ebwt.eh().ftabChars() << endl;
for(size_t i = 0; i < ebwt.nPat(); i++) {
cout << "Sequence-" << (i+1)
- << '\t' << p_refnames[refs.expandIdx(i)]
+ << '\t' << p_refnames[refs.expandIdx((uint32_t)i)]
<< '\t' << (ebwt.plen()[i] + (color ? 1 : 0))
<< endl;
}
View
@@ -43,7 +43,7 @@ int main(int argc, const char **argv) {
myargs[i] = args[i].c_str();
}
if(args.size() == 1) continue;
- lastret = bowtie(args.size(), myargs);
+ lastret = bowtie((int)args.size(), myargs);
free(myargs);
}
if(lastret == -1) {
View
@@ -190,7 +190,7 @@ void decodeHit(
assert_geq(readc, 0);
omin = INT_MAX;
// t <- index of column in dynamic programming table
- t = c - readi + 1;
+ t = (int)(c - readi + 1);
const int refc = ref[refi + t];
int from[] = { table[0][4][t-1], table[1][4][t-1],
table[2][4][t-1], table[3][4][t-1] };
Oops, something went wrong.

0 comments on commit b8d3cc0

Please sign in to comment.