+ Console.warn("Couln't import contact matrix from " + paeURL
+ + " (stored in " + pae.toString() + ")");
+ }
+ } catch (Exception pae_ex)
+ {
+ Console.error("Couldn't download PAE", pae_ex);
+ }
+
+ }
+
+ /**
+ * parses the given pAE matrix and adds it to sequence 0 in the given
+ * alignment
+ *
+ * @param pdbAlignment
+ * @param pae_input
+ * @return true if there was a pAE matrix added
+ * @throws Exception
+ */
+ public static boolean importPaeJSONAsContactMatrix(
+ AlignmentI pdbAlignment, InputStream pae_input) throws Exception
+ {
+
+ List<Object> pae_obj = (List<Object>) Platform.parseJSON(pae_input);
+ if (pae_obj == null)
+ {
+ return false;
+ }
+ ContactMatrixI matrix = new PAEContactMatrix(
+ pdbAlignment.getSequenceAt(0),
+ (Map<String, Object>) pae_obj.get(0));
+
+ AlignmentAnnotation cmannot = pdbAlignment.getSequenceAt(0)
+ .addContactList(matrix);
+ pdbAlignment.addAnnotation(cmannot);
+ return true;
+ }
+
+ /**
+ * general purpose structure importer - designed to yield alignment useful for
+ * transfer of annotation to associated sequences
+ *
+ * @param alphaFoldCif
+ * @param tmpFile
+ * @param id
+ * @param chain
+ * @param dbSource
+ * @param dbVersion
+ * @return
+ * @throws Exception
+ */
+ public static AlignmentI importDownloadedStructureFromUrl(
+ String alphaFoldCif, File tmpFile, String id, String chain,
+ String dbSource, String dbVersion) throws Exception
+ {
+ String file = tmpFile.getAbsolutePath();
+ // todo get rid of Type and use FileFormatI instead?
+ FileFormatI fileFormat = FileFormat.MMCif;
+ AlignmentI pdbAlignment = new FormatAdapter().readFile(tmpFile,
+ DataSourceType.FILE, fileFormat);
+ if (pdbAlignment != null)
+ {
+ List<SequenceI> toremove = new ArrayList<SequenceI>();
+ for (SequenceI pdbcs : pdbAlignment.getSequences())
+ {
+ String chid = null;
+ // Mapping map=null;
+ for (PDBEntry pid : pdbcs.getAllPDBEntries())