git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-1793 apply URL decoding when saving VCF attribute values (%3D -> =)
[jalview.git]
/
src
/
jalview
/
io
/
vcf
/
VCFLoader.java
diff --git
a/src/jalview/io/vcf/VCFLoader.java
b/src/jalview/io/vcf/VCFLoader.java
index
622da73
..
d461811
100644
(file)
--- a/
src/jalview/io/vcf/VCFLoader.java
+++ b/
src/jalview/io/vcf/VCFLoader.java
@@
-1,6
+1,5
@@
package jalview.io.vcf;
package jalview.io.vcf;
-import jalview.analysis.AlignmentUtils;
import jalview.analysis.Dna;
import jalview.api.AlignViewControllerGuiI;
import jalview.bin.Cache;
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.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;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@
-51,6
+52,8
@@
import htsjdk.variant.vcf.VCFInfoHeaderLine;
*/
public class VCFLoader
{
*/
public class VCFLoader
{
+ private static final String UTF_8 = "UTF-8";
+
private static final String DEFAULT_SPECIES = "homo_sapiens";
/**
private static final String DEFAULT_SPECIES = "homo_sapiens";
/**
@@
-654,7
+657,8
@@
public class VCFLoader
/*
* dna-to-peptide product mapping
*/
/*
* dna-to-peptide product mapping
*/
- AlignmentUtils.computeProteinFeatures(seq, mapTo, map);
+ // JAL-3187 render on the fly instead
+ // AlignmentUtils.computeProteinFeatures(seq, mapTo, map);
}
else
{
}
else
{
@@
-737,7
+741,7
@@
public class VCFLoader
String species = seqCoords.getSpeciesId();
String chromosome = seqCoords.getChromosomeId();
String seqRef = seqCoords.getAssemblyId();
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?
// 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')
* 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)
{
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);
}
}
sf.setValue(key, value);
}
}
@@
-1288,6
+1294,16
@@
public class VCFLoader
String id = vepFieldsOfInterest.get(i);
if (id != null)
{
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);
}
}
csqValues.put(id, field);
}
}