diff --git a/src/main/java/org/broad/igv/feature/genome/Genome.java b/src/main/java/org/broad/igv/feature/genome/Genome.java index 86b936665..990bd1ffd 100644 --- a/src/main/java/org/broad/igv/feature/genome/Genome.java +++ b/src/main/java/org/broad/igv/feature/genome/Genome.java @@ -139,7 +139,7 @@ public Genome(GenomeConfig config) throws IOException { List chromosomeList = null; if (config.chromSizesURL != null) { chromosomeList = ChromSizesParser.parse(config.chromSizesURL); - } else if (sequence.hasChromosomes()) { + } else if (sequence != null && sequence.hasChromosomes()) { chromosomeList = sequence.getChromosomes(); } else if (config.indexURL != null) { FastaIndex index = new FastaIndex(config.indexURL); @@ -173,7 +173,7 @@ public Genome(GenomeConfig config) throws IOException { // Whole genome view is enabled by default if we have the chromosome information amd the // number of chromosomes is not too large - showWholeGenomeView = config.wholeGenomeView && + showWholeGenomeView = config.wholeGenomeView && chromosomeList.size() > 1 && longChromosomeNames.size() <= MAX_WHOLE_GENOME_LONG; @@ -242,6 +242,7 @@ public Genome(String id, List chromosomes) { chromosomeMap.put(chromosome.getName(), chromosome); } this.longChromosomeNames = computeLongChromosomeNames(); + this.chromAliasSource = (new ChromAliasDefaults(id, chromosomeNames)); } private void addTracks(GenomeConfig config) { @@ -291,7 +292,9 @@ public String getCanonicalChrName(String str) { ChromAlias aliasRecord = chromAliasSource.search(str); if (aliasRecord != null) { String chr = aliasRecord.getChr(); - chrAliasCache.put(str, chr); + for (String a : aliasRecord.values()) { + chrAliasCache.put(a, chr); + } return chr; } } catch (IOException e) { @@ -404,17 +407,16 @@ public Chromosome getChromosome(String name) { String chrName = getCanonicalChrName(name); if (chromosomeMap.containsKey(chrName)) { return chromosomeMap.get(chrName); - } else { + } else if (sequence != null) { int length = this.sequence.getChromosomeLength(chrName); if (length > 0) { int idx = this.chromosomeMap.size(); Chromosome chromosome = new Chromosome(idx, chrName, length); chromosomeMap.put(chrName, chromosome); return chromosome; - } else { - return null; } } + return null; } diff --git a/src/main/java/org/broad/igv/feature/genome/load/DotGenomeLoader.java b/src/main/java/org/broad/igv/feature/genome/load/DotGenomeLoader.java index 561a2e567..d764ba5a6 100644 --- a/src/main/java/org/broad/igv/feature/genome/load/DotGenomeLoader.java +++ b/src/main/java/org/broad/igv/feature/genome/load/DotGenomeLoader.java @@ -102,7 +102,7 @@ public Genome loadGenome() throws IOException { config.fastaURL = sequencePath; config.indexURL = sequencePath + ".fai"; if (sequencePath.endsWith(".gz")) { - config.gziIndexURL = sequencePath + "gzi"; + config.gziIndexURL = sequencePath + ".gzi"; } } diff --git a/src/test/java/org/broad/igv/tools/IGVToolsCountTest.java b/src/test/java/org/broad/igv/tools/IGVToolsCountTest.java index 38dad4624..3c4a89196 100644 --- a/src/test/java/org/broad/igv/tools/IGVToolsCountTest.java +++ b/src/test/java/org/broad/igv/tools/IGVToolsCountTest.java @@ -93,8 +93,6 @@ public void testCountBEDoutWig() throws Exception { @Test public void testCountBEDoutWigCheckBW() throws Exception { - GenomeUtils.main(null); - String inputFile = TestUtils.DATA_DIR + "bed/test2.bed"; String fullout = TestUtils.TMP_OUTPUT_DIR + "twig.wig"; String input = "count " + inputFile + " " + fullout + " " + genomePath;