List of usage examples for org.jfree.util Log debug
public static void debug(final Object message)
From source file:org.sonar.plugins.xml.LineCountSensor.java
private void addMeasures(SensorContext sensorContext, File file, org.sonar.api.resources.File xmlFile) { LineIterator iterator = null;/* w ww . j ava2 s. c o m*/ int numLines = 0; int numEmptyLines = 0; try { iterator = FileUtils.lineIterator(file); while (iterator.hasNext()) { String line = iterator.nextLine(); numLines++; if (StringUtils.isEmpty(line)) { numEmptyLines++; } } } catch (IOException e) { LOG.warn(e.getMessage()); } finally { LineIterator.closeQuietly(iterator); } try { Log.debug("Count comment in " + file.getPath()); int numCommentLines = new LineCountParser().countLinesOfComment(FileUtils.openInputStream(file)); sensorContext.saveMeasure(xmlFile, CoreMetrics.LINES, (double) numLines); sensorContext.saveMeasure(xmlFile, CoreMetrics.COMMENT_LINES, (double) numCommentLines); sensorContext.saveMeasure(xmlFile, CoreMetrics.NCLOC, (double) numLines - numEmptyLines - numCommentLines); } catch (Exception e) { LOG.debug("Fail to count lines in " + file.getPath(), e); } LOG.debug("LineCountSensor: " + xmlFile.getKey() + ":" + numLines + "," + numEmptyLines + "," + 0); }
From source file:ubic.gemma.core.datastructure.matrix.MatrixWriter.java
/** * @param geneAnnotations Map of composite sequences to an array of delimited strings: [probe name,genes symbol, * gene Name] -- these include the "|" to indicate multiple genes, and originate in the platform annotation * files./* ww w. j av a 2s .c om*/ * @param writeHeader the writer header * @param matrix the matrix * @param orderByDesign if true, the columns are in the order defined by * ExpressionDataMatrixColumnSort.orderByExperimentalDesign * @param writeGeneInfo whether to write gene info * @param writer the writer to use * @param writeSequence whether to write sequence * @throws IOException when the write failed */ @SuppressWarnings({ "unused", "WeakerAccess" }) // Possible external use public void writeWithStringifiedGeneAnnotations(Writer writer, ExpressionDataMatrix<?> matrix, Map<CompositeSequence, String[]> geneAnnotations, boolean writeHeader, boolean writeSequence, boolean writeGeneInfo, boolean orderByDesign) throws IOException { int rows = matrix.rows(); List<BioMaterial> orderedBioMaterials = this.getBioMaterialsInRequestedOrder(matrix, orderByDesign); StringBuffer buf = new StringBuffer(); if (writeHeader) { this.writeHeader(orderedBioMaterials, matrix, geneAnnotations, writeSequence, writeGeneInfo, buf); } for (int j = 0; j < rows; j++) { CompositeSequence probeForRow = matrix.getDesignElementForRow(j); buf.append(probeForRow.getName()).append("\t"); this.writeSequence(writeSequence, buf, probeForRow); if (writeGeneInfo) { this.addGeneInfoFromStrings(buf, probeForRow, geneAnnotations); } int orderedBioMLastIndex = orderedBioMaterials.size() - 1; for (BioMaterial bioMaterial : orderedBioMaterials) { int i = matrix.getColumnIndex(bioMaterial); Object val = matrix.get(j, i); // Don't want line to contain a trailing unnecessary tab if (orderedBioMaterials.indexOf(bioMaterial) == orderedBioMLastIndex) { buf.append(val); } else { buf.append(val).append("\t"); } } buf.append("\n"); } writer.write(buf.toString()); writer.flush(); Log.debug("Done writing"); }
From source file:ubic.gemma.core.datastructure.matrix.MatrixWriter.java
/** * @param orderByDesign if true, the columns are in the order defined by * ExpressionDataMatrixColumnSort.orderByExperimentalDesign * @param writeSequence whether to write sequence * @param writer the writer to use * @param writeGeneInfo whether to write gene info * @param matrix the matrix/*from ww w.j a va 2s. c o m*/ * @param writeHeader the writer header * @param geneAnnotations Map of composite sequences to an array of delimited strings: [probe name,genes symbol, * gene Name] -- these include the "|" to indicate multiple genes, and originate in the platform annotation * files. * @throws IOException when the write failed */ @SuppressWarnings({ "unused", "WeakerAccess" }) // Possible external use public void write(Writer writer, ExpressionDataMatrix<?> matrix, Map<CompositeSequence, Collection<Gene>> geneAnnotations, boolean writeHeader, boolean writeSequence, boolean writeGeneInfo, boolean orderByDesign) throws IOException { int rows = matrix.rows(); List<BioMaterial> bioMaterials = this.getBioMaterialsInRequestedOrder(matrix, orderByDesign); StringBuffer buf = new StringBuffer(); if (writeHeader) { this.writeHeader(bioMaterials, matrix, geneAnnotations, writeSequence, writeGeneInfo, buf); } for (int j = 0; j < rows; j++) { CompositeSequence probeForRow = matrix.getDesignElementForRow(j); buf.append(probeForRow.getName()).append("\t"); this.writeSequence(writeSequence, buf, probeForRow); if (writeGeneInfo) { this.addGeneInfo(buf, probeForRow, geneAnnotations); } // print the data. for (BioMaterial bioMaterial : bioMaterials) { buf.append("\t"); int i = matrix.getColumnIndex(bioMaterial); Object val = matrix.get(j, i); if (val == null || (val instanceof Double && Double.isNaN((Double) val))) { //noinspection RedundantStringOperation // being explicit buf.append(""); } else if (val instanceof Double) { buf.append(String.format("%.3g", (Double) val)); } else { buf.append(val); } } buf.append("\n"); } writer.write(buf.toString()); writer.flush(); Log.debug("Done writing"); }
From source file:ubic.gemma.datastructure.matrix.MatrixWriter.java
/** * @param writer/*w w w . j a v a 2 s. c om*/ * @param matrix * @param geneAnnotations Map of composite sequences to an array of delimited strings: [probe name,genes symbol, * gene Name] -- these include the "|" to indicate multiple genes, and originate in the platform annotation * files. * @param writeHeader * @param writeSequence * @param writeGeneInfo * @apram orderByDesign * @throws IOException */ public void writeWithStringifiedGeneAnnotations(Writer writer, ExpressionDataMatrix<?> matrix, Map<CompositeSequence, String[]> geneAnnotations, boolean writeHeader, boolean writeSequence, boolean writeGeneInfo, boolean orderByDesign) throws IOException { int columns = matrix.columns(); int rows = matrix.rows(); List<BioMaterial> orderedBioMaterials = getBioMaterialsInRequestedOrder(matrix, orderByDesign); StringBuffer buf = new StringBuffer(); if (writeHeader) { writeHeader(orderedBioMaterials, matrix, geneAnnotations, writeSequence, writeGeneInfo, columns, buf); } for (int j = 0; j < rows; j++) { CompositeSequence probeForRow = matrix.getDesignElementForRow(j); buf.append(probeForRow.getName() + "\t"); if (writeSequence) { BioSequence biologicalCharacteristic = probeForRow.getBiologicalCharacteristic(); if (biologicalCharacteristic != null) buf.append(biologicalCharacteristic.getName()); buf.append("\t"); } if (writeGeneInfo) { addGeneInfoFromStrings(buf, probeForRow, geneAnnotations); } int orderedBioMLastIndex = orderedBioMaterials.size() - 1; for (BioMaterial bioMaterial : orderedBioMaterials) { int i = matrix.getColumnIndex(bioMaterial); Object val = matrix.get(j, i); // Don't want line to contain a trailing unnecessary tab if (orderedBioMaterials.indexOf(bioMaterial) == orderedBioMLastIndex) { buf.append(val); } else { buf.append(val + "\t"); } } buf.append("\n"); } writer.write(buf.toString()); writer.flush(); Log.debug("Done writing"); }
From source file:ubic.gemma.datastructure.matrix.MatrixWriter.java
/** * @param writer/*from w ww. ja v a 2s.c o m*/ * @param matrix * @param geneAnnotations * @param writeHeader * @param writeSequence * @param writeGeneInfo * @param orderByDesign if true, the columns are in the order defined by * ExpressionDataMatrixColumnSort.orderByExperimentalDesign * @throws IOException */ public void write(Writer writer, ExpressionDataMatrix<?> matrix, Map<CompositeSequence, Collection<Gene>> geneAnnotations, boolean writeHeader, boolean writeSequence, boolean writeGeneInfo, boolean orderByDesign) throws IOException { int columns = matrix.columns(); int rows = matrix.rows(); List<BioMaterial> bioMaterials = getBioMaterialsInRequestedOrder(matrix, orderByDesign); StringBuffer buf = new StringBuffer(); if (writeHeader) { writeHeader(bioMaterials, matrix, geneAnnotations, writeSequence, writeGeneInfo, columns, buf); } for (int j = 0; j < rows; j++) { CompositeSequence probeForRow = matrix.getDesignElementForRow(j); buf.append(probeForRow.getName() + "\t"); if (writeSequence) { BioSequence biologicalCharacteristic = probeForRow.getBiologicalCharacteristic(); if (biologicalCharacteristic != null) buf.append(biologicalCharacteristic.getName()); buf.append("\t"); } if (writeGeneInfo) { addGeneInfo(buf, probeForRow, geneAnnotations); } // print the data. for (BioMaterial bioMaterial : bioMaterials) { buf.append("\t"); int i = matrix.getColumnIndex(bioMaterial); Object val = matrix.get(j, i); if (val == null || (val instanceof Double && Double.isNaN((Double) val))) { buf.append(""); } else if (val instanceof Double) { buf.append(String.format("%.3g", (Double) val)); } else { buf.append(val); } } buf.append("\n"); } writer.write(buf.toString()); writer.flush(); Log.debug("Done writing"); }