Merge branch 'develop' of https://source.jalview.org/git/jalview into develop
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 27 Oct 2016 14:24:27 +0000 (15:24 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 27 Oct 2016 14:24:27 +0000 (15:24 +0100)
resources/lang/Messages.properties
resources/lang/Messages_es.properties
src/jalview/bin/Jalview.java
src/jalview/gui/AlignFrame.java
src/jalview/io/BioJsHTMLOutput.java
src/jalview/io/HtmlSvgOutput.java

index bcbc24b..864e34a 100644 (file)
@@ -382,8 +382,8 @@ label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation =
 label.translation_failed = Translation Failed
 label.error_when_translating_sequences_submit_bug_report = Unfortunately, something went wrong when translating your sequences.\nPlease take a look in the Jalview java console\nand submit a bug report including the stacktrace.
 label.implementation_error  = Implementation error:
-label.automatically_associate_pdb_files_with_sequences_same_name = Do you want to automatically associate the {0} PDB files with sequences in the alignment that have the same name?
-label.automatically_associate_pdb_files_by_name = Automatically Associate PDB files by name
+label.automatically_associate_structure_files_with_sequences_same_name = Do you want to automatically associate the {0} structure file(s) with sequences in the alignment that have the same name?
+label.automatically_associate_structure_files_by_name = Automatically Associate Structure files by name
 label.ignore_unmatched_dropped_files_info = <html>Do you want to <em>ignore</em> the {0} files whose names did not match any sequence IDs ?</html>
 label.ignore_unmatched_dropped_files = Ignore unmatched dropped files?
 label.view_name_original = Original
index 4112d19..754d94d 100644 (file)
@@ -351,8 +351,8 @@ label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation =
 label.translation_failed = Translation Failed
 label.error_when_translating_sequences_submit_bug_report = Desafortunadamente, algo fue mal a la hora de traducir tus secuencias.\nPor favor, revisa la consola Jalview java \ny presenta un informe de error que incluya el seguimiento.
 label.implementation_error  = Error de implementación:
-label.automatically_associate_pdb_files_with_sequences_same_name = Quieres asociar automáticamente los {0} ficheros PDB con las secuencias del alineamiento que tengan el mismo nombre?
-label.automatically_associate_pdb_files_by_name = Asociar los ficheros PDB por nombre automáticamente
+label.automatically_associate_structure_files_with_sequences_same_name = Quieres asociar automáticamente los {0} ficheros structure con las secuencias del alineamiento que tengan el mismo nombre?
+label.automatically_associate_structure_files_by_name = Asociar los ficheros structure por nombre automáticamente
 label.ignore_unmatched_dropped_files_info = Quieres <em>ignorar</em> los {0} ficheros cuyos nombres no coincidan con ningún IDs de las secuencias ?
 label.ignore_unmatched_dropped_files = Ignorar los ficheros sin coincidencias?
 label.enter_view_name = Introduzca un nombre para la vista
index 763b10b..164ba27 100755 (executable)
@@ -654,6 +654,22 @@ public class Jalview
             System.out.println("Creating HTML image: " + file);
             continue;
           }
+          else if (format.equalsIgnoreCase("biojsmsa"))
+          {
+            BioJsHTMLOutput.updateBioJS();
+            try
+            {
+              Thread.sleep(1500);
+            } catch (InterruptedException e)
+            {
+              e.printStackTrace();
+            }
+            BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel, af);
+            bjs.exportJalviewAlignmentAsBioJsHtmlFile(file);
+            System.out.println("Creating BioJS MSA Viwer HTML file: "
+                    + file);
+            continue;
+          }
           else if (format.equalsIgnoreCase("imgMap"))
           {
             af.createImageMap(new File(file), imageName);
@@ -789,6 +805,7 @@ public class Jalview
                     + "-png FILE\tCreate PNG image FILE from alignment.\n"
                     + "-svg FILE\tCreate SVG image FILE from alignment.\n"
                     + "-html FILE\tCreate HTML file from alignment.\n"
+                    + "-biojsMSA FILE\tCreate BioJS MSA Viewer HTML file from alignment.\n"
                     + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
                     + "-eps FILE\tCreate EPS file FILE from alignment.\n"
                     + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
index 63620e5..e8b865b 100644 (file)
@@ -1347,7 +1347,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   public void bioJSMenuItem_actionPerformed(ActionEvent e)
   {
     BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel, this);
-    bjs.exportJalviewAlignmentAsBioJsHtmlFile();
+    bjs.exportJalviewAlignmentAsBioJsHtmlFile(null);
   }
 
   public void createImageMap(File file, String image)
