JAL-2136 added improvement to parse crudelist file instead of scrapping 'summary...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 28 Feb 2017 12:49:20 +0000 (12:49 +0000)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 28 Feb 2017 12:49:20 +0000 (12:49 +0000)
65 files changed:
examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.1.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.1.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.16.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/c1krhA_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.20.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.20.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.20.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/c2piaA_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.15.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.15.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.15.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/c4itkA_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.1.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.1.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.1.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/c4n58A_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.19.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.19.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.19.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/c4wqmA_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.2.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.2.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.2.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1a70a_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1awda_.10.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1awda_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1awda_.10.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1awda_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1awda_.10.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1awda_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.12.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.12.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.12.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1czpa_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1frda_.6.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1frda_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1frda_.6.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1frda_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1frda_.6.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1frda_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1frra_.4.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1frra_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1frra_.4.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1frra_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1frra_.4.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1frra_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.7.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.7.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.7.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1fxia_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.8.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.8.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.8.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1gaqb_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.9.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.9.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.9.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1iuea_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.18.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.18.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.18.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1jq4a_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1krha3.17.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1krha3.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1krha3.17.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1krha3.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1krha3.17.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1krha3.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1offa_.3.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1offa_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1offa_.3.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1offa_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1offa_.3.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1offa_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.5.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.5.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.5.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1pfda_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1wria_.11.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d1wria_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1wria_.11.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d1wria_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d1wria_.11.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d1wria_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.13.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.13.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.13.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d2cjoa_.scop with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.14.fasta [moved from examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.fasta with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.14.pdb [moved from examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.pdb with 100% similarity]
examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.14.scop [moved from examples/testdata/phyre2results/56da5616b4559c93/d4fxca_.scop with 100% similarity]
src/jalview/gui/AppJmol.java
src/jalview/gui/StructureChooser.java
src/jalview/jbgui/GStructureChooser.java
src/jalview/ws/phyre2/Phyre2Client.java
test/jalview/ws/phyre2/Phyre2ClientTest.java

index 5f18aea..bdd8c4b 100644 (file)
@@ -66,7 +66,6 @@ import javax.swing.JCheckBoxMenuItem;
 import javax.swing.JColorChooser;
 import javax.swing.JInternalFrame;
 import javax.swing.JMenu;
-import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JSplitPane;
 import javax.swing.SwingUtilities;
@@ -164,7 +163,7 @@ public class AppJmol extends StructureViewerBase
         closeViewer(false);
       }
     });
-    initJmol(loadStatus); // pdbentry, seq, JBPCHECK!
+    initJmol(loadStatus); // pdbentry, seq, JBPCHECK!ˇ
 
   }
 
