Skip to content

Commit

Permalink
Merge pull request #31 from ComparativeGenomicsToolkit/pinch-snps
Browse files Browse the repository at this point in the history
Fix bug where column iterator could visit genomes outside target set
  • Loading branch information
glennhickey authored Sep 8, 2020
2 parents 4f40e72 + 1c563e3 commit 1381f12
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hal2vg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,12 @@ void pinch_genome(const Genome* genome,
targets.insert(*gi);
}
}
ColumnIteratorPtr colIt = genome->getColumnIterator(&targets);
ColumnIteratorPtr colIt;
if (!targets.empty()) {
// if there are no targets, then this is probably the last genome
// so all snps were pinched by a previous genome
colIt = genome->getColumnIterator(&targets);
}

// avoid thread set lookups
const Sequence* topSeq = nullptr;
Expand Down Expand Up @@ -486,7 +491,7 @@ void pinch_genome(const Genome* genome,
first_match = i;
}
last_match = i;
} else {
} else if (colIt.get() != NULL) {
pinch_snp(genome, threads, nameToID, fullNames, topIt, i, colIt,
std::toupper(topString[i]), topThread);
}
Expand Down

0 comments on commit 1381f12

Please sign in to comment.