Skip to content

Use results from SBI index instead of ignoring them #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 12, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions src/main/java/org/disq_bio/disq/impl/formats/bam/BamSource.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ protected JavaRDD<PathChunk> getPathChunks(
try (SeekableStream sbiStream = fileSystemWrapper.open(jsc.hadoopConfiguration(), sbiPath)) {
SBIIndex sbiIndex = SBIIndex.load(sbiStream);
Broadcast<SBIIndex> sbiIndexBroadcast = jsc.broadcast(sbiIndex);
pathSplitSource
return pathSplitSource
.getPathSplits(jsc, path, splitSize)
.flatMap(
pathSplit -> {
Expand All @@ -117,26 +117,26 @@ protected JavaRDD<PathChunk> getPathChunks(
}
});
}
} else {
logger.debug("Using guessing for finding splits");
SerializableHadoopConfiguration confSer =
new SerializableHadoopConfiguration(jsc.hadoopConfiguration());
return bgzfBlockSource
.getBgzfBlocks(jsc, path, splitSize)
.mapPartitionsWithIndex(
(Function2<Integer, Iterator<BgzfBlockGuesser.BgzfBlock>, Iterator<PathChunk>>)
(partitionIndex, bgzfBlocks) -> {
Configuration conf = confSer.getConf();
PathChunk pathChunk =
getFirstReadInPartition(conf, bgzfBlocks, stringency, referenceSourcePath);
logger.debug("PathChunk for partition {}: {}", partitionIndex, pathChunk);
if (pathChunk == null) {
return Collections.emptyIterator();
}
return Collections.singleton(pathChunk).iterator();
},
true);
}

logger.debug("Using guessing for finding splits");
SerializableHadoopConfiguration confSer =
new SerializableHadoopConfiguration(jsc.hadoopConfiguration());
return bgzfBlockSource
.getBgzfBlocks(jsc, path, splitSize)
.mapPartitionsWithIndex(
(Function2<Integer, Iterator<BgzfBlockGuesser.BgzfBlock>, Iterator<PathChunk>>)
(partitionIndex, bgzfBlocks) -> {
Configuration conf = confSer.getConf();
PathChunk pathChunk =
getFirstReadInPartition(conf, bgzfBlocks, stringency, referenceSourcePath);
logger.debug("PathChunk for partition {}: {}", partitionIndex, pathChunk);
if (pathChunk == null) {
return Collections.emptyIterator();
}
return Collections.singleton(pathChunk).iterator();
},
true);
}

/**
Expand Down