JAL-2100 triangles shown below in jvdesktop unwrapped ruler
[jalview.git] / src / jalview / ws / seqfetcher / ASequenceFetcher.java
index 9e438d3..2392476 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.ws.seqfetcher;
 
+import jalview.api.FeatureSettingsModelI;
 import jalview.bin.Cache;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.DBRefEntry;
@@ -157,7 +158,8 @@ public class ASequenceFetcher
       Stack<String> queriesLeft = new Stack<String>();
       queriesLeft.addAll(query);
 
-      for (DbSourceProxy fetcher : getSourceProxy(db))
+      List<DbSourceProxy> proxies = getSourceProxy(db);
+      for (DbSourceProxy fetcher : proxies)
       {
         List<String> queriesMade = new ArrayList<String>();
         HashSet<String> queriesFound = new HashSet<String>();
@@ -167,8 +169,7 @@ public class ASequenceFetcher
           {
             continue; // wrong sort of data
           }
-          boolean doMultiple = fetcher.getAccessionSeparator() != null;
-          // No separator - no Multiple Queries
+          boolean doMultiple = fetcher.getMaximumQueryCount() > 1;
           while (!queriesLeft.isEmpty())
           {
             StringBuffer qsb = new StringBuffer();
@@ -187,8 +188,7 @@ public class ASequenceFetcher
             try
             {
               // create a fetcher and go to it
-              seqset = fetcher.getSequenceRecords(qsb.toString()); // ,
-              // queriesFailed);
+              seqset = fetcher.getSequenceRecords(qsb.toString());
             } catch (Exception ex)
             {
               System.err.println("Failed to retrieve the following from "
@@ -206,7 +206,7 @@ public class ASequenceFetcher
                 {
                   rseqs.addElement(seqs[is]);
                   DBRefEntry[] frefs = DBRefUtils.searchRefs(seqs[is]
-                          .getDBRef(), new DBRefEntry(db, null, null));
+                          .getDBRefs(), new DBRefEntry(db, null, null));
                   if (frefs != null)
                   {
                     for (DBRefEntry dbr : frefs)
@@ -255,7 +255,7 @@ public class ASequenceFetcher
         {
           System.out.println("# Adding " + queriesMade.size()
                   + " ids back to queries list for searching again (" + db
-                  + ".");
+                  + ")");
           queriesLeft.addAll(queriesMade);
         }
       }
@@ -436,4 +436,28 @@ public class ASequenceFetcher
     return prlist.toArray(new DbSourceProxy[0]);
   }
 
+  /**
+   * Returns a preferred feature colouring scheme for the given source, or null
+   * if none is defined.
+   * 
+   * @param source
+   * @return
+   */
+  public FeatureSettingsModelI getFeatureColourScheme(String source)
+  {
+    /*
+     * return the first non-null colour scheme for any proxy for
+     * this database source
+     */
+    for (DbSourceProxy proxy : getSourceProxy(source))
+    {
+      FeatureSettingsModelI preferredColours = proxy
+              .getFeatureColourScheme();
+      if (preferredColours != null)
+      {
+        return preferredColours;
+      }
+    }
+    return null;
+  }
 }