Skip to content

Commit

Permalink
Merge branch 'affineGap' of https://github.com/amplab/snap into affin…
Browse files Browse the repository at this point in the history
…eGap
  • Loading branch information
bolosky committed Nov 23, 2020
2 parents 2ba230d + a22ba8f commit 9c9dc97
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions SNAPLib/AlignerContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ AlignerContext::initialize()
WriteStatusMessage("%llds. %u bases, seed size %d\n",
loadTime / 1000, index->getGenome()->getCountOfBases(), index->getSeedLength());

if (index->getMajorVersion() < 5 || index->getMajorVersion() == 5 && index->getMinorVersion() == 0) {
if (index->getMajorVersion() < 5 || (index->getMajorVersion() == 5 && index->getMinorVersion() == 0)) {
WriteErrorMessage("WARNING: The version of the index you're using was built with an earlier version of SNAP and will result in Ns in the reference NOT matching Ns in reads.\n If you do not want this behavior, rebuild the index.\n");
}
} else {
Expand Down Expand Up @@ -473,7 +473,7 @@ AlignerContext::printStats()
(stats->filtered > 0) ? numPctAndPad(filtered, stats->filtered, 100.0 * stats->filtered / stats->totalReads, 23, strBufLen) : "",
(stats->extraAlignments > 0) ? FormatUIntWithCommas(stats->extraAlignments, extraAlignments, strBufLen, 18) : "",
isPaired() ? pctAndPad(pctPairs, 100.0 * stats->alignedAsPairs / stats->totalReads, 7, strBufLen, true) : "",
FormatUIntWithCommas((unsigned _int64)(1000 * stats->totalReads / max(alignTime, (_int64)1)), readsPerSecond, strBufLen), // Aligntime is in ms
FormatUIntWithCommas((_uint64)(1000 * stats->totalReads / max(alignTime, (_int64)1)), readsPerSecond, strBufLen), // Aligntime is in ms
FormatUIntWithCommas((alignTime + 500) / 1000, alignTimeString, strBufLen, 20),
options->profile ? pctAndPad(pctRead, (double)stats->millisReading / (double)totalTime, 5, strBufLen, false) : "",
options->profile ? pctAndPad(pctAlign, (double)stats->millisAligning / (double)totalTime, 6, strBufLen, false) : "",
Expand Down
4 changes: 2 additions & 2 deletions SNAPLib/AlignerOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,8 @@ AlignerOptions::usage()
WriteErrorMessage("Must specify the desired extra search depth after -D\n");
}
} else if (strlen(argv[n]) >= 2 && '-' == argv[n][0] && 'C' == argv[n][1]) {
if (strlen(argv[n]) != 4 || '-' != argv[n][2] && '+' != argv[n][2] ||
'-' != argv[n][3] && '+' != argv[n][3]) {
if (strlen(argv[n]) != 4 || ('-' != argv[n][2] && '+' != argv[n][2]) ||
('-' != argv[n][3] && '+' != argv[n][3])) {

WriteErrorMessage("Invalid -C argument.\n\n");
return false;
Expand Down
4 changes: 2 additions & 2 deletions SNAPLib/BaseAligner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ Return Value:
// cause us to lose confidence in the alignment, since they're probably both pretty good).
//
if (anyNearbyCandidatesAlreadyScored) {
if (elementToScore->bestScore < score || elementToScore->bestScore == score && matchProbability <= elementToScore->matchProbabilityForBestScore) {
if (elementToScore->bestScore < score || (elementToScore->bestScore == score && matchProbability <= elementToScore->matchProbabilityForBestScore)) {
// if (matchProbability <= elementToScore->matchProbabilityForBestScore) {
//
// This is a no better mapping than something nearby that we already tried. Just ignore it.
Expand Down Expand Up @@ -1192,7 +1192,7 @@ Return Value:
//
nearbyElement = NULL;
} else {
if (nearbyElement->bestScore < score || nearbyElement->bestScore == score && nearbyElement->matchProbabilityForBestScore >= matchProbability) {
if (nearbyElement->bestScore < score || (nearbyElement->bestScore == score && nearbyElement->matchProbabilityForBestScore >= matchProbability)) {
//
// Again, this is no better than something nearby we already tried. Give up.
//
Expand Down
1 change: 1 addition & 0 deletions SNAPLib/Compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ int getpagesize();
#include <xmmintrin.h> // This is currently (in Dec 2013) broken on Mac OS X 10.9 (Apple clang-500.2.79)
#else
#define _mm_prefetch(...) {}
#include <emmintrin.h> // For vector types like __m128i
#endif

typedef int64_t _int64;
Expand Down
4 changes: 2 additions & 2 deletions SNAPLib/IntersectingPairedEndAligner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ IntersectingPairedEndAligner::alignLandauVishkin(
// If we haven't yet scored this mate, or we've scored it and not gotten an answer, but had a higher score limit than we'd
// use now, score it.
//
if (mate->score == ScoringMateCandidate::LocationNotYetScored || mate->score == ScoreAboveLimit && mate->scoreLimit < scoreLimit - fewerEndScore) {
if (mate->score == ScoringMateCandidate::LocationNotYetScored || (mate->score == ScoreAboveLimit && mate->scoreLimit < scoreLimit - fewerEndScore)) {
scoreLocation(readWithMoreHits, setPairDirection[candidate->whichSetPair][readWithMoreHits], GenomeLocationAsInt64(mate->readWithMoreHitsGenomeLocation),
mate->seedOffset, scoreLimit - fewerEndScore, &mate->score, &mate->matchProbability,
&mate->genomeOffset, &mate->usedAffineGapScoring, &mate->basesClippedBefore, &mate->basesClippedAfter, &mate->agScore, &mate->lvIndels);
Expand Down Expand Up @@ -2125,7 +2125,7 @@ IntersectingPairedEndAligner::MergeAnchor::checkMerge(GenomeLocation newMoreHitL
//
// Within merge distance. Keep the better score (or if they're tied the better match probability).
//
if (newPairAGScore > pairAGScore || newPairAGScore == pairAGScore && newMatchProbability > matchProbability) {
if (newPairAGScore > pairAGScore || (newPairAGScore == pairAGScore && newMatchProbability > matchProbability)) {
#ifdef _DEBUG
if (_DumpAlignments) {
printf("Merge replacement at anchor (%llu, %llu), loc (%llu, %llu), old match prob %e, new match prob %e, old pair score %d, new pair score %d\n",
Expand Down
2 changes: 1 addition & 1 deletion SNAPLib/LandauVishkin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ int LandauVishkinWithCigar::computeEditDistance(
t += 8;
}
}
if (best > bestbest || best == bestbest && bestIndels < bestBestIndels) {
if (best > bestbest || (best == bestbest && bestIndels < bestBestIndels)) {
bestbest = best;
bestdelta = delta;
bestBestIndels = bestIndels;
Expand Down
2 changes: 1 addition & 1 deletion SNAPLib/PairedReadMatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ PairedReadMatcher::getNextReadPair(
}

if (quicklyDropUnpairedReads) {
if (((localRead.getOriginalSAMFlags() & SAM_NEXT_UNMAPPED) == 0) && (localRead.getOriginalPNEXT() == 0 || localRead.getOriginalRNEXTLength() == 1 && localRead.getOriginalRNEXT()[0] == '*')) {
if (((localRead.getOriginalSAMFlags() & SAM_NEXT_UNMAPPED) == 0) && (localRead.getOriginalPNEXT() == 0 || (localRead.getOriginalRNEXTLength() == 1 && localRead.getOriginalRNEXT()[0] == '*'))) {
nReadsQuicklyDropped++;
skipped--;
continue;
Expand Down
6 changes: 3 additions & 3 deletions SNAPLib/SAM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ SAMReader::parseHeader(
//
// Verify that they actually match what's in our reference genome.
//
if (lineBuffer + 3 >= endOfLine || ' ' != lineBuffer[3] && '\t' != lineBuffer[3]) {
if (lineBuffer + 3 >= endOfLine || (' ' != lineBuffer[3] && '\t' != lineBuffer[3])) {
WriteErrorMessage("Malformed SAM file '%s' has @SQ without a following space or tab.\n", fileName);
delete[] lineBuffer;
return false;
Expand Down Expand Up @@ -370,7 +370,7 @@ SAMReader::parseHeader(
!strncmp("@CO",nextLineToProcess,3)) {

if (!strncmp("@RG", nextLineToProcess, 3)) {
if (nextLineToProcess + 3 >= endOfBuffer || ' ' != nextLineToProcess[3] && '\t' != nextLineToProcess[3]) {
if (nextLineToProcess + 3 >= endOfBuffer || (' ' != nextLineToProcess[3] && '\t' != nextLineToProcess[3])) {
WriteErrorMessage("Malformed SAM file '%s' has @RG without a following space or tab.\n", fileName);
return false;
}
Expand Down Expand Up @@ -4269,4 +4269,4 @@ class SAMDupMarkSupplier : public DataWriter::FilterSupplier
DataWriterSupplier::samMarkDuplicates(const Genome* genome)
{
return new SAMDupMarkSupplier(genome);
}
}
2 changes: 1 addition & 1 deletion SNAPLib/SortedDataWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ SortedDataFilterSupplier::mergeSort()
if (i->reader == NULL) // Otheriwse, it's the last block that's in memory
{
i->reader = readerSupplier->getDataReader(1, MAX_READ_LENGTH * 8, 0.0,
min(1UL << 23, max(1UL << 17, bufferSpace / blocks.size()))); // 128kB to 8MB buffer space per block
__min(1UL << 23, __max(1UL << 17, bufferSpace / blocks.size()))); // 128kB to 8MB buffer space per block
i->reader->init(tempFileName);
i->reader->reinit(i->start, i->bytes);
}
Expand Down
2 changes: 1 addition & 1 deletion SNAPLib/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ int cheezyLogBase2(_int64 value);
//
inline bool isWithin(unsigned a, unsigned b, unsigned distance)
{
return a <= b && a+distance >= b || a >= b && a <= b + distance;
return (a <= b && a+distance >= b) || (a >= b && a <= b + distance);
}

inline int getSignBit64(_int64 value)
Expand Down

0 comments on commit 9c9dc97

Please sign in to comment.