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;
*/
public class VCFLoader
{
+ private static final String UTF_8 = "UTF-8";
+
private static final String DEFAULT_SPECIES = "homo_sapiens";
/**
}
/*
- * 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')
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);
}
}
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);
}
}