@@ -4885,7 +4885,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
               }
               if (type != null)
               {
-                if (type.equalsIgnoreCase("PDB"))
+                if (type.equalsIgnoreCase("PDB")
+                        || type.equalsIgnoreCase("mmCIF"))
                 {
                   filesmatched.add(new Object[] { file, protocol, mtch });
                   continue;
@@ -4905,14 +4906,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
                                   this,
                                   MessageManager
                                           .formatMessage(
-                                                  "label.automatically_associate_pdb_files_with_sequences_same_name",
+                                                  "label.automatically_associate_structure_files_with_sequences_same_name",
                                                   new Object[] { Integer
                                                           .valueOf(
                                                                   filesmatched
                                                                           .size())
                                                           .toString() }),
                                   MessageManager
-                                          .getString("label.automatically_associate_pdb_files_by_name"),
+                                          .getString("label.automatically_associate_structure_files_by_name"),
                                   JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
 
           {
index f8fa1f5..817f75c 100644 (file)
@@ -80,12 +80,15 @@ public class BioJsHTMLOutput
     }
   }
 
-  public void exportJalviewAlignmentAsBioJsHtmlFile()
+  public void exportJalviewAlignmentAsBioJsHtmlFile(String outputFile)
   {
-    String outputFile = null;
+    // String outputFile = null;
     try
     {
-      outputFile = getOutputFile();
+      if (outputFile == null)
+      {
+        outputFile = getOutputFile();
+      }
       AlignExportSettingI exportSettings = new AlignExportSettingI()
       {
         @Override
@@ -159,8 +162,11 @@ public class BioJsHTMLOutput
       new OOMWarning("Creating Image for " + outputFile, err);
     } catch (Exception e)
     {
+      if (pIndicator != null && !headless)
+      {
       pIndicator.setProgressBar(MessageManager.formatMessage(
               "info.error_creating_file", "HTML"), pSessionId);
+      }
       e.printStackTrace();
     }
   }
index 68173ff..decb06f 100644 (file)
@@ -148,8 +148,16 @@ public class HtmlSvgOutput
             g2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
                     SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
           }
+          if (av.getWrapAlignment())
+          {
+            printWrapped(aDimension.getWidth(), aDimension.getHeight(), 0,
+                    g1, g2);
+          }
+          else
+          {
           printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0,
                   g1, g2);
+          }
 
           String titleSvgData = g1.getSVGDocument();
           String alignSvgData = g2.getSVGDocument();
@@ -207,7 +215,8 @@ public class HtmlSvgOutput
                             exportData.getStartEndPostions(),
                             av.getColumnSelection());
           }
-          String htmlData = getHtml(titleSvgData, alignSvgData, jsonData);
+          String htmlData = getHtml(titleSvgData, alignSvgData, jsonData,
+                  av.getWrapAlignment());
           FileOutputStream out = new FileOutputStream(fileX);
           out.write(htmlData.getBytes());
           out.flush();
@@ -388,8 +397,14 @@ public class HtmlSvgOutput
     return Printable.PAGE_EXISTS;
   }
 
+  public int printWrapped(int pwidth, int pheight, int pi, Graphics... pg)
+          throws PrinterException
+  {
+    return ap.printWrappedAlignment(pg[1], pwidth, pheight, pi);
+  }
+
   private String getHtml(String titleSvg, String alignmentSvg,
-          String jsonData)
+          String jsonData, boolean wrapped)
   {
     StringBuilder htmlSvg = new StringBuilder();
     htmlSvg.append("<html>\n");
@@ -429,8 +444,9 @@ public class HtmlSvgOutput
               + ".facebox_hide { z-index:-100; }\n"
               + ".facebox_overlayBG { background-color: #000;  z-index: 99;  }");
     }
-
     htmlSvg.append("</style>");
+    if (!wrapped)
+    {
     htmlSvg.append("<div class=\"main-container\" \n>");
     htmlSvg.append("<div class=\"titlex\">\n");
     htmlSvg.append("<div class=\"sub-category-container\"> \n");
@@ -451,6 +467,15 @@ public class HtmlSvgOutput
             + "subCatContainer.scrollTop($(this).scrollTop());\n});\n");
 
     htmlSvg.append("</script>\n");
+    }
+    else
+    {
+      htmlSvg.append("<div>\n")
+              .append(alignmentSvg).append("</div>");
+      htmlSvg.append("<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js\"></script>\n"
+              + "<script language=\"JavaScript\" type=\"text/javascript\"  src=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js\"></script>\n");
+
+    }
 
     // javascript for launching file in Jalview