Skip to content
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
20 changes: 13 additions & 7 deletions src/main/java/picard/fingerprint/FingerprintChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -526,15 +526,17 @@ public Map<FingerprintIdDetails, Fingerprint> fingerprintSamFile(final Path samF

public Map<FingerprintIdDetails, Fingerprint> fingerprintSamFile(final Path samFile, final Path indexPath, final boolean forceIndex,
final Function<HaplotypeBlock, HaplotypeProbabilities> blockToProbMapper) {

final SamReader in = getSamReader(samFile, indexPath, forceIndex);
checkDictionaryGoodForFingerprinting(in.getFileHeader().getSequenceDictionary());

if (!in.hasIndex()) {
log.warn(String.format("Operating without an index! We could be here for a while. (%s)", samFile.toUri().toString()));
} else {
log.info(String.format("Reading an indexed file (%s)", samFile.toUri().toString()));
}

checkDictionaryGoodForFingerprinting(in.getFileHeader().getSequenceDictionary());

// fingerprinting allows that headers differ, but SamLocusIterator doesn't allow the dictionary of the query
// interval list to differ from that of the samfile, leading to an exception thrown.
// At this point we already know that the dictionary of the haplotypes is a proper prefix of that of the sam file
Expand Down Expand Up @@ -712,12 +714,16 @@ public Map<FingerprintIdDetails, Fingerprint> fingerprintFiles(final Collection<
} else if (indexPath != null) {
log.info("Using explicit index provided for " + p);
}

// Perform fingerprinting on SAM or VCF file
if (CheckFingerprint.fileContainsReads(p)) {
oneFileFingerprints = fingerprintSamFile(p, indexPath, forceIndex, HaplotypeProbabilitiesFromSequence::new);
} else {
oneFileFingerprints = fingerprintVcf(p, indexPath, forceIndex);
try {
// Perform fingerprinting on SAM or VCF file
if (CheckFingerprint.fileContainsReads(p)) {
oneFileFingerprints = fingerprintSamFile(p, indexPath, forceIndex, HaplotypeProbabilitiesFromSequence::new);
} else {
oneFileFingerprints = fingerprintVcf(p, indexPath, forceIndex);
}
} catch (SequenceUtil.SequenceListsDifferException e){
log.error("file %s caused an exception".formatted(p));
throw e;
}

if (oneFileFingerprints.isEmpty()) {
Expand Down
Loading