sequence db fetcher metadata for multiple sequence fetch capacity
authorjprocter <Jim Procter>
Fri, 21 Dec 2007 15:02:36 +0000 (15:02 +0000)
committerjprocter <Jim Procter>
Fri, 21 Dec 2007 15:02:36 +0000 (15:02 +0000)
src/jalview/datamodel/DBRefSource.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/SequenceFetcher.java

index 7344c9e..0552b2c 100755 (executable)
@@ -56,10 +56,15 @@ public class DBRefSource
    */
   public static String PFAM = "PFAM";
   /**
+   * GeneDB ID
+   */
+  public static final String GENEDB = "GeneDB";
+
+  /**
    * List of databases whose sequences might have coding regions annotated
    */
-  public static final String[] DNACODINGDBS = { EMBL, EMBLCDS};
-  public static final String[] CODINGDBS = { EMBLCDS};
+  public static final String[] DNACODINGDBS = { EMBL, EMBLCDS, GENEDB};
+  public static final String[] CODINGDBS = { EMBLCDS, GENEDB};
   public static final String[] PROTEINDBS = { UNIPROT, PDB, UNIPROTKB};
   public static final String[] PROTEINSEQ = { UNIPROT, UNIPROTKB};
   public static final String[] PROTEINSTR = { PDB };
@@ -91,7 +96,7 @@ public class DBRefSource
   public static final Object DOMAINDB = "DOMAIN";
   /**
    * DB query can take multiple accession codes concatenated
-   * by a separator.
+   * by a separator. Value of property indicates maximum number of accession codes to send at a time.
    */
   public static final Object MULTIACC = "MULTIACC";
 }
index 1c488fe..938b047 100755 (executable)
@@ -3974,7 +3974,7 @@ public void drop(DropTargetDropEvent evt)
   protected void extractScores_actionPerformed(ActionEvent e)
   {
     ParseProperties pp = new jalview.analysis.ParseProperties(viewport.alignment);
-    if (pp.getScoresFromDescription("col", "score column ", "\\W+([-+]?\\d*\\.?\\d*e?-?\\d*)\\W+([-+]?\\d*\\.?\\d*e?-?\\d*)")>0)
+    if (pp.getScoresFromDescription("col", "score column ", "\\W*([-+]?\\d*\\.?\\d*e?-?\\d*)\\W+([-+]?\\d*\\.?\\d*e?-?\\d*)", true)>0)
     {
       buildSortByAnnotationScoresMenu();
     }
index 70dff68..2d0db64 100755 (executable)
@@ -46,6 +46,7 @@ extends JPanel implements Runnable
   AlignFrame alignFrame;
   StringBuffer result;
   final String noDbSelected = "-- Select Database --";
+  Hashtable sources = new Hashtable();
   public SequenceFetcher(AlignFrame af)
   {
     alignFrame = af;
@@ -57,24 +58,19 @@ extends JPanel implements Runnable
      * internal source to externally distinct names.
      * UNIPROT and UP_NAME are identical DB sources,
      * and should be collapsed. 
-     *
+     */
      
-     String dbs[] = sfetch.getSupportedDb();
+    String dbs[] = sfetch.getSupportedDb();
     for (int i=0; i<dbs.length;i++)
     {
-      if (DBRefSource.isPrimaryDb(dbs[i]))
+      if (!sources.containsValue(dbs[i]))
       {  
-        database.addItem(dbs[i]);
-        // should have some kind of human readable description of each database displayed when
-         * that combo is selected.
-      }
-    }*/
-    database.addItem("Uniprot");
-    database.addItem("EMBL");
-    database.addItem("EMBLCDS");
-    database.addItem("PDB");
-    database.addItem("PFAM");
+        String name = sfetch.getSourceProxy(dbs[i]).getDbName();
 
+        sources.put(name, dbs[i]);
+        database.addItem(name);
+      }
+    }
     try
     {
       jbInit();
@@ -211,7 +207,26 @@ extends JPanel implements Runnable
       resetDialog();
       return;
     }
-
+    AlignmentI aresult=null;
+    try {
+      aresult = sfetch.getSourceProxy((String)sources.get(database.getSelectedItem()))
+      .getSequenceRecords(textArea.getText());
+    }
+    catch (Exception e)
+    {
+      showErrorMessage("Error retrieving " + textArea.getText()
+              + " from " + database.getSelectedItem());
+      //error +="Couldn't retrieve sequences from "+database.getSelectedItem();
+      System.err.println("Retrieval failed for source ='"+database.getSelectedItem()+"' and query\n'"+textArea.getText()+"'\n");
+      e.printStackTrace();
+    }
+    if (aresult!=null)
+    {
+      parseResult(aresult, null, null);
+    }
+    resetDialog();
+  }
+    /*
     result = new StringBuffer();
     if (database.getSelectedItem().equals("Uniprot"))
     {
@@ -476,7 +491,7 @@ extends JPanel implements Runnable
                         + "=" + sq.getStart()
                         + "-" + sq.getEnd());
             sq.getDatasetSequence().addPDBId(entry);
-           */
+           *
           // Add PDB DB Refs
           // We make a DBRefEtntry because we have obtained the PDB file from a verifiable source
           // JBPNote - PDB DBRefEntry should also carry the chain and mapping information
@@ -508,9 +523,9 @@ extends JPanel implements Runnable
       results[i] = (SequenceI) result.elementAt(i);
       result.setElementAt(null,i);
     }
-    return results;
-  }
-  Alignment parseResult(String result, String title)
+    return results; 
+  }*/
+  AlignmentI parseResult(String result, String title)
   {
     String format = new IdentifyFile().Identify(result, "Paste");
     Alignment sequences = null;
@@ -539,7 +554,7 @@ extends JPanel implements Runnable
     return null;
   }
 
-  Alignment parseResult(Alignment al, String title, String currentFileFormat)
+  AlignmentI parseResult(AlignmentI al, String title, String currentFileFormat)
   {
 
     if (al != null && al.getHeight() > 0)