Changeset 220


Ignore:
Timestamp:
Dec 19, 2006, 10:35:13 AM (15 years ago)
Author:
Johan Enell
Message:

Cleaned up the code

Location:
trunk/se/lu/onk/ZTest/src/ztest
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/se/lu/onk/ZTest/src/ztest/Plot.java

    r219 r220  
    3939import org.jfree.data.statistics.SimpleHistogramBin;
    4040import org.jfree.data.statistics.SimpleHistogramDataset;
    41 import org.jfree.data.xy.IntervalXYDataset;
    4241import org.jfree.data.xy.XYDataset;
    4342import org.jfree.data.xy.XYSeries;
     
    5251  public static class HistogramDataset extends SimpleHistogramDataset
    5352  {
     53   
    5454    private double binSize;
    5555
     
    7373      }
    7474    }
    75    
    7675
    7776    private void newBin(double value)
     
    157156    ChartUtilities.saveChartAsPNG(new File("fdrplot.png"), chart, 800, 600);
    158157  }
     158 
    159159
    160160  static void plotOE(XYSeries observed, XYSeries expected)
  • trunk/se/lu/onk/ZTest/src/ztest/Reporter.java

    r207 r220  
    4444  public void setP(double p)
    4545  {
    46     this.p = p;
     46    this.p = p < 0 ? 0 : p;
    4747  }
    4848 
  • trunk/se/lu/onk/ZTest/src/ztest/Start.java

    r219 r220  
    137137      PrintWriter tab = new PrintWriter(new File("result.tsv"));
    138138      int numOfReporters = bfss.getReporterSize();
     139     
     140      Object[] tableRow = {"Reporter","GeneSymbol","LocusLink","AverageM","up/down","P","Rank","Expected","FDR","NumberOfValues"};
    139141
    140142      html.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">");
     
    146148      html.println("</head>");
    147149      html.println("<table>");
    148       html.println("<tr><th>Reporter</th><th>Gene symbol</th><th>Locus Link</th><th>Average M</th>" +
    149           "<th>P</th><th>Number of values</th><th>Rank</th><th>Expected</th><th>FDR</th></tr>");
    150       tab.println("Reporter\tGeneSymbol\tLocusLink\tAverageM\tP\tNumberOfValues\tRank\tExpected\tFDR");
     150      html.printf("<tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n", tableRow);
     151      tab.printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", tableRow);
    151152
    152153      for (int i = 0; i < bfss.getReporterSize(); i++)
     
    159160        if (i < 1000)
    160161        {
     162          tableRow[0] = r.getReporter();
     163          tableRow[1] = r.getSymbol();
     164          tableRow[2] = r.getLocusLink();
     165          tableRow[3] = r.getM();
     166          tableRow[4] = r.getM() > 0 ? "+" : "-";
     167          tableRow[5] = r.getP();
     168          tableRow[6] = rank;
     169          tableRow[7] = expected;
     170          tableRow[8] = fdr;
     171          tableRow[9] = r.getSize();
     172         
    161173          html.printf(
    162             "<tr class=\"row" + (i % 2 + 1) + "\"><td>%s</td><td>%s</td><td>%s</td>" +
    163             "<td>%f</td><td>%f</td><td>%d</td><td>%d</td><td>%f</td><td>%.2f</td></tr>\n",
    164             r.getReporter(),
    165             r.getSymbol(),
    166             r.getLocusLink(),
    167             r.getM(),
    168             r.getP(),
    169             r.getSize(),
    170             rank,
    171             expected,
    172             fdr);
     174            "<tr class=\"row" + (i % 2 + 1) + "\"><td>%s</td><td>%s</td><td>%s</td><td>%f</td>" +
     175            "<td>%s</td><td>%f</td><td>%d</td><td>%f</td><td>%.2f</td><td>%d</td></tr>\n",
     176            tableRow);
    173177        }
    174         tab.printf("%s\t%s\t%s\t%f\t%f\t%d\t%d\t%f\t%f\n",
    175           r.getReporter(),
    176           r.getSymbol(),
    177           r.getLocusLink(),
    178           r.getM(),
    179           r.getP(),
    180           r.getSize(),
    181           rank,
    182           expected,
    183           fdr);
     178        tab.printf("%s\t%s\t%s\t%f\t%s\t%f\t%d\t%f\t%f\t%d\n", tableRow);
    184179       
    185           oSeries.add(rank, rank);
    186           eSeries.add(rank, expected);
    187           fdrSeries.add(rank, fdr);
    188           mHist.addObservation(r.getM());
     180        oSeries.add(rank, rank);
     181        eSeries.add(rank, expected);
     182        fdrSeries.add(rank, fdr);
     183        mHist.addObservation(r.getM());
    189184      }
    190185      html.println("</table>");
Note: See TracChangeset for help on using the changeset viewer.