* @return
*/
@SuppressWarnings("unchecked")
-private SequenceI parseFeaturesJson(List<String> queries)
+ private SequenceI parseFeaturesJson(List<String> queries)
{
-
-
SequenceI seq = new Sequence("Dummy", "");
-
try
{
-
Iterator<Object> rvals = (Iterator<Object>) getJSON(null, queries, -1, MODE_ITERATOR, null);
if (rvals == null)
+ {
return null;
+ }
while (rvals.hasNext())
{
try
int end = Integer.parseInt(obj.get("end").toString());
String source = obj.get("source").toString();
String strand = obj.get("strand").toString();
+ Object phase = obj.get("phase");
String alleles = JSONUtils
.arrayToStringList((List<Object>) obj.get("alleles"));
String clinSig = JSONUtils
SequenceFeature sf = new SequenceFeature(type, desc, start, end,
source);
sf.setStrand("1".equals(strand) ? "+" : "-");
+ if (phase != null)
+ {
+ sf.setPhase(phase.toString());
+ }
setFeatureAttribute(sf, obj, "id");
setFeatureAttribute(sf, obj, "Parent");
setFeatureAttribute(sf, obj, "consequence_type");
return seq;
}
-
-/**
- * Returns the first non-null attribute found (if any) as a string
+ /**
+ * Returns the first non-null attribute found (if any) as a string, formatted
+ * suitably for display as feature description or tooltip. Answers null if
+ * none of the attribute keys is present.
*
* @param obj
* @param keys
* @return
*/
+ @SuppressWarnings("unchecked")
protected String getFirstNotNull(Map<String, Object> obj, String... keys)
{
- String desc = null;
-
for (String key : keys)
{
Object val = obj.get(key);
if (val != null)
{
- String s = val.toString();
+ String s = val instanceof List<?>
+ ? JSONUtils.arrayToStringList((List<Object>) val)
+ : val.toString();
if (!s.isEmpty())
{
return s;
}
}
}
- return desc;
+ return null;
}
/**