index bff6d6f..cad168f 100644 (file)
@@ -908,8 +908,7 @@ public class StructureChooser extends GStructureChooser implements
           {
             String templateId = getPhyreResultTable().getValueAt(row,
                     templateColIndex).toString();
-            String structureFile = phyre2ResultDirectory + templateId
-                    + ".pdb";
+            String structureFile = phyre2ResultDirectory + templateId;
             pdbEntriesToView[count++] = new AssociateStructureFileWithSeq()
                     .associateStructureWithSeq(structureFile,
                             DataSourceType.FILE, selectedSequence, true,
@@ -964,11 +963,16 @@ public class StructureChooser extends GStructureChooser implements
     // for getting the result directory when the job completes, this is
     // currently hard-wired to the directory of result for FER_CAPAN/1-144
     phyre2ResultDirectory = "examples/testdata/phyre2results/56da5616b4559c93/";
-    String summaryhtml = phyre2ResultDirectory + "summary.html";
-    // TODO ditch HTML parsing once appropriated data file (i.e. JSON) for
-    // Phyre2 result summary is made available
+    // String summaryhtml = phyre2ResultDirectory + "summary.html";
+    // // TODO ditch HTML parsing once appropriated data file (i.e. JSON) for
+    // // Phyre2 result summary is made available
+    // List<Phyre2SummaryPojo> phyreResults = Phyre2Client
+    // .parsePhyre2ResultSummaryTable(summaryhtml);
+
+    String crudeListFile = phyre2ResultDirectory + "crudelist";
     List<Phyre2SummaryPojo> phyreResults = Phyre2Client
-            .parsePhyre2ResultSummaryTable(summaryhtml);
+            .parsePhyreCrudeList(crudeListFile);
+
     getPhyreResultTable()
             .setModel(Phyre2Client.getTableModel(phyreResults));
     Phyre2Client.configurePhyreResultTable(getPhyreResultTable());
index 5a185f8..e4e73d1 100644 (file)
@@ -654,13 +654,9 @@ public abstract class GStructureChooser extends JPanel implements
 
   protected void closeAction(int preferredHeight)
   {
-    // System.out.println(">>>>>>>>>> closing internal frame!!!");
-    // System.out.println("width : " + mainFrame.getWidth());
-    // System.out.println("heigh : " + mainFrame.getHeight());
-    // System.out.println("x : " + mainFrame.getX());
-    // System.out.println("y : " + mainFrame.getY());
     tempUserPrefs.put("structureChooser.width", pnl_filter.getWidth());
-    tempUserPrefs.put("structureChooser.height", preferredHeight);
+    tempUserPrefs.put("structureChooser.height",
+            pnl_filter.getHeight() - 76);
     tempUserPrefs.put("structureChooser.x", mainFrame.getX());
     tempUserPrefs.put("structureChooser.y", mainFrame.getY());
     mainFrame.dispose();
index 0a29412..e980a19 100644 (file)
@@ -14,7 +14,9 @@ import jalview.structures.models.MappingOutputModel;
 import jalview.util.Comparison;
 import jalview.util.Format;
 
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.PrintStream;
 import java.util.ArrayList;
@@ -24,11 +26,6 @@ import java.util.List;
 import javax.swing.JTable;
 import javax.swing.table.DefaultTableModel;
 
-import org.jsoup.Jsoup;
-import org.jsoup.nodes.Document;
-import org.jsoup.nodes.Element;
-import org.jsoup.select.Elements;
-
 public class Phyre2Client extends StructureMappingClient
 {
   private final static String NEWLINE = System.lineSeparator();
@@ -293,73 +290,30 @@ public class Phyre2Client extends StructureMappingClient
   }
 
 
-
-  public static List<Phyre2SummaryPojo> parsePhyre2ResultSummaryTable(
-          String html)
+  public static List<Phyre2SummaryPojo> parsePhyreCrudeList(String crudeList)
   {
     List<Phyre2SummaryPojo> phyre2Results = new ArrayList<Phyre2SummaryPojo>();
-    try
+    try (BufferedReader br = new BufferedReader(new FileReader(crudeList)))
     {
-      File in = new File(html);
-      Document doc = Jsoup.parse(in, null);
-      // Document doc = Jsoup.connect(html).get();
-      Elements tableElements = doc.select("table.midshade");
-      for (Element table : tableElements)
+      String line;
+      while ((line = br.readLine()) != null)
       {
-        System.out.println();
-        Elements tableRowElements = table.select(":not(thead) tr");
-        for (int i = 0; i < tableRowElements.size(); i++)
-        {
-          Element row = tableRowElements.get(i);
-          Elements rowItems = row.select("td");
-          if (rowItems.size() > 11)
-          {
-            // for (int j = 0; j < rowItems.size(); j++)
-            // {
-            // System.out.println(">>> r:" + j + "  =  "
-            // + rowItems.get(j).text());
-            // }
-
-            String c = rowItems.get(6).select("input").attr("onmouseover");
-            String alignedRange = c.substring(c.indexOf("Residues ") + 9,
-                    c.indexOf(" of your sequence aligned "));
-            String coverage = c.substring(c.lastIndexOf(" (") + 2,
-                    c.lastIndexOf(" coverage). Click to view detailed"));
-            // System.out.println("coverage" + coverage);
-            try
-            {
-              Phyre2SummaryPojo psp = new Phyre2SummaryPojo();
-              String sn = rowItems.get(0).text();
-              psp.setSerialNo(Integer.valueOf(sn));
-              psp.setTemplateId(rowItems.get(1).text());
-              psp.setCoverage(coverage);
-              psp.setAlignedRange(alignedRange);
-              psp.setConfidence(Double.valueOf(rowItems.get(8).text()));
-              psp.setPid(Integer.valueOf(rowItems.get(9).text()));
-              psp.setTemplateSummary(rowItems.get(10).text());
-              // System.out.println("row  >>>> " + psp.toString());
-              // System.out.println();
-              phyre2Results.add(psp);
-            } catch (NumberFormatException e)
-            {
-              e.printStackTrace();
-            } catch (IndexOutOfBoundsException e)
-            {
-              e.printStackTrace();
-            } catch (Exception e)
-            {
-              e.printStackTrace();
-            }
-          }
-        }
+        String[] lineData = line.split(" ");
+        Phyre2SummaryPojo psp = new Phyre2SummaryPojo();
+        psp.setSerialNo(Integer.valueOf(lineData[0]));
+        psp.setTemplateId(lineData[1]);
+        psp.setConfidence(100 * Double.valueOf(lineData[2]));
+        psp.setPid(Integer.valueOf(lineData[3]));
+        psp.setAlignedRange(lineData[4] + " - " + lineData[5]);
+        // psp.setCoverage(coverage);
+        // psp.setTemplateSummary(templateSummary);
+        phyre2Results.add(psp);
       }
-      return phyre2Results;
-
     } catch (Exception e)
     {
       e.printStackTrace();
-      return null;
     }
+    return phyre2Results;
   }
 
   public static DefaultTableModel getTableModel(
@@ -436,8 +390,8 @@ public class Phyre2Client extends StructureMappingClient
     phyreResultTable.getColumn("#").setCellRenderer(idCellRender);
 
     phyreResultTable.getColumn("Template").setMinWidth(60);
-    phyreResultTable.getColumn("Template").setPreferredWidth(60);
-    phyreResultTable.getColumn("Template").setMaxWidth(90);
+    phyreResultTable.getColumn("Template").setPreferredWidth(90);
+    phyreResultTable.getColumn("Template").setMaxWidth(150);
 
     phyreResultTable.getColumn("Aligned Range").setMinWidth(80);
     phyreResultTable.getColumn("Aligned Range").setPreferredWidth(80);
index 322bfa3..811ddd0 100644 (file)
@@ -393,10 +393,5 @@ public class Phyre2ClientTest
     }
   }
 
-  @Test(groups = { "Functional" })
-  public void readPhyre2SummaryTableTest()
-  {
-    String summaryhtml = "examples/testdata/phyre2results/56da5616b4559c93/summary.html";
-    Phyre2Client.parsePhyre2ResultSummaryTable(summaryhtml);
-  }
+
 }