use of it.unimi.dsi.fastutil.ints.IntRBTreeSet in project gridss by PapenfussLab.
the class CollapseIterator method merge.
private void merge(List<KmerPathSubnode> sourcePath, List<KmerPathSubnode> targetPath) {
assert (sourcePath.get(0).width() == targetPath.get(0).width());
assert (sourcePath.get(0).firstStart() == targetPath.get(0).firstStart());
assert (DeBruijnSequenceGraphNodeUtil.basesDifferent(k, sourcePath, targetPath) <= maxBasesMismatch);
trimCommon(sourcePath, targetPath);
assertKmerPathNodesUnique(sourcePath, targetPath);
List<KmerPathNode> source = positionSplit(sourcePath);
List<KmerPathNode> target = positionSplit(targetPath);
IntSortedSet kmerStartPositions = new IntRBTreeSet();
for (KmerPathNode n : source) {
kmerStartPositions.add(n.firstStart());
kmerStartPositions.add(n.firstStart() + n.length());
}
for (KmerPathNode n : target) {
kmerStartPositions.add(n.firstStart());
kmerStartPositions.add(n.firstStart() + n.length());
}
source = lengthSplit(kmerStartPositions, source);
target = lengthSplit(kmerStartPositions, target);
assert (DeBruijnSequenceGraphNodeUtil.basesDifferent(k, source, target) <= maxBasesMismatch);
assert (source.size() <= target.size());
// merge the common nodes
for (int i = 0; i < source.size(); i++) {
KmerPathNode toMerge = source.get(i);
KmerPathNode into = target.get(i);
merge(toMerge, into);
}
if (reprocessMergedNodes()) {
for (int i = 0; i < source.size(); i++) {
processed.remove(target.get(i));
unprocessed.add(target.get(i));
}
}
}
use of it.unimi.dsi.fastutil.ints.IntRBTreeSet in project symja_android_library by axkr.
the class ShortColumn method isIn.
public Selection isIn(final int... numbers) {
final Selection results = new BitmapBackedSelection();
final IntRBTreeSet intSet = new IntRBTreeSet(numbers);
for (int i = 0; i < size(); i++) {
if (intSet.contains(getInt(i))) {
results.add(i);
}
}
return results;
}
Aggregations