From cbcd3e17d28a3c0eab2ce610a17758b029778b8e Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 15 Nov 2017 10:50:19 +0000 Subject: [PATCH] JAL-2835 take all CSQ fields; catch invalid field match patterns --- src/jalview/io/vcf/VCFLoader.java | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/jalview/io/vcf/VCFLoader.java b/src/jalview/io/vcf/VCFLoader.java index 960615a..2847bd7 100644 --- a/src/jalview/io/vcf/VCFLoader.java +++ b/src/jalview/io/vcf/VCFLoader.java @@ -1,14 +1,5 @@ package jalview.io.vcf; -import htsjdk.samtools.util.CloseableIterator; -import htsjdk.variant.variantcontext.Allele; -import htsjdk.variant.variantcontext.VariantContext; -import htsjdk.variant.vcf.VCFHeader; -import htsjdk.variant.vcf.VCFHeaderLine; -import htsjdk.variant.vcf.VCFHeaderLineCount; -import htsjdk.variant.vcf.VCFHeaderLineType; -import htsjdk.variant.vcf.VCFInfoHeaderLine; - import jalview.analysis.AlignmentUtils; import jalview.analysis.Dna; import jalview.api.AlignViewControllerGuiI; @@ -37,6 +28,16 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; + +import htsjdk.samtools.util.CloseableIterator; +import htsjdk.variant.variantcontext.Allele; +import htsjdk.variant.variantcontext.VariantContext; +import htsjdk.variant.vcf.VCFHeader; +import htsjdk.variant.vcf.VCFHeaderLine; +import htsjdk.variant.vcf.VCFHeaderLineCount; +import htsjdk.variant.vcf.VCFHeaderLineType; +import htsjdk.variant.vcf.VCFInfoHeaderLine; /** * A class to read VCF data (using the htsjdk) and add variants as sequence @@ -56,7 +57,7 @@ public class VCFLoader private static final String DEFAULT_VCF_FIELDS = "AF,AC*"; - private static final String DEFAULT_VEP_FIELDS = "Allele,Consequence,IMPACT,SWISSPROT,SIFT,PolyPhen,CLIN_SIG"; + private static final String DEFAULT_VEP_FIELDS = ".*";// "Allele,Consequence,IMPACT,SWISSPROT,SIFT,PolyPhen,CLIN_SIG"; /* * keys to fields of VEP CSQ consequence data @@ -156,7 +157,7 @@ public class VCFLoader al = alignment; // map of species!chromosome!fromAssembly!toAssembly to {fromRange, toRange} - assemblyMappings = new HashMap>(); + assemblyMappings = new HashMap<>(); } /** @@ -420,7 +421,13 @@ public class VCFLoader String[] tokens = pref.split(","); for (String token : tokens) { + try + { patterns.add(Pattern.compile(token.toUpperCase())); + } catch (PatternSyntaxException e) + { + System.err.println("Invalid pattern ignored: " + token); + } } return patterns; } -- 1.7.10.2