resolved merge conflict
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Mon, 1 May 2017 14:16:24 +0000 (15:16 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Mon, 1 May 2017 14:16:24 +0000 (15:16 +0100)
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/appletgui/SeqCanvas.java
src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
src/jalview/fts/service/uniprot/UniProtFTSRestClient.java
src/jalview/gui/SeqCanvas.java
src/jalview/io/JSONFile.java
src/jalview/ws/sifts/SiftsClient.java
test/jalview/io/JSONFileTest.java

index 04bfb30..96ca479 100644 (file)
@@ -3,7 +3,7 @@ action.reset_services = Reset Services
 action.merge_results = Merge Results
 action.load_scheme = Load scheme
 action.save_scheme = Save scheme
-label.scheme_changed = Changes to scheme {0} have not been saved.<br><br>Save changes, or continue without saving to make a new colour scheme.
+label.scheme_changed = Changes to scheme ''{0}'' have not been saved.<br><br>Save changes, or continue without saving to make a new colour scheme.
 label.save_changes = Save Changes
 label.dont_save_changes = Don't Save
 action.save_image = Save Image
index a878ab7..bdd61fe 100644 (file)
@@ -3,6 +3,9 @@ action.reset_services = Reiniciar servicios
 action.merge_results = Unificar resultados
 action.load_scheme = Cargar esquema
 action.save_scheme = Guardar esquema
+label.scheme_changed = Cambios en el esquema ''{0}'' no se han guardado.<br><br>Guardar cambios, o continuar sin guardar para hacer un nuevo esquema.
+label.save_changes = Guardar cambios
+label.dont_save_changes = No guardar
 action.save_image = Guardar imagen
 action.paste = Pegar
 action.show_html_source = Mostrar código HTML
@@ -1140,6 +1143,9 @@ action.annotations=Anotaciones
 label.nuc_alignment_colour=Color del Alineamiento Nucleotídico
 label.copy_format_from=Copiar formato de
 label.chimera=Chimera
+label.create_chimera_attributes = Escribir características de Jalview
+label.create_chimera_attributes_tip = Establecer atributos en Chimera para características visibles 
+label.attributes_set = {0} valores de atributos establecidos en Chimera
 label.open_split_window=Abrir ventana dividida
 label.open_split_window?=¿Quieres abrir ventana dividida, con cDNA y proteína vinculadas?
 status.searching_for_pdb_structures=Buscando Estructuras PDB
@@ -1178,9 +1184,14 @@ label.hide_insertions=Ocultar Inserciones
 info.change_threshold_mode_to_enable=Cambiar Modo de Umbral para Habilitar
 label.separate_multiple_query_values=Introducir uno o mas {0}s separados por punto y coma ";"
 label.let_chimera_manage_structure_colours=Deja que Chimera maneje colores de estructuras
+label.fetch_chimera_attributes = Buscar atributos desde Chimera
+label.fetch_chimera_attributes_tip = Copiar atributo de Chimera a característica de Jalview
 label.view_rna_structure=Estructura 2D VARNA
 label.scale_protein_to_cdna_tip=Hacer a los residuos de proteínas de la misma anchura que los codones en ventanas divididas
 label.colour_with_chimera=Colorear con Chimera
+label.superpose_structures = Superponer estructuras
+error.superposition_failed = Superposición fallido: {0}
+label.insufficient_residues = Residuos alineados ({0}) insuficentes para superponer
 label.show_pdbstruct_dialog=Datos de Estructura 3D...
 label.hide_all=Ocultar todos
 label.invert=Invertir
index ed8a46d..89df11f 100755 (executable)
@@ -501,7 +501,7 @@ public class SeqCanvas extends Panel
         g.setClip(0, 0, cWidth * avcharWidth, canvasHeight);
       }
 
-      drawPanel(g, startRes, endx, 0, al.getHeight(), ypos);
+      drawPanel(g, startRes, endx, 0, al.getHeight() - 1, ypos);
       g.setClip(null);
 
       if (av.isShowAnnotation())
@@ -580,7 +580,7 @@ public class SeqCanvas extends Panel
             g1.setColor(Color.blue);
             g1.drawLine((blockEnd - blockStart + 1) * avcharWidth - 1,
                     0 + offset, (blockEnd - blockStart + 1) * avcharWidth
-                            - 1, (endSeq - startSeq) * avcharHeight
+                            - 1, (endSeq - startSeq + 1) * avcharHeight
                             + offset);
           }
 
index ecf93d3..daf6131 100644 (file)
@@ -172,8 +172,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
       if (getSsm() != null)
       {
         getSsm().addStructureViewerListener(this);
-        // ssm.addSelectionListener(this);
-        refreshGUI();
       }
       return true;
     } catch (Exception q)
index 27bfca8..a23df4c 100644 (file)
@@ -157,14 +157,14 @@ public class UniProtFTSRestClient extends FTSRestClient
     if (foundDataRow != null && foundDataRow.length > 0)
     {
       result = new ArrayList<FTSData>();
-      String titleRow = getDataColumnsFieldsAsTabDelimitedString(uniprotRestRequest
-              .getWantedFields());
-      // System.out.println(">>>>Title row : " + titleRow);
+      boolean firstRow = true;
       for (String dataRow : foundDataRow)
       {
-        if (dataRow.equalsIgnoreCase(titleRow))
+        // The first data row is usually the header data. This should be
+        // filtered out from the rest of the data See: JAL-2485
+        if (firstRow)
         {
-          // System.out.println(">>>>>>>>>> matched!!!");
+          firstRow = false;
           continue;
         }
         // System.out.println(dataRow);
index 4557819..64e5fdc 100755 (executable)
@@ -588,7 +588,7 @@ public class SeqCanvas extends JComponent
                 (int) clip.getBounds().getHeight());
       }
 
