Merge branch 'develop' into features/JAL-2110_crossRefDuplications
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 14 Jun 2016 12:44:53 +0000 (13:44 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 14 Jun 2016 12:44:53 +0000 (13:44 +0100)
17 files changed:
help/html/releases.html
src/jalview/ext/paradise/Annotate3D.java
src/jalview/fts/api/FTSRestClientI.java
src/jalview/fts/core/FTSDataColumnPreferences.java
src/jalview/fts/core/FTSRestClient.java
src/jalview/fts/core/GFTSPanel.java
src/jalview/fts/service/pdb/PDBFTSPanel.java
src/jalview/fts/service/pdb/PDBFTSRestClient.java
src/jalview/fts/service/uniprot/UniprotFTSPanel.java
src/jalview/gui/StructureChooser.java
src/jalview/io/StructureFile.java
src/jalview/jbgui/GStructureChooser.java
src/jalview/structure/StructureSelectionManager.java
src/jalview/ws/sifts/SiftsClient.java
test/jalview/ext/paradise/TestAnnotate3D.java
test/jalview/fts/core/FTSRestClientTest.java
test/jalview/ws/sifts/SiftsClientTest.java

index 6f1c351..2b2184b 100755 (executable)
     <tr>
       <td width="60" nowrap>
         <div align="center">
-          <strong><a name="Jalview.2.9.1">2.9.1</a><br /> <em>14/6/2016</em></strong>
+          <strong><a name="Jalview.2.9.1">2.9.1</a><br /> <em>21/6/2016</em></strong>
         </div>
       </td>
       <td><em>General</em>
         <ul>
-          <li></li>
+            <li><!-- JAL---></li>
         </ul> <em>Application</em>
         <ul>
-          <li></li>
+            <li><!-- JAL---></li>
+            <li><!-- JAL-2027-->Support for reverse-complement coding regions in ENA and EMBL</li>
+            <li><!-- JAL-1855, JAL-2113, JAL-2114-->Upgrade to EMBL XML 1.2 for ENA record retrieval</li>
         </ul> <em>Applet</em>
         <ul>
-          <li></li>
+            <li><!-- JAL---></li>
         </ul></td>
       <td>
         <div align="left">
           <em>General</em>
           <ul>
             <li><!-- JAL-2077 -->reinstate CTRL-click for opening pop-up menu on OSX</li>
+            <li><!-- JAL-2018-->Export features in Jalview format (again) includes graduated colourschemes</li>
+            <li><!-- JAL-1722, JAL-2001-->More responsive when working with big alignments and lots of hidden columns</li>
+            <li><!-- JAL-2053-->hidden column markers not always rendered at right of alignment window</li>
+            <li><!-- JAL-2067, JAL-  -->Tidied up links in help file table of contents</li>
+            <li><!-- JAL-2072  -->Feature based tree calculation not shown for DNA alignments</li>
+            <li><!-- JAL-2075  -->Hidden columns ignored during feature based tree calculation</li>
+            
           </ul>
           <em>Application</em>
           <ul>
-            <li></li>
+            <li><!-- JAL-1944 not yet fixed Error thrown when exporting a view with hidden sequences as flat-file alignment--></li>
+            <li><!-- JAL-1911-->Corrupt preferences for SVG, EPS & HTML output when running on non-gb/us i18n platforms</li>
+            <li><!-- JAL-1552-->URLs and links can imported by drag'n'drop on OSX webstart</li>
+            <li><!-- JAL-2030-->InstallAnywhere distribution fails when launching Chimera</li>
+            <li><!-- JAL-2080-->Jalview very slow to launch via webstart (also hotfix for 2.9.0b2)</li>
+            <!--  may exclude, this is an external service stability issue  JAL-1941 /> RNA 3D structure not added via DSSR service</li> -->
           </ul>
           <em>Applet</em>
           <ul>
-            <li></li>
+            <li><!--  --></li>
           </ul>
         </div>
       </td>
index 85c84ab..5b75206 100644 (file)
@@ -45,13 +45,20 @@ import org.json.simple.parser.ParseException;
  * 
  * @author jimp
  * 
- *         History: v1.0 revised from original due to refactoring of
- *         paradise-ubmc.u-strasbg.fr/webservices/annotate3d to
- *         http://arn-ibmc.in2p3.fr/api/compute/2d?tool=rnaview
+ * @version v1.0 revised from original due to refactoring of
+ *          paradise-ubmc.u-strasbg.fr/webservices/annotate3d to
+ *          http://arn-ibmc.in2p3.fr/api/compute/2d?tool=rnaview <br/>
+ *          See also testing URL from fjossinet:<br/>
+ *          http://charn2-ibmc.u-strasbg.fr:8080/api/compute/2d <br/>
+ *          If in doubt, check against the REST client at:
+ *          https://github.com/fjossinet/RNA-Science
+ *          -Toolbox/blob/master/pyrna/restclient.py
  */
 public class Annotate3D
 {
-  private static String twoDtoolsURL = "http://arn-ibmc.in2p3.fr/api/compute/2d";
+  // also test with
+  // "http://charn2-ibmc.u-strasbg.fr:8080/api/compute/2d";
+  private static String twoDtoolsURL = "http://arn-ibmc.in2p3.fr/api/compute/2d?tool=rnaview";
 
   private static ContentHandler createContentHandler()
   {
index 2266ca0..3701c76 100644 (file)
@@ -115,7 +115,7 @@ public interface FTSRestClientI
    * 
    * @return list of columns to display by default
    */
-  public Collection<FTSDataColumnI> getAllDefaulDisplayedDataColumns();
+  public Collection<FTSDataColumnI> getAllDefaultDisplayedFTSDataColumns();
 
   /**
    * Return list of FTSDataColumnI objects that can be used to perform a search
index cddcc8e..eb7455e 100644 (file)
@@ -23,6 +23,7 @@ package jalview.fts.core;
 import jalview.fts.api.FTSDataColumnI;
 import jalview.fts.api.FTSDataColumnI.FTSDataColumnGroupI;
 import jalview.fts.api.FTSRestClientI;
+import jalview.fts.service.pdb.PDBFTSRestClient;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -67,11 +68,12 @@ public class FTSDataColumnPreferences extends JScrollPane
           FTSRestClientI ftsRestClient)
   {
     this.ftsRestClient = ftsRestClient;
-    Collection<FTSDataColumnI> defaultCols = ftsRestClient
-            .getAllDefaulDisplayedDataColumns();
-
-    structSummaryColumns.addAll(defaultCols);
-
+    if (source.equals(PreferenceSource.STRUCTURE_CHOOSER)
+            || source.equals(PreferenceSource.PREFERENCES))
+    {
+    structSummaryColumns = ((PDBFTSRestClient) ftsRestClient)
+              .getAllDefaultDisplayedStructureDataColumns();
+    }
     allFTSDataColumns.addAll(ftsRestClient.getAllFTSDataColumns());
 
     tbl_FTSDataColumnPrefs.setAutoCreateRowSorter(true);
@@ -109,7 +111,7 @@ public class FTSDataColumnPreferences extends JScrollPane
       {
       case SEARCH_SUMMARY:
         data[x++] = new Object[] {
-            ftsRestClient.getAllDefaulDisplayedDataColumns()
+            ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
                     .contains(field),
             field.getName(), field.getGroup() };
         break;
@@ -119,7 +121,7 @@ public class FTSDataColumnPreferences extends JScrollPane
         break;
       case PREFERENCES:
         data[x++] = new Object[] { field.getName(),
-            ftsRestClient.getAllDefaulDisplayedDataColumns()
+            ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
                     .contains(field),
             structSummaryColumns.contains(field) };
         break;
@@ -300,7 +302,7 @@ public class FTSDataColumnPreferences extends JScrollPane
       if (currentSource == PreferenceSource.SEARCH_SUMMARY)
       {
         updatePrefs(ftsRestClient
-                .getAllDefaulDisplayedDataColumns(), ftsDataColumn,
+                .getAllDefaultDisplayedFTSDataColumns(), ftsDataColumn,
                 selected);
       }
       else if (currentSource == PreferenceSource.STRUCTURE_CHOOSER)
@@ -312,7 +314,7 @@ public class FTSDataColumnPreferences extends JScrollPane
         if (col == 1)
         {
           updatePrefs(ftsRestClient
-                  .getAllDefaulDisplayedDataColumns(), ftsDataColumn,
+                  .getAllDefaultDisplayedFTSDataColumns(), ftsDataColumn,
                   selected);
         }
         else if (col == 2)
index f2df461..00a081b 100644 (file)
@@ -367,7 +367,7 @@ public abstract class FTSRestClient implements FTSRestClientI
   }
 
   @Override
-  public Collection<FTSDataColumnI> getAllDefaulDisplayedDataColumns()
+  public Collection<FTSDataColumnI> getAllDefaultDisplayedFTSDataColumns()
   {
     if (defaulDisplayedDataColumns == null
             || defaulDisplayedDataColumns.isEmpty())
index ee71407..b288aa5 100644 (file)
@@ -548,7 +548,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
           txt_search.setEnabled(false);
           cmb_searchTarget.setEnabled(false);
           previousWantedFields = getFTSRestClient()
-                  .getAllDefaulDisplayedDataColumns()
+                  .getAllDefaultDisplayedFTSDataColumns()
                   .toArray(new Object[0]);
         }
         if (sourceTabbedPane.getTitleAt(index).equals(searchTabTitle))
@@ -648,7 +648,7 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI
     }
 
     return Arrays.equals(getFTSRestClient()
-            .getAllDefaulDisplayedDataColumns()
+            .getAllDefaultDisplayedFTSDataColumns()
             .toArray(new Object[0]), previousWantedFields) ? false
             : true;
 
index 0dd1369..32c171e 100644 (file)
@@ -71,7 +71,7 @@ public class PDBFTSPanel extends GFTSPanel
           String searchTarget = ((FTSDataColumnI) cmb_searchTarget
                   .getSelectedItem()).getCode();
           wantedFields = PDBFTSRestClient.getInstance()
-                  .getAllDefaulDisplayedDataColumns();
+                  .getAllDefaultDisplayedFTSDataColumns();
           String searchTerm = decodeSearchTerm(txt_search.getText(),
                   searchTarget);
 
index 93a7df3..219d6d6 100644 (file)
@@ -414,4 +414,18 @@ public class PDBFTSRestClient extends FTSRestClient
     }
     return instance;
   }
+
+  private Collection<FTSDataColumnI> allDefaultDisplayedStructureDataColumns;
+
+  public Collection<FTSDataColumnI> getAllDefaultDisplayedStructureDataColumns()
+  {
+    if (allDefaultDisplayedStructureDataColumns == null
+            || allDefaultDisplayedStructureDataColumns.isEmpty())
+    {
+      allDefaultDisplayedStructureDataColumns = new ArrayList<FTSDataColumnI>();
+      allDefaultDisplayedStructureDataColumns.addAll(super
+              .getAllDefaultDisplayedFTSDataColumns());
+    }
+    return allDefaultDisplayedStructureDataColumns;
+  }
 }
index f2fcb76..b1aa5f1 100644 (file)
@@ -74,7 +74,7 @@ public class UniprotFTSPanel extends GFTSPanel
                   .getSelectedItem()).getAltCode();
 
           wantedFields = UniProtFTSRestClient.getInstance()
-                  .getAllDefaulDisplayedDataColumns();
+                  .getAllDefaultDisplayedFTSDataColumns();
           String searchTerm = decodeSearchTerm(txt_search.getText(),
                   searchTarget);
 
index 2972c69..426f092 100644 (file)
@@ -148,8 +148,8 @@ public class StructureChooser extends GStructureChooser implements
   {
     long startTime = System.currentTimeMillis();
     pdbRestCleint = PDBFTSRestClient.getInstance();
-    Collection<FTSDataColumnI> wantedFields = pdbRestCleint
-            .getAllDefaulDisplayedDataColumns();
+    Collection<FTSDataColumnI> wantedFields = pdbDocFieldPrefs
+            .getStructureSummaryFields();
 
     discoveredStructuresSet = new LinkedHashSet<FTSData>();
     HashSet<String> errors = new HashSet<String>();
@@ -186,7 +186,8 @@ public class StructureChooser extends GStructureChooser implements
     if (discoveredStructuresSet != null
             && !discoveredStructuresSet.isEmpty())
     {
-      tbl_summary.setModel(FTSRestResponse.getTableModel(lastPdbRequest,
+      getResultTable().setModel(
+              FTSRestResponse.getTableModel(lastPdbRequest,
               discoveredStructuresSet));
       structuresDiscovered = true;
       noOfStructuresFound = discoveredStructuresSet.size();
@@ -397,8 +398,8 @@ public class StructureChooser extends GStructureChooser implements
         long startTime = System.currentTimeMillis();
         pdbRestCleint = PDBFTSRestClient.getInstance();
         lbl_loading.setVisible(true);
-        Collection<FTSDataColumnI> wantedFields = pdbRestCleint
-                .getAllDefaulDisplayedDataColumns();
+        Collection<FTSDataColumnI> wantedFields = pdbDocFieldPrefs
+                .getStructureSummaryFields();
         Collection<FTSData> filteredResponse = new HashSet<FTSData>();
         HashSet<String> errors = new HashSet<String>();
 
@@ -454,15 +455,18 @@ public class StructureChooser extends GStructureChooser implements
           Collection<FTSData> reorderedStructuresSet = new LinkedHashSet<FTSData>();
           reorderedStructuresSet.addAll(filteredResponse);
           reorderedStructuresSet.addAll(discoveredStructuresSet);
-          tbl_summary.setModel(FTSRestResponse.getTableModel(
+          getResultTable().setModel(
+                  FTSRestResponse.getTableModel(
                   lastPdbRequest, reorderedStructuresSet));
 
-          FTSRestResponse.configureTableColumn(tbl_summary, wantedFields);
-          tbl_summary.getColumn("Ref Sequence").setPreferredWidth(120);
-          tbl_summary.getColumn("Ref Sequence").setMinWidth(100);
-          tbl_summary.getColumn("Ref Sequence").setMaxWidth(200);
+          FTSRestResponse.configureTableColumn(getResultTable(),
+                  wantedFields);
+          getResultTable().getColumn("Ref Sequence").setPreferredWidth(120);
+          getResultTable().getColumn("Ref Sequence").setMinWidth(100);
+          getResultTable().getColumn("Ref Sequence").setMaxWidth(200);
           // Update table selection model here
-          tbl_summary.addRowSelectionInterval(0, filterResponseCount - 1);
+          getResultTable().addRowSelectionInterval(0,
+                  filterResponseCount - 1);
           mainFrame.setTitle(MessageManager.formatMessage(
                   "label.structure_chooser_filter_time", totalTime));
         }
@@ -591,7 +595,7 @@ public class StructureChooser extends GStructureChooser implements
     String currentView = selectedFilterOpt.getView();
     if (currentView == VIEWS_FILTER)
     {
-      if (tbl_summary.getSelectedRows().length > 0)
+      if (getResultTable().getSelectedRows().length > 0)
       {
         btn_view.setEnabled(true);
       }
@@ -729,19 +733,21 @@ public class StructureChooser extends GStructureChooser implements
     String currentView = selectedFilterOpt.getView();
     if (currentView == VIEWS_FILTER)
     {
-          int pdbIdColIndex = tbl_summary.getColumn("PDB Id")
+          int pdbIdColIndex = getResultTable().getColumn("PDB Id")
                   .getModelIndex();
-          int refSeqColIndex = tbl_summary.getColumn("Ref Sequence")
+          int refSeqColIndex = getResultTable().getColumn("Ref Sequence")
               .getModelIndex();
-          int[] selectedRows = tbl_summary.getSelectedRows();
+          int[] selectedRows = getResultTable().getSelectedRows();
       PDBEntry[] pdbEntriesToView = new PDBEntry[selectedRows.length];
       int count = 0;
       ArrayList<SequenceI> selectedSeqsToView = new ArrayList<SequenceI>();
       for (int row : selectedRows)
       {
-            String pdbIdStr = tbl_summary.getValueAt(row, pdbIdColIndex)
+            String pdbIdStr = getResultTable().getValueAt(row,
+                    pdbIdColIndex)
                 .toString();
-            SequenceI selectedSeq = (SequenceI) tbl_summary.getValueAt(row,
+            SequenceI selectedSeq = (SequenceI) getResultTable()
+                    .getValueAt(row,
                 refSeqColIndex);
         selectedSeqsToView.add(selectedSeq);
             PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr);
@@ -962,7 +968,7 @@ public class StructureChooser extends GStructureChooser implements
         {
           String searchTerm = txt_search.getText().toLowerCase();
           searchTerm = searchTerm.split(":")[0];
-          System.out.println(">>>>> search term : " + searchTerm);
+          // System.out.println(">>>>> search term : " + searchTerm);
           List<FTSDataColumnI> wantedFields = new ArrayList<FTSDataColumnI>();
           FTSRestRequest pdbRequest = new FTSRestRequest();
           pdbRequest.setAllowEmptySeq(false);
index af5a1fa..6a236fd 100644 (file)
@@ -297,6 +297,7 @@ public abstract class StructureFile extends AlignFile
     } catch (ClassNotFoundException q)
     {
     }
+    StructureViewSettings.setShowSeqFeatures(true);
   }
 
   public PDBChain findChain(String id) throws Exception
index a1aa0d3..e9eab82 100644 (file)
@@ -165,13 +165,13 @@ public abstract class GStructureChooser extends JPanel implements
 
   private JTabbedPane pnl_filter = new JTabbedPane();
 
-  private FTSDataColumnPreferences pdbDocFieldPrefs = new FTSDataColumnPreferences(
+  protected FTSDataColumnPreferences pdbDocFieldPrefs = new FTSDataColumnPreferences(
           PreferenceSource.STRUCTURE_CHOOSER,
           PDBFTSRestClient.getInstance());
 
   protected FTSDataColumnI[] previousWantedFields;
 
-  protected JTable tbl_summary = new JTable()
+  private JTable tbl_summary = new JTable()
   {
     private boolean inLayout;
 
@@ -440,11 +440,9 @@ public abstract class GStructureChooser extends JPanel implements
       }
     });
 
-    scrl_foundStructures.setPreferredSize(new Dimension(500, 300));
-    scrl_foundStructures
-            .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+    scrl_foundStructures.setPreferredSize(new Dimension(800, 400));
 
-    scrl_localPDB.setPreferredSize(new Dimension(500, 300));
+    scrl_localPDB.setPreferredSize(new Dimension(800, 400));
     scrl_localPDB
             .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
 
@@ -521,9 +519,9 @@ public abstract class GStructureChooser extends JPanel implements
           btn_cancel.setEnabled(false);
           btn_view.setVisible(false);
           btn_cancel.setVisible(false);
-          previousWantedFields = PDBFTSRestClient.getInstance()
-                  .getAllDefaulDisplayedDataColumns()
-                  .toArray(new FTSDataColumnI[0]);
+          previousWantedFields = pdbDocFieldPrefs
+                  .getStructureSummaryFields().toArray(
+                          new FTSDataColumnI[0]);
         }
         if (sourceTabbedPane.getTitleAt(index)
                 .equals(foundStructureSummary))
@@ -541,7 +539,7 @@ public abstract class GStructureChooser extends JPanel implements
       }
     };
     pnl_filter.addChangeListener(changeListener);
-    pnl_filter.setPreferredSize(new Dimension(500, 300));
+    pnl_filter.setPreferredSize(new Dimension(800, 400));
     pnl_filter.add(foundStructureSummary, scrl_foundStructures);
     pnl_filter.add(configureCols, pdbDocFieldPrefs);
 
@@ -565,7 +563,7 @@ public abstract class GStructureChooser extends JPanel implements
     mainFrame.setVisible(true);
     mainFrame.setContentPane(this);
     mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
-    Desktop.addInternalFrame(mainFrame, frameTitle, 800, 400);
+    Desktop.addInternalFrame(mainFrame, frameTitle, 900, 500);
   }
 
   public boolean wantedFieldsUpdated()
@@ -574,12 +572,12 @@ public abstract class GStructureChooser extends JPanel implements
     {
       return true;
     }
-
-    return Arrays.equals(
-            PDBFTSRestClient.getInstance()
-                    .getAllDefaulDisplayedDataColumns()
-            .toArray(new FTSDataColumnI[0]),
-            previousWantedFields) ? false : true;
+    
+    FTSDataColumnI[] currentWantedFields = pdbDocFieldPrefs
+            .getStructureSummaryFields()
+            .toArray(new FTSDataColumnI[0]);
+    return Arrays.equals(currentWantedFields, previousWantedFields) ? false
+            : true;
 
   }
 
@@ -753,6 +751,10 @@ public abstract class GStructureChooser extends JPanel implements
     }
   }
 
+  public JTable getResultTable()
+  {
+    return tbl_summary;
+  }
   public JComboBox<FilterOption> getCmbFilterOption()
   {
     return cmb_filterOption;
index 4dff04d..33c566d 100644 (file)
@@ -506,41 +506,53 @@ public class StructureSelectionManager
                 .getMappingFromS1(false);
         if (targetChainId != null && !targetChainId.trim().isEmpty())
         {
-          StructureMapping mapping;
+          StructureMapping siftsMapping;
           try
           {
-            mapping = getStructureMapping(seq, pdbFile, targetChainId, pdb,
-                    maxChain, sqmpping, maxAlignseq);
-            seqToStrucMapping.add(mapping);
+            siftsMapping = getStructureMapping(seq, pdbFile, targetChainId,
+                    pdb, maxChain, sqmpping, maxAlignseq);
+            seqToStrucMapping.add(siftsMapping);
+            maxChain.makeExactMapping(maxAlignseq, seq);
+            maxChain.transferRESNUMFeatures(seq, null);
+            maxChain.transferResidueAnnotation(siftsMapping, sqmpping);
           } catch (SiftsException e)
           {
-            // e.printStackTrace();
             // fall back to NW alignment
             System.err.println(e.getMessage());
-            seqToStrucMapping.add(getNWMappings(seq, pdbFile,
-                    targetChainId,
-                    maxChain, pdb, maxAlignseq));
+            StructureMapping nwMapping = getNWMappings(seq, pdbFile,
+                    targetChainId, maxChain, pdb, maxAlignseq);
+            seqToStrucMapping.add(nwMapping);
           }
         }
         else
         {
-          try
+          ArrayList<StructureMapping> foundSiftsMappings = new ArrayList<StructureMapping>();
+          for (PDBChain chain : pdb.getChains())
           {
-            ArrayList<StructureMapping> tempMapping = new ArrayList<StructureMapping>();
-            for (PDBChain chain : pdb.getChains())
+            try
             {
-              StructureMapping mapping = getStructureMapping(seq, pdbFile,
+              StructureMapping siftsMapping = getStructureMapping(seq,
+                      pdbFile,
                       chain.id, pdb, chain, sqmpping, maxAlignseq);
-              tempMapping.add(mapping);
+              foundSiftsMappings.add(siftsMapping);
+            } catch (SiftsException e)
+            {
+              System.err.println(e.getMessage());
             }
-            seqToStrucMapping.addAll(tempMapping);
-          } catch (SiftsException e)
+          }
+          if (!foundSiftsMappings.isEmpty())
           {
-            // e.printStackTrace();
-            // fall back to NW alignment
-            System.err.println(e.getMessage());
-            seqToStrucMapping.add(getNWMappings(seq, pdbFile, maxChainId,
-                    maxChain, pdb, maxAlignseq));
+            seqToStrucMapping.addAll(foundSiftsMappings);
+            maxChain.makeExactMapping(maxAlignseq, seq);
+            maxChain.transferRESNUMFeatures(seq, null);
+            maxChain.transferResidueAnnotation(foundSiftsMappings.get(0),
+                    sqmpping);
+          }
+          else
+          {
+            StructureMapping nwMapping = getNWMappings(seq, pdbFile,
+                    maxChainId, maxChain, pdb, maxAlignseq);
+            seqToStrucMapping.add(nwMapping);
           }
         }
       }
index 3c2e703..6c11dd2 100644 (file)
@@ -96,11 +96,9 @@ public class SiftsClient implements SiftsClientI
 
   private static final int PDB_ATOM_POS = 1;
 
-  private static final String NOT_FOUND = "Not_Found";
-
   private static final String NOT_OBSERVED = "Not_Observed";
 
-  private static final String SIFTS_FTP_BASE_URL = "ftp://ftp.ebi.ac.uk/pub/databases/msd/sifts/xml/";
+  private static final String SIFTS_FTP_BASE_URL = "http://ftp.ebi.ac.uk/pub/databases/msd/sifts/xml/";
 
   private final static String NEWLINE = System.lineSeparator();
 
@@ -225,8 +223,9 @@ public class SiftsClient implements SiftsClientI
    */
   public static File getSiftsFile(String pdbId) throws SiftsException
   {
-    File siftsFile = new File(SiftsSettings.getSiftDownloadDirectory()
-            + pdbId.toLowerCase() + ".xml.gz");
+    String siftsFileName = SiftsSettings.getSiftDownloadDirectory()
+            + pdbId.toLowerCase() + ".xml.gz";
+    File siftsFile = new File(siftsFileName);
     if (siftsFile.exists())
     {
       // The line below is required for unit testing... don't comment it out!!!
@@ -235,12 +234,28 @@ public class SiftsClient implements SiftsClientI
       if (isFileOlderThanThreshold(siftsFile,
               SiftsSettings.getCacheThresholdInDays()))
       {
-        // System.out.println("Downloaded file is out of date, hence re-downloading...");
-        siftsFile = downloadSiftsFile(pdbId.toLowerCase());
+        File oldSiftsFile = new File(siftsFileName + "_old");
+        siftsFile.renameTo(oldSiftsFile);
+        try
+        {
+          siftsFile = downloadSiftsFile(pdbId.toLowerCase());
+          oldSiftsFile.delete();
+          return siftsFile;
+        } catch (IOException e)
+        {
+          e.printStackTrace();
+          oldSiftsFile.renameTo(siftsFile);
+          return new File(siftsFileName);
+        }
       }
-      return siftsFile;
     }
-    siftsFile = downloadSiftsFile(pdbId.toLowerCase());
+    try
+    {
+      siftsFile = downloadSiftsFile(pdbId.toLowerCase());
+    } catch (IOException e)
+    {
+      throw new SiftsException(e.getMessage());
+    }
     return siftsFile;
   }
 
@@ -278,8 +293,10 @@ public class SiftsClient implements SiftsClientI
    * @param pdbId
    * @return downloaded SIFTs XML file
    * @throws SiftsException
+   * @throws IOException
    */
-  public static File downloadSiftsFile(String pdbId) throws SiftsException
+  public static File downloadSiftsFile(String pdbId) throws SiftsException,
+          IOException
   {
     if (pdbId.contains(".cif"))
     {
@@ -295,8 +312,6 @@ public class SiftsClient implements SiftsClientI
     {
       siftsDownloadDir.mkdirs();
     }
-    try
-    {
       // System.out.println(">> Download ftp url : " + siftsFileFTPURL);
       URL url = new URL(siftsFileFTPURL);
       URLConnection conn = url.openConnection();
@@ -312,10 +327,6 @@ public class SiftsClient implements SiftsClientI
       outputStream.close();
       inputStream.close();
       // System.out.println(">>> File downloaded : " + downloadedSiftsFile);
-    } catch (IOException ex)
-    {
-      throw new SiftsException(ex.getMessage());
-    }
     return new File(downloadedSiftsFile);
   }
 
index 679385a..4110863 100644 (file)
@@ -43,7 +43,7 @@ import compbio.util.FileUtil;
 public class TestAnnotate3D
 {
 
-  @Test(groups = { "Functional" }, enabled = false)
+  @Test(groups = { "Network" }, enabled = true)
   public void test1GIDbyId() throws Exception
   {
     // use same ID as standard tests given at
@@ -53,7 +53,7 @@ public class TestAnnotate3D
     testRNAMLcontent(ids, null);
   }
 
-  @Test(groups = { "Functional" }, enabled = false)
+  @Test(groups = { "Network" }, enabled = true)
   public void testIdVsContent2GIS() throws Exception
   {
     Iterator<Reader> ids = Annotate3D.getRNAMLForPDBId("2GIS");
@@ -97,7 +97,7 @@ public class TestAnnotate3D
    * 
    * @throws Exception
    */
-  @Test(groups = { "Functional" }, enabled = false)
+  @Test(groups = { "Network" }, enabled = true)
   public void testPDBfileVsRNAML() throws Exception
   {
     PDBfile pdbf = new PDBfile(true, false, true, "examples/2GIS.pdb",
@@ -111,7 +111,6 @@ public class TestAnnotate3D
     testRNAMLcontent(readers, pdbf);
   }
 
-  @Test(groups = { "Functional" }, enabled = false)
   private void testRNAMLcontent(Iterator<Reader> readers, PDBfile pdbf)
           throws Exception
   {
index ddf60bc..5ceb5cd 100644 (file)
@@ -40,7 +40,7 @@ public class FTSRestClientTest
   public void getPrimaryKeyColumIndexTest()
   {
     Collection<FTSDataColumnI> wantedFields = ftsRestClient
-            .getAllDefaulDisplayedDataColumns();
+            .getAllDefaultDisplayedFTSDataColumns();
     int foundIndex = -1;
     try
     {
@@ -61,10 +61,10 @@ public class FTSRestClientTest
   @Test(groups = { "Functional" })
   public void getAllDefaulDisplayedDataColumns()
   {
-    Assert.assertNotNull(ftsRestClient.getAllDefaulDisplayedDataColumns());
-    Assert.assertTrue(!ftsRestClient.getAllDefaulDisplayedDataColumns()
+    Assert.assertNotNull(ftsRestClient.getAllDefaultDisplayedFTSDataColumns());
+    Assert.assertTrue(!ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
             .isEmpty());
-    Assert.assertEquals(ftsRestClient.getAllDefaulDisplayedDataColumns()
+    Assert.assertEquals(ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
             .size(), 7);
   }
 
@@ -72,7 +72,7 @@ public class FTSRestClientTest
   public void getDataColumnsFieldsAsCommaDelimitedString()
   {
     Collection<FTSDataColumnI> wantedFields = ftsRestClient
-            .getAllDefaulDisplayedDataColumns();
+            .getAllDefaultDisplayedFTSDataColumns();
     String actual = ftsRestClient
             .getDataColumnsFieldsAsCommaDelimitedString(wantedFields);
     Assert.assertEquals(actual,
index a1c2c9a..28113d6 100644 (file)
@@ -26,6 +26,7 @@ import jalview.datamodel.SequenceI;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.IOException;
 import java.io.PrintStream;
 import java.util.HashMap;
 
@@ -122,9 +123,16 @@ public class SiftsClientTest
     // Assert that file isn't yet downloaded - if already downloaded, assert it
     // is deleted
     Assert.assertTrue(SiftsClient.deleteSiftsFileByPDBId(testPDBId));
-    File siftsFile = SiftsClient.downloadSiftsFile(testPDBId);
-    FileAssert.assertFile(siftsFile);
-    SiftsClient.downloadSiftsFile(testPDBId);
+    File siftsFile;
+    try
+    {
+      siftsFile = SiftsClient.downloadSiftsFile(testPDBId);
+      FileAssert.assertFile(siftsFile);
+      SiftsClient.downloadSiftsFile(testPDBId);
+    } catch (IOException e)
+    {
+      e.printStackTrace();
+    }
   }
 
   @Test(groups = { "Functional" })