Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8.0
5.8.1
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ import org.slf4j.{Logger, LoggerFactory}

import java.nio.file.{Files, Path, Paths}

object RefSeqFromChromSeq {
var downloadTriggered : util.Map[String, java.lang.Boolean] =
new java.util.concurrent.ConcurrentHashMap[String, java.lang.Boolean]
}

class RefSeqFromChromSeq(ipath : String, fileReader : FileReader) extends RefSeq {
protected var download_triggered = false
private val GOR_REFSEQ_CACHE_FOLDER = System.getProperty("gor.refseq.cache.folder")
private val GOR_REFSEQ_CACHE_DOWNLOAD = Option(System.getProperty("gor.refseq.cache.download", "true")).exists(_.toBoolean)

Expand Down Expand Up @@ -66,8 +70,8 @@ class RefSeqFromChromSeq(ipath : String, fileReader : FileReader) extends RefSeq
if (Files.exists(fullCachePath)) {
log.debug("Using cached reference build {}", fullCachePath.toString)
return fullCachePath.toString
} else if (GOR_REFSEQ_CACHE_DOWNLOAD && !download_triggered) {
download_triggered = true // Only trigger download once per client
} else if (GOR_REFSEQ_CACHE_DOWNLOAD && (RefSeqFromChromSeq.downloadTriggered.putIfAbsent(fullRefPath.toString, true) == null)) {
// Only trigger download once per client
triggerRefSeqDownload(fullRefPath, fullCachePath)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,13 @@ package org.gorpipe.model.gor.iterators

import org.gorpipe.gor.model.FileReader

import java.util
import java.util.Collections

class RefSeqFromConfigFactory(path: String, reader: FileReader) extends RefSeqFactory {
var refSeqMap = Collections.synchronizedMap(new util.HashMap[String, RefSeq]())

override def create(): RefSeq = {
refSeqMap.computeIfAbsent(path, _ => {
new RefSeqFromChromSeq(path, reader)})
new RefSeqFromChromSeq(path, reader)
}

def create(altPath: String): RefSeq = {
refSeqMap.computeIfAbsent(altPath, _ => {
new RefSeqFromChromSeq(altPath, reader)})
new RefSeqFromChromSeq(altPath, reader)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.nio.file.Files;
import java.nio.file.Path;

public class UTestRefSeqFromConfig {
public class UTestRefSeqFromChromSeq {

@Rule
public final ProvideSystemProperty cacheFolder
Expand Down Expand Up @@ -121,8 +121,7 @@ public void testGetRefbaseFromCache() throws InterruptedException {

RefSeqFromChromSeq refseq = new RefSeqFromChromSeq("../tests/data/ref_mini/chromSeq", new DriverBackedFileReader(""));

refseq.download_triggered_$eq(false);

RefSeqFromChromSeq.downloadTriggered().clear();

Assert.assertEquals('C', refseq.getBase("chr1", 101000));

Expand Down
Loading