+ int index = data.indexOf(">UNIPROT") + 9;\r
+ id2 = data.substring(index, data.indexOf(" ", index));\r
+\r
+ boolean identitiesFound = false;\r
+ while (!identitiesFound)\r
+ {\r
+ data = st.nextToken();\r
+\r
+ if (data.indexOf("Identities") > -1)\r
+ {\r
+ identitiesFound = true;\r
+\r
+ int value = Integer.parseInt(data.substring(data.indexOf(\r
+ "(") + 1,\r
+ data.indexOf("%")));\r
+\r
+ if (value >= maxFound)\r
+ {\r
+ maxFound = value;\r
+ buffer.append(" " + id2 + " " + value + "%; ");\r
+ suggestedIds.addElement(new Object[]\r
+ {seq, id2});\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ output.appendText(buffer.toString());\r
+ }\r
+\r
+ void updateIds()\r
+ {\r
+ // This must be outside the run() body as java 1.5\r
+ // will not return any value from the OptionPane to the expired thread.\r
+ int reply = JOptionPane.showConfirmDialog(\r
+ Desktop.desktop, "Automatically update suggested ids?",\r
+ "Auto replace sequence ids", JOptionPane.YES_NO_OPTION);\r
+\r
+ if (reply == JOptionPane.YES_OPTION)\r
+ {\r
+ Enumeration keys = suggestedIds.elements();\r
+ while (keys.hasMoreElements())\r
+ {\r
+ Object[] object = (Object[]) keys.nextElement();\r
+\r
+ Sequence oldseq = (Sequence) object[0];\r
+\r
+ oldseq.setName(object[1].toString());\r
+\r
+ // Oldseq is actually in the dataset, we must find the\r
+ // Visible seq and change its name also.\r
+ for (int i = 0; i < al.getHeight(); i++)\r
+ {\r
+ if (al.getSequenceAt(i).getDatasetSequence() == oldseq)\r
+ {\r
+ al.getSequenceAt(i).setName(oldseq.getName());\r
+ break;\r
+ }\r
+ }\r
+\r
+ DBRefEntry[] entries = oldseq.getDBRef();\r
+ if (entries != null)\r
+ {\r
+ oldseq.addDBRef(new jalview.datamodel.\r
+ DBRefEntry(jalview.datamodel.DBRefSource.UNIPROT,\r
+ "0",\r
+ entries[0].getAccessionId()));\r
+ }\r