From 76584da65ab5ca8e7d8c48140ba41af88a53c11a Mon Sep 17 00:00:00 2001 From: jrobinso <933148+jrobinso@users.noreply.github.com> Date: Sun, 8 Dec 2024 19:36:46 -0800 Subject: [PATCH] Disable memory-mapped index files. This is not needed for IGV, and can result rare but obscure errors. --- src/main/java/org/broad/igv/sam/reader/SAMReader.java | 6 ++++-- src/main/java/org/broad/igv/sam/reader/SamReaderPool.java | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/broad/igv/sam/reader/SAMReader.java b/src/main/java/org/broad/igv/sam/reader/SAMReader.java index 84ceeebdc2..ab87e569c7 100644 --- a/src/main/java/org/broad/igv/sam/reader/SAMReader.java +++ b/src/main/java/org/broad/igv/sam/reader/SAMReader.java @@ -69,7 +69,7 @@ public SAMReader(String samFile) throws IOException { this(samFile, true); } - public SAMReader(String samFile, boolean requireIndex) throws IOException { + public SAMReader(String samFile, boolean requireIndex) { this.samFile = samFile; if (requireIndex) { featureIndex = SamUtils.getIndexFor(samFile); @@ -78,7 +78,9 @@ public SAMReader(String samFile, boolean requireIndex) throws IOException { } } factory = SamReaderFactory.makeDefault(). - validationStringency(ValidationStringency.SILENT); + validationStringency(ValidationStringency.SILENT). + referenceSource(new IGVReferenceSource()). + enable(SamReaderFactory.Option.DONT_MEMORY_MAP_INDEX); loadHeader(); } diff --git a/src/main/java/org/broad/igv/sam/reader/SamReaderPool.java b/src/main/java/org/broad/igv/sam/reader/SamReaderPool.java index e18395cc3b..1c163badd5 100644 --- a/src/main/java/org/broad/igv/sam/reader/SamReaderPool.java +++ b/src/main/java/org/broad/igv/sam/reader/SamReaderPool.java @@ -84,7 +84,8 @@ private SamReader createReader(int bufferSize) throws IOException { boolean isLocal = locator.isLocal(); final SamReaderFactory factory = SamReaderFactory.makeDefault(). referenceSource(new IGVReferenceSource()). - validationStringency(ValidationStringency.SILENT); + validationStringency(ValidationStringency.SILENT). + enable(SamReaderFactory.Option.DONT_MEMORY_MAP_INDEX); SamInputResource resource; if (isLocal) {