Changeset 227
- Timestamp:
- Jan 17, 2007, 4:48:19 PM (16 years ago)
- Location:
- trunk/se/lu/onk/Smooth/src/smooth
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/se/lu/onk/Smooth/src/smooth/Smooth.java
r222 r227 117 117 if (stop < reporters.size()) 118 118 { 119 winSizes.add(reporters.get(stop).getChrPosition() - reporters.get(start).getChrPosition()); 119 120 if (!window.isEmpty()) 120 121 { … … 128 129 } 129 130 } 130 winSizes.add(reporters.get(stop).getChrPosition() - reporters.get(start).getChrPosition());131 131 } 132 132 else if (winType.equals("bp")) … … 134 134 if (stop < reporters.size()) 135 135 { 136 winSizes.add(stop - start); 136 137 while (!window.isEmpty() && r.getChrPosition() - reporters.get(start).getChrPosition() > winSize / 2) 137 138 { … … 145 146 } 146 147 } 147 winSizes.add(stop - start);148 148 } 149 149 float mean = Float.NaN; -
trunk/se/lu/onk/Smooth/src/smooth/SmoothMain.java
r222 r227 27 27 import org.jfree.chart.JFreeChart; 28 28 import org.jfree.chart.axis.CategoryAxis; 29 import org.jfree.chart.axis.LogarithmicAxis;30 29 import org.jfree.chart.axis.NumberAxis; 31 import org.jfree.chart.axis.ValueAxis;32 30 import org.jfree.chart.plot.CategoryPlot; 31 import org.jfree.chart.plot.PlotRenderingInfo; 33 32 import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; 34 import org.jfree. data.RangeType;33 import org.jfree.chart.renderer.category.CategoryItemRendererState; 35 34 import org.jfree.data.statistics.BoxAndWhiskerItem; 36 35 import org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset; … … 41 40 import basefile.BASEFileSpotSection; 42 41 42 import java.awt.Graphics2D; 43 import java.awt.geom.Rectangle2D; 43 44 import java.io.File; 44 45 import java.io.IOException; … … 55 56 public class SmoothMain 56 57 { 58 59 private static String wType = ""; 57 60 58 61 /** … … 80 83 } 81 84 82 StringwType = bfs.findStringOpt("w_type");85 wType = bfs.findStringOpt("w_type"); 83 86 String average = bfs.findStringOpt("average"); 84 87 int wSize = bfs.findIntOpt("w_size"); … … 173 176 { 174 177 BoxAndWhiskerItem bw = smooth.getBoxAndWhiskerItem(assayId); 175 data.add(bw, "Windows distibution", assays.get(assayId)); 176 } 177 178 CategoryAxis domainAxis = new CategoryAxis("Sample"); // x axis 179 NumberAxis rangeAxis = new NumberAxis("Window size"); // y axis fdr 180 rangeAxis.setAutoRangeIncludesZero(true); 181 182 BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); 183 CategoryPlot plot = new CategoryPlot(data, domainAxis, rangeAxis, renderer); 178 data.add(bw, "Window distibution", assays.get(assayId)); 179 } 180 181 CategoryAxis xAxis = new CategoryAxis("Sample"); 182 NumberAxis yAxis = new NumberAxis("Window size (" + (wType.equals("cl") ? "bp" : "clones") + ")"); 183 yAxis.setAutoRangeIncludesZero(false); 184 185 BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer() 186 { 187 @Override 188 public CategoryItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, CategoryPlot plot, int rendererIndex, PlotRenderingInfo info) 189 { 190 CategoryItemRendererState state = super.initialise(g2, dataArea, plot, rendererIndex, info); 191 state.setBarWidth(20); 192 return state; 193 } 194 }; 195 CategoryPlot plot = new CategoryPlot(data, xAxis, yAxis, renderer); 196 184 197 185 198 JFreeChart chart = new JFreeChart(plot); 199 chart.removeLegend(); 186 200 chart.setAntiAlias(false); 187 201 188 ChartUtilities.saveChartAsPNG(new File("windowsize.png"), chart, 800, 600); 202 int w = 150 + 40 * assays.size(); 203 ChartUtilities.saveChartAsPNG(new File("windowsize.png"), chart, w, 600); 189 204 } 190 205
Note: See TracChangeset
for help on using the changeset viewer.