Changeset 255


Ignore:
Timestamp:
Apr 13, 2007, 11:03:14 AM (15 years ago)
Author:
Johan Enell
Message:

made some changes in the printing methods

Location:
trunk/se/lu/onk/OneClass/src/oneclass/rankproduct
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/se/lu/onk/OneClass/src/oneclass/rankproduct/RankProduct.java

    r252 r255  
    3838public class RankProduct
    3939{
    40   private final File dataFolder;
    41  
    4240  private final BASEFile<Reporter, Spot> basefile;
    4341
     
    5250  public RankProduct(BASEFile<Reporter, Spot> basefile) throws BASEFileException
    5351  {
    54     dataFolder = new File("lib");
    55     dataFolder.mkdir();
    56    
    5752    this.basefile = basefile;
    5853    readAssaySection();
     
    6156   
    6257    this.basefileOut = new BASEFile<ReporterOut, SpotOut>(new File("stdout.txt"), "rw");
    63     BASEFileSpotSection<Reporter, Spot> bfss = this.basefile.getSpotSection();
    6458    BASEFileAssaySection bfas = new BASEFileAssaySection();
    6559    bfas.setAnnotationColumns("");
     
    135129    }
    136130  }
    137 
    138   public void printTab() throws BASEFileException
     131 
     132  public void print(File dataFolder) throws BASEFileException
    139133  {
    140134    bfss.sortReporter(new Comparator<Reporter>()
     
    145139      }
    146140    });
    147 
    148     writeTabFile(basefileOut.getSpotSection(0), new File(dataFolder, "resultUP.csv"));
    149     writeTabFile(basefileOut.getSpotSection(1), new File(dataFolder, "resultDOWN.csv"));
    150   }
    151  
    152   private void writeTabFile(BASEFileSpotSection<ReporterOut, SpotOut> bfss, File file) throws BASEFileException
     141   
     142    printTab(0, new File(dataFolder, "resultUP.csv"));
     143    printTab(1, new File(dataFolder, "resultDOWN.csv"));
     144    printHTML(0, new File(dataFolder, "resultUP.html"));
     145    printHTML(1, new File(dataFolder, "resultDOWN.html"));
     146    printBASE();
     147  }
     148
     149  private void printTab(int section, File file) throws BASEFileException
    153150  {
    154151    try
     
    173170      }
    174171      tab.println(formatArray("", "", "\t", tableRow));
    175      
     172
     173      BASEFileSpotSection<ReporterOut, SpotOut> bfss = basefileOut.getSpotSection(section);
    176174      for (int i = 0; i < bfss.getHeight(); i++)
    177175      {
     
    202200  }
    203201
    204   public void printHTML() throws BASEFileException
    205   {
    206     bfss.sortReporter(new Comparator<Reporter>()
    207     {
    208       public int compare(Reporter r1, Reporter r2)
    209       {
    210         return Double.compare(r1.getRankProduct(), r2.getRankProduct());
    211       }
    212     });
    213    
    214     writeHTMLFile(basefileOut.getSpotSection(0), new File(dataFolder, "resultUP.html"));
    215     writeHTMLFile(basefileOut.getSpotSection(1), new File(dataFolder, "resultDOWN.html"));
    216   }
    217  
    218   private void writeHTMLFile(BASEFileSpotSection<ReporterOut, SpotOut> bfss, File file) throws BASEFileException
     202  public void printHTML(int section, File file) throws BASEFileException
    219203  {
    220204    try
     
    229213     
    230214      String[] tableRow = new String[8];
    231       tableRow[0] = "Reporter"; 
    232       tableRow[1] = "GeneSymbol"; 
     215      tableRow[0] = "Reporter";
     216      tableRow[1] = "GeneSymbol";
    233217      tableRow[2] = "LocusLink";
    234218      tableRow[3] = "AverageM";
    235219      tableRow[4] = "up/down";
    236220      tableRow[5] = "Rank";
    237       tableRow[6] = "Rank product"; 
     221      tableRow[6] = "Rank product";
    238222      tableRow[7] = "NumberOfValues";
    239223      html.println("<tr>" + formatArray("<th>", "</th>", "", tableRow) + "</tr>");
    240224
    241225      DecimalFormat df = new DecimalFormat("#&nbsp;##0.000");
     226      BASEFileSpotSection<ReporterOut, SpotOut> bfss = basefileOut.getSpotSection(section);
    242227      for (int i = 0; i < 1000 && i < bfss.getHeight(); i++)
    243228      {
     
    316301  {   
    317302    //Read spot section
    318     BASEFileSpotSection<Reporter, Spot> bfss = basefile.getSpotSection();
    319 
    320303    int mCol = bfss.getAssayFieldsColIndex("l2ratio1_2");
    321304    int aCol = bfss.getAssayFieldsColIndex("l10intgmean1_2");
  • trunk/se/lu/onk/OneClass/src/oneclass/rankproduct/Start.java

    r252 r255  
    3939    try
    4040    {
     41      File dataFolder = new File("lib");
     42      dataFolder.mkdir();
     43     
    4144      BASEFile<Reporter, Spot> basefile;
    4245      basefile = new BASEFile<Reporter, Spot>(new File(args.length == 1 ? args[0] : "stdin.txt"), "r");
     
    4447      RankProduct rankproduct = new RankProduct(basefile);
    4548      rankproduct.calculate();
    46       rankproduct.printTab();
    47       rankproduct.printHTML();
    48       rankproduct.printBASE();
    49    
     49      rankproduct.print(dataFolder);
    5050    }
    5151    catch (BASEFileException e)
Note: See TracChangeset for help on using the changeset viewer.