seqIndex++, i++)\r
{\r
SequenceI sequence = (SequenceI) sequences.get(seqIndex);\r
- if(!ids.contains(sequence.getName()))\r
+ if(!ids.contains(sequence.getShortName()))\r
{\r
- ids.add(sequence.getName());\r
- unknownSequences.add(sequence.getName());\r
+ ids.add(sequence.getShortName());\r
+ unknownSequences.add(sequence);\r
}\r
}\r
\r
{\r
entry = (UniprotEntry) entries.elementAt(i);\r
String idmatch = entry.getAccession().elementAt(0).toString();\r
- sequence = dataset.findName(idmatch);\r
+ sequence = dataset.findShortName(idmatch);\r
\r
if (sequence == null)\r
{\r
//Sequence maybe Name, not Accession\r
idmatch = entry.getName().elementAt(0).toString();;\r
- sequence = dataset.findName(idmatch);\r
+ sequence = dataset.findShortName(idmatch);\r
}\r
\r
if (sequence == null)\r
}\r
\r
ids.remove(sequence.getName());\r
- unknownSequences.remove(sequence.getName());\r
+ unknownSequences.remove(sequence);\r
\r
String nonGapped = AlignSeq.extractGaps("-. ", sequence.getSequence());\r
\r
import javax.swing.*;\r
\r
import javax.xml.namespace.QName;\r
+import jalview.analysis.AlignSeq;\r
\r
\r
/**\r
CutAndPasteTransfer output = new CutAndPasteTransfer();\r
int jobsRunning = 0;\r
\r
- Hashtable suggestedIds = new Hashtable();\r
+ Vector suggestedIds = new Vector();\r
/**\r
* Creates a new WSWUBlastClient object.\r
*\r
\r
for (int i = 0; i < ids.size(); i++)\r
{\r
- SequenceI sequence = al.findName(ids.get(i).toString());\r
- System.out.println(ids.get(i).toString());\r
- StringBuffer nonGapped = new StringBuffer();\r
+ Sequence sequence = (Sequence)ids.get(i);\r
+ System.out.println(sequence.getName());\r
\r
-\r
- for (int n = 0; n < sequence.getSequence().length(); n++)\r
- {\r
- if (!jalview.util.Comparison.isGap(sequence.getCharAt(n)))\r
- {\r
- nonGapped.append(sequence.getCharAt(n));\r
- }\r
- }\r
-\r
- BlastThread thread = new BlastThread(ids.get(i).toString(),\r
- nonGapped.toString());\r
+ BlastThread thread = new BlastThread(sequence);\r
thread.start();\r
jobsRunning++;\r
}\r
* @param id1 DOCUMENT ME!\r
* @param res DOCUMENT ME!\r
*/\r
- void parseResult(String id1, String res)\r
+ void parseResult(Sequence seq, String res)\r
{\r
StringTokenizer st = new StringTokenizer(res, "\n");\r
String data;\r
String id2;\r
int maxFound = 90;\r
- StringBuffer buffer = new StringBuffer("\n\n" + id1 + " :");\r
+ StringBuffer buffer = new StringBuffer("\n\n" + seq.getShortName() + " :");\r
\r
while (st.hasMoreTokens())\r
{\r
{\r
maxFound = value;\r
buffer.append(" " + id2 + " " + value + "%; ");\r
- if(!suggestedIds.containsKey(id1))\r
- {\r
- suggestedIds.put(id1, id2);\r
- }\r
+ suggestedIds.addElement( new Object[]{seq, id2});\r
}\r
}\r
}\r
\r
if (reply == JOptionPane.YES_OPTION)\r
{\r
- Enumeration keys = suggestedIds.keys();\r
+ Enumeration keys = suggestedIds.elements();\r
while(keys.hasMoreElements())\r
{\r
- String oldid = keys.nextElement().toString();\r
- SequenceI sequence = al.findName(oldid);\r
- sequence.setName( suggestedIds.get(oldid).toString() );\r
+ Object [] object = (Object[])keys.nextElement();\r
\r
- sequence = sequence.getDatasetSequence();\r
- if(sequence!=null)\r
- {\r
+ Sequence oldseq = (Sequence)object[0];\r
\r
- sequence.setName(suggestedIds.get(oldid).toString());\r
+ oldseq.setName( object[1].toString() );\r
\r
- Vector entries = sequence.getDBRef();\r
- if(entries!=null)\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
- DBRefEntry entry = (DBRefEntry) entries.elementAt(0);\r
- sequence.addDBRef(new jalview.datamodel.DBRefEntry("UNIPROT",\r
- "0",\r
- entry.getAccessionId()));\r
+ al.getSequenceAt(i).setName(oldseq.getName());\r
+ break;\r
}\r
}\r
- System.out.println("replace "+oldid+" with "+suggestedIds.get(oldid));\r
+\r
+ Vector entries = oldseq.getDBRef();\r
+ if (entries != null)\r
+ {\r
+ DBRefEntry entry = (DBRefEntry) entries.elementAt(0);\r
+ oldseq.addDBRef(new jalview.datamodel.\r
+ DBRefEntry("UNIPROT",\r
+ "0",\r
+ entry.getAccessionId()));\r
+ }\r
}\r
}\r
ap.repaint();\r
\r
class BlastThread extends Thread\r
{\r
- String sequence;\r
- String seqid;\r
+ Sequence sequence;\r
String jobid;\r
boolean jobComplete = false;\r
\r
- BlastThread(String id, String sequence)\r
+ BlastThread(Sequence sequence)\r
{\r
- System.out.println("blasting for: "+id);\r
- this.sequence = sequence;\r
- seqid = id;\r
+ System.out.println("blasting for: "+sequence.getName());\r
+ this.sequence = sequence;\r
}\r
\r
public void run()\r
\r
if(object instanceof String)\r
{\r
- parseResult(seqid, (String)object);\r
+ parseResult(sequence, (String)object);\r
jobComplete = true;\r
jobsRunning--;\r
}\r
\r
Thread.sleep(5000);\r
\r
- System.out.println("WSWuBlastClient: I'm alive "+seqid+" "+jobid); // log.debug\r
+ System.out.println("WSWuBlastClient: I'm alive "+sequence.getShortName()+" "+jobid); // log.debug\r
}\r
catch (Exception ex)\r
{\r
params.put("type", "xml");\r
params.put("async", "true");\r
\r
- byte[] seqbytes = sequence.getBytes();\r
+ byte[] seqbytes = AlignSeq.extractGaps("-. ",\r
+ sequence.getSequence()).getBytes();\r
\r
try\r
{\r
{\r
jobComplete = true;\r
jobsRunning--;\r
- parseResult(seqid, (String)object);\r
+ parseResult(sequence, (String)object);\r
}\r
\r
}\r