-      drawPanel(g, startRes, endx, 0, al.getHeight(), ypos);
+      drawPanel(g, startRes, endx, 0, al.getHeight() - 1, ypos);
 
       if (av.isShowAnnotation())
       {
@@ -683,7 +683,7 @@ public class SeqCanvas extends JComponent
 
           g1.drawLine((blockEnd - blockStart + 1) * charWidth - 1,
                   0 + offset, (blockEnd - blockStart + 1) * charWidth - 1,
-                  (endSeq - startSeq) * charHeight + offset);
+                  (endSeq - startSeq + 1) * charHeight + offset);
         }
 
         g1.translate(-screenY * charWidth, 0);
index 053a65e..583bbc0 100644 (file)
@@ -767,7 +767,8 @@ public class JSONFile extends AlignFile implements ComplexAlignFile
         }
       }
     }
-    globalColourScheme = viewport.getGlobalColourScheme().getSchemeName();
+    globalColourScheme = (viewport.getGlobalColourScheme() == null) ? ResidueColourScheme.NONE
+            : viewport.getGlobalColourScheme().getSchemeName();
     setDisplayedFeatures(viewport.getFeaturesDisplayed());
     showSeqFeatures = viewport.isShowSequenceFeatures();
 
index 30ac0ae..7b26214 100644 (file)
@@ -604,8 +604,12 @@ public class SiftsClient extends StructureMappingClient implements
                     .getDbResNum());
           } catch (NumberFormatException nfe)
           {
-            resNum = (pdbRefDb == null) ? Integer.valueOf(residue
-                    .getDbResNum()) : Integer.valueOf(pdbRefDb
+            if (pdbRefDb == null || pdbRefDb.getDbResNum().equals("null"))
+            {
+              resNum = UNASSIGNED;
+              continue;
+            }
+            resNum = Integer.valueOf(pdbRefDb
                     .getDbResNum().split("[a-zA-Z]")[0]);
             continue;
           }
index a8611cc..4e4abe9 100644 (file)
@@ -36,6 +36,7 @@ import jalview.gui.AlignFrame;
 import jalview.gui.JvOptionPane;
 import jalview.json.binding.biojson.v1.ColourSchemeMapper;
 import jalview.schemes.ColourSchemeI;
+import jalview.schemes.ResidueColourScheme;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -90,6 +91,8 @@ public class JSONFileTest
 
   private JSONFile jf;
 
+  private AlignExportSettingI exportSettings;
+
   @BeforeTest(alwaysRun = true)
   public void setup() throws Exception
   {
@@ -193,7 +196,7 @@ public class JSONFileTest
     TEST_ANOT_HEIGHT = expectedAnnots.size();
     TEST_CS_HEIGHT = expectedColSel.getHiddenColumns().size();
 
-    AlignExportSettingI exportSettings = new AlignExportSettingI()
+    exportSettings = new AlignExportSettingI()
     {
       @Override
       public boolean isExportHiddenSequences()
@@ -338,6 +341,50 @@ public class JSONFileTest
   }
 
   @Test(groups = { "Functional" })
+  /**
+   * Test for bug JAL-2489, NPE when exporting BioJSON with global colour scheme set as 'None'
+   */
+  public void testBioJSONRoundTripWithGlobalColourSchemeSetAsNone()
+  {
+    AppletFormatAdapter formatAdapter = new AppletFormatAdapter();
+
+    Alignment _alignment;
+    try
+    {
+      // load example BioJSON file
+      _alignment = (Alignment) formatAdapter.readFile(TEST_JSON_FILE,
+              DataSourceType.FILE, FileFormat.Json);
+      JSONFile bioJsonFile = (JSONFile) formatAdapter.getAlignFile();
+      AlignFrame alignFrame = new AlignFrame(_alignment,
+              bioJsonFile.getHiddenSequences(),
+              bioJsonFile.getColumnSelection(), AlignFrame.DEFAULT_WIDTH,
+              AlignFrame.DEFAULT_HEIGHT);
+      // Change colour scheme to 'None' and perform round trip
+      ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme(
+              ResidueColourScheme.NONE, _alignment);
+      alignFrame.changeColour(cs);
+      alignFrame.getViewport().setFeaturesDisplayed(
+              bioJsonFile.getDisplayedFeatures());
+      formatAdapter = new AppletFormatAdapter(alignFrame.alignPanel,
+              exportSettings);
+      // export BioJSON string
+      String jsonOutput = formatAdapter.formatSequences(FileFormat.Json,
+              alignFrame.alignPanel.getAlignment(), false);
+      // read back Alignment from BioJSON string
+      formatAdapter = new AppletFormatAdapter();
+      formatAdapter.readFile(jsonOutput, DataSourceType.PASTE,
+              FileFormat.Json);
+      // assert 'None' colour scheme is retained after round trip
+      JSONFile _bioJsonFile = (JSONFile) formatAdapter.getAlignFile();
+      Assert.assertEquals(_bioJsonFile.getGlobalColourScheme(),
+              ResidueColourScheme.NONE);
+    } catch (IOException e)
+    {
+      e.printStackTrace();
+    }
+  }
+
+  @Test(groups = { "Functional" })
   public void isShowSeqFeaturesSet()
   {
     Assert.assertTrue(testJsonFile.isShowSeqFeatures(),