Only fetch refs for seelcted sequences
authoramwaterhouse <Andrew Waterhouse>
Mon, 23 Apr 2007 11:44:46 +0000 (11:44 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 23 Apr 2007 11:44:46 +0000 (11:44 +0000)
src/jalview/io/DBRefFetcher.java
src/jalview/io/DasSequenceFeatureFetcher.java

index 437fee7..6d589f9 100644 (file)
@@ -36,7 +36,7 @@ import jalview.gui.*;
 public class DBRefFetcher\r
     implements Runnable\r
 {\r
-  AlignmentI dataset;\r
+  SequenceI [] dataset;\r
   AlignFrame af;\r
   CutAndPasteTransfer output = new CutAndPasteTransfer();\r
   StringBuffer sbuffer = new StringBuffer();\r
@@ -80,10 +80,18 @@ public class DBRefFetcher
    * @param align DOCUMENT ME!\r
    * @param ap DOCUMENT ME!\r
    */\r
-  public DBRefFetcher(AlignmentI align, AlignFrame af)\r
+  public DBRefFetcher(SequenceI [] seqs, AlignFrame af)\r
   {\r
     this.af = af;\r
-    this.dataset = align.getDataset();\r
+    SequenceI [] ds = new SequenceI[seqs.length];\r
+    for (int i = 0; i < seqs.length; i++)\r
+    {\r
+      if(seqs[i].getDatasetSequence()!=null)\r
+        ds[i] = seqs[i].getDatasetSequence();\r
+      else\r
+        ds[i] = seqs[i];\r
+    }\r
+    this.dataset = ds;\r
   }\r
 \r
   public boolean fetchDBRefs(boolean waitTillFinished)\r
@@ -157,16 +165,15 @@ public class DBRefFetcher
     try\r
     {\r
       int seqIndex = 0;\r
-      Vector sequences = dataset.getSequences();\r
 \r
-      while (seqIndex < sequences.size())\r
+      while (seqIndex < dataset.length)\r
       {\r
         StringBuffer queryString = new StringBuffer("uniprot:");\r
 \r
-        for (int i = 0; (seqIndex < sequences.size()) && (i < 50);\r
+        for (int i = 0; (seqIndex < dataset.length) && (i < 50);\r
              seqIndex++, i++)\r
         {\r
-          Sequence sequence = (Sequence) sequences.get(seqIndex);\r
+          SequenceI sequence = dataset[seqIndex];\r
           DBRefEntry[] uprefs = jalview.util.DBRefUtils.selectRefs(sequence.\r
               getDBRef(), new String[]\r
               {\r
index 33791ad..c8b5d3e 100755 (executable)
@@ -130,8 +130,7 @@ public class DasSequenceFeatureFetcher
   {\r
     public void run()\r
     {\r
-      new DBRefFetcher(\r
-          af.getViewport().getAlignment(), af).fetchDBRefs(true);\r
+      new DBRefFetcher(sequences, af).fetchDBRefs(true);\r
       startFetching();\r
     }\r
   }\r