From f08fac41090bed842625493c9fa919ee14de865a Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 5 Jun 2018 11:25:01 +0100 Subject: [PATCH] JAL-2808 remove duplicated code, tidy case-insensitive regexes --- src/jalview/io/vcf/VCFLoader.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/jalview/io/vcf/VCFLoader.java b/src/jalview/io/vcf/VCFLoader.java index de2f18a..9438ba9 100644 --- a/src/jalview/io/vcf/VCFLoader.java +++ b/src/jalview/io/vcf/VCFLoader.java @@ -421,8 +421,7 @@ public class VCFLoader /** * Answers true if the field id is matched by any of the filter patterns, else - * false. Matching is against regular expression patterns, and is not - * case-sensitive. + * false. Matching is against non-case-sensitive regular expression patterns. * * @param id * @param filters @@ -432,7 +431,7 @@ public class VCFLoader { for (Pattern p : filters) { - if (p.matcher(id.toUpperCase()).matches()) + if (p.matcher(id).matches()) { return true; } @@ -506,8 +505,7 @@ public class VCFLoader * Reads the Preference value for the given key, with default specified if no * preference set. The value is interpreted as a comma-separated list of * regular expressions, and converted into a list of compiled patterns ready - * for matching. Patterns are forced to upper-case for non-case-sensitive - * matching. + * for matching. Patterns are set to non-case-sensitive matching. *

* This supports user-defined filters for fields of interest to capture while * processing data. For example, VCF_FIELDS = AF,AC* would mean that VCF INFO @@ -526,7 +524,7 @@ public class VCFLoader { try { - patterns.add(Pattern.compile(token.toUpperCase())); + patterns.add(Pattern.compile(token, Pattern.CASE_INSENSITIVE)); } catch (PatternSyntaxException e) { System.err.println("Invalid pattern ignored: " + token); @@ -1190,14 +1188,6 @@ public class VCFLoader } /* - * filter out fields we don't want to capture - */ - if (!vcfFieldsOfInterest.contains(key)) - { - continue; - } - - /* * we extract values for other data which are allele-specific; * these may be per alternate allele (INFO[key].Number = 'A') * or per allele including reference (INFO[key].Number = 'R') -- 1.7.10.2