/** * parse the filter string, first checking to see if we already have parsed it in a previous attempt * * @param filterString the string to parse * @return a set of the filters applied or null if filters were not applied to the record (e.g. as per the missing value in a VCF) */ @Override protected List<String> parseFilters(final String filterString) { // null for unfiltered if ( filterString.equals(VCFConstants.UNFILTERED) ) return null; if ( filterString.equals(VCFConstants.PASSES_FILTERS_v4) ) return Collections.emptyList(); if ( filterString.equals(VCFConstants.PASSES_FILTERS_v3) ) generateException(VCFConstants.PASSES_FILTERS_v3 + " is an invalid filter name in vcf4", lineNo); if (filterString.isEmpty()) generateException("The VCF specification requires a valid filter status: filter was " + filterString, lineNo); // do we have the filter string cached? if ( filterHash.containsKey(filterString) ) return filterHash.get(filterString); // empty set for passes filters final List<String> fFields = new LinkedList<String>(); // otherwise we have to parse and cache the value if ( !filterString.contains(VCFConstants.FILTER_CODE_SEPARATOR) ) fFields.add(filterString); else fFields.addAll(Arrays.asList(filterString.split(VCFConstants.FILTER_CODE_SEPARATOR))); filterHash.put(filterString, Collections.unmodifiableList(fFields)); return fFields; }
/** * parse the filter string, first checking to see if we already have parsed it in a previous attempt * * @param filterString the string to parse * @return a set of the filters applied or null if filters were not applied to the record (e.g. as per the missing value in a VCF) */ @Override protected List<String> parseFilters(final String filterString) { // null for unfiltered if ( filterString.equals(VCFConstants.UNFILTERED) ) return null; if ( filterString.equals(VCFConstants.PASSES_FILTERS_v4) ) return Collections.emptyList(); if ( filterString.equals(VCFConstants.PASSES_FILTERS_v3) ) generateException(VCFConstants.PASSES_FILTERS_v3 + " is an invalid filter name in vcf4", lineNo); if (filterString.isEmpty()) generateException("The VCF specification requires a valid filter status: filter was " + filterString, lineNo); // do we have the filter string cached? if ( filterHash.containsKey(filterString) ) return filterHash.get(filterString); // empty set for passes filters final List<String> fFields = new LinkedList<String>(); // otherwise we have to parse and cache the value if ( !filterString.contains(VCFConstants.FILTER_CODE_SEPARATOR) ) fFields.add(filterString); else fFields.addAll(Arrays.asList(filterString.split(VCFConstants.FILTER_CODE_SEPARATOR))); filterHash.put(filterString, Collections.unmodifiableList(fFields)); return fFields; }
/** * parse the filter string, first checking to see if we already have parsed it in a previous attempt * * @param filterString the string to parse * @return a set of the filters applied or null if filters were not applied to the record (e.g. as per the missing value in a VCF) */ protected List<String> parseFilters(final String filterString) { // null for unfiltered if ( filterString.equals(VCFConstants.UNFILTERED) ) return null; if ( filterString.equals(VCFConstants.PASSES_FILTERS_v4) ) return Collections.emptyList(); if ( filterString.equals(VCFConstants.PASSES_FILTERS_v3) ) generateException(VCFConstants.PASSES_FILTERS_v3 + " is an invalid filter name in vcf4", lineNo); if ( filterString.length() == 0 ) generateException("The VCF specification requires a valid filter status: filter was " + filterString, lineNo); // do we have the filter string cached? if ( filterHash.containsKey(filterString) ) return filterHash.get(filterString); // empty set for passes filters final List<String> fFields = new LinkedList<String>(); // otherwise we have to parse and cache the value if ( !filterString.contains(VCFConstants.FILTER_CODE_SEPARATOR) ) fFields.add(filterString); else fFields.addAll(Arrays.asList(filterString.split(VCFConstants.FILTER_CODE_SEPARATOR))); filterHash.put(filterString, Collections.unmodifiableList(fFields)); return fFields; }