{
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,
// 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());
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();
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;
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();
}
-
- 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(
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);