From 1b0014839c94c711c09a94641ecb5036072bb5b3 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 29 Apr 2019 15:17:45 +0100 Subject: [PATCH] JAL-2738 JAL-2743 update unit test to match new VCF properties --- src/jalview/io/vcf/VCFLoader.java | 39 +++----------------------------- test/jalview/io/vcf/VCFLoaderTest.java | 1 + 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/src/jalview/io/vcf/VCFLoader.java b/src/jalview/io/vcf/VCFLoader.java index f4ce1a3..9831af7 100644 --- a/src/jalview/io/vcf/VCFLoader.java +++ b/src/jalview/io/vcf/VCFLoader.java @@ -262,8 +262,8 @@ public class VCFLoader */ public SequenceI loadVCFContig(String contig) { - String ref = header.getOtherHeaderLine(VCFHeader.REFERENCE_KEY) - .getValue(); + VCFHeaderLine headerLine = header.getOtherHeaderLine(VCFHeader.REFERENCE_KEY); + String ref = headerLine == null ? null : headerLine.getValue(); if (ref.startsWith("file://")) { ref = ref.substring(7); @@ -373,6 +373,7 @@ public class VCFLoader */ protected void setSpeciesAndAssembly(String reference) { + reference = reference.toLowerCase(); vcfSpecies = DEFAULT_SPECIES; /* @@ -803,40 +804,6 @@ public class VCFLoader } /** - * Answers true if the species inferred from the VCF reference identifier - * matches that for the sequence - * - * @param vcfAssembly - * @param speciesId - * @return - */ - boolean vcfSpeciesMatchesSequence(String vcfAssembly, String speciesId) - { - // PROBLEM 1 - // there are many aliases for species - how to equate one with another? - // PROBLEM 2 - // VCF ##reference header is an unstructured URI - how to extract species? - // perhaps check if ref includes any (Ensembl) alias of speciesId?? - // TODO ask the user to confirm this?? - - if (vcfAssembly.contains("Homo_sapiens") // gnomAD exome data example - && "HOMO_SAPIENS".equals(speciesId)) // Ensembl species id - { - return true; - } - - if (vcfAssembly.contains("c_elegans") // VEP VCF response example - && "CAENORHABDITIS_ELEGANS".equals(speciesId)) // Ensembl - { - return true; - } - - // this is not a sustainable solution... - - return false; - } - - /** * Queries the VCF reader for any variants that overlap the mapped chromosome * ranges of the sequence, and adds as variant features. Returns the number of * overlapping variants found. diff --git a/test/jalview/io/vcf/VCFLoaderTest.java b/test/jalview/io/vcf/VCFLoaderTest.java index 9e0efe6..a87c160 100644 --- a/test/jalview/io/vcf/VCFLoaderTest.java +++ b/test/jalview/io/vcf/VCFLoaderTest.java @@ -75,6 +75,7 @@ public class VCFLoaderTest Cache.loadProperties("test/jalview/io/testProps.jvprops"); Cache.setProperty("VCF_FIELDS", ".*"); Cache.setProperty("VEP_FIELDS", ".*"); + Cache.setProperty("VCF_ASSEMBLY", "GRCh38=GRCh38"); Cache.initLogger(); } -- 1.7.10.2