}
}
+ JSONObject paeDict = parseJSONtoPAEContactMatrix(pae_input);
+ if (paeDict == null)
+ {
+ Console.debug("JSON file did not parse properly.");
+ return false;
+ }
+ ContactMatrixI matrix = new PAEContactMatrix(sequence,
+ (Map<String, Object>) paeDict);
+
+ AlignmentAnnotation cmannot = sequence.addContactList(matrix);
+ pdbAlignment.addAnnotation(cmannot);
+
+ return true;
+ }
+
+ public static JSONObject parseJSONtoPAEContactMatrix(
+ InputStream pae_input) throws IOException, ParseException
+ {
Object paeJson = Platform.parseJSON(pae_input);
JSONObject paeDict = null;
if (paeJson instanceof JSONObject)
paeDict = (JSONObject) jsonArray.get(0);
}
- if (paeDict == null)
- {
- Console.debug("JSON file did not parse properly.");
- return false;
- }
- ContactMatrixI matrix = new PAEContactMatrix(sequence,
- (Map<String, Object>) paeDict);
-
- AlignmentAnnotation cmannot = sequence.addContactList(matrix);
- pdbAlignment.addAnnotation(cmannot);
-
- return true;
+ return paeDict;
}
public static boolean importPaeJSONAsContactMatrixToStructure(
throws IOException, ParseException
{
- List<Object> pae_obj = (List<Object>) Platform.parseJSON(paeInput);
+ JSONObject pae_obj = parseJSONtoPAEContactMatrix(paeInput);
if (pae_obj == null)
{
Console.debug("JSON file did not parse properly.");
}
ContactMatrixI matrix = new PAEContactMatrix(sm.getSequence(),
- (Map<String, Object>) pae_obj.get(0));
+ (Map<String, Object>) pae_obj);
AlignmentAnnotation cmannot = sm.getSequence().addContactList(matrix);
// sm.getSequence().addAlignmentAnnotation(cmannot);