X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2Fvcf%2FVCFLoader.java;h=d4618113a22c73b97dd6a93ba42459515bc777b2;hb=3569b83486d410891bf61fe4157ac48062491e3a;hp=622da73dcf2552da32d3eb91fa9af8691852bea0;hpb=a303b81242b1e3e7c1fdd530806d9a6e69f743a5;p=jalview.git diff --git a/src/jalview/io/vcf/VCFLoader.java b/src/jalview/io/vcf/VCFLoader.java index 622da73..d461811 100644 --- a/src/jalview/io/vcf/VCFLoader.java +++ b/src/jalview/io/vcf/VCFLoader.java @@ -1,6 +1,5 @@ package jalview.io.vcf; -import jalview.analysis.AlignmentUtils; import jalview.analysis.Dna; import jalview.api.AlignViewControllerGuiI; import jalview.bin.Cache; @@ -23,6 +22,8 @@ import jalview.util.MessageManager; import java.io.File; import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -51,6 +52,8 @@ import htsjdk.variant.vcf.VCFInfoHeaderLine; */ public class VCFLoader { + private static final String UTF_8 = "UTF-8"; + private static final String DEFAULT_SPECIES = "homo_sapiens"; /** @@ -654,7 +657,8 @@ public class VCFLoader /* * dna-to-peptide product mapping */ - AlignmentUtils.computeProteinFeatures(seq, mapTo, map); + // JAL-3187 render on the fly instead + // AlignmentUtils.computeProteinFeatures(seq, mapTo, map); } else { @@ -737,7 +741,7 @@ public class VCFLoader String species = seqCoords.getSpeciesId(); String chromosome = seqCoords.getChromosomeId(); String seqRef = seqCoords.getAssemblyId(); - MapList map = seqCoords.getMap(); + MapList map = seqCoords.getMapping(); // note this requires the configured species to match that // returned with the Ensembl sequence; todo: support aliases? @@ -1189,14 +1193,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') @@ -1235,6 +1231,16 @@ public class VCFLoader String value = getAttributeValue(variant, key, index); if (value != null) { + /* + * VCF spec requires encoding of special characters e.g. '=' + * so decode them here before storing + */ + try + { + value = URLDecoder.decode(value, UTF_8); + } catch (UnsupportedEncodingException e) + { + } sf.setValue(key, value); } } @@ -1288,6 +1294,16 @@ public class VCFLoader String id = vepFieldsOfInterest.get(i); if (id != null) { + /* + * VCF spec requires encoding of special characters e.g. '=' + * so decode them here before storing + */ + try + { + field = URLDecoder.decode(field, UTF_8); + } catch (UnsupportedEncodingException e) + { + } csqValues.put(id, field); } }