Example usage for java.text DecimalFormatSymbols setNaN

List of usage examples for java.text DecimalFormatSymbols setNaN

Introduction

In this page you can find the example usage for java.text DecimalFormatSymbols setNaN.

Prototype

public void setNaN(String NaN) 

Source Link

Document

Sets the string used to represent "not a number".

Usage

From source file:GeMSE.GS.Analysis.Stats.TwoSamplePearsonsCorrelationPanel.java

public TwoSamplePearsonsCorrelationPanel() {
    initComponents();/*from   w  w  w. j a  va 2s . com*/

    _decFor = new DecimalFormat("#.#########");
    _decFor.setRoundingMode(RoundingMode.CEILING);
    DecimalFormatSymbols decFors = _decFor.getDecimalFormatSymbols();
    decFors.setNaN("NaN");
    decFors.setInfinity("");
    _decFor.setDecimalFormatSymbols(decFors);
}

From source file:GeMSE.GS.Analysis.Stats.TwoSampleCovariancePanel.java

public TwoSampleCovariancePanel() {
    initComponents();//w  w  w  .java  2s  . c  o  m

    _decFor = new DecimalFormat("#.#########");
    _decFor.setRoundingMode(RoundingMode.CEILING);
    DecimalFormatSymbols decFors = _decFor.getDecimalFormatSymbols();
    decFors.setNaN("NaN");
    decFors.setInfinity("");
    _decFor.setDecimalFormatSymbols(decFors);

    _biasCorrected = false;
    BiasCorrectedCB.setSelected(_biasCorrected);
}

From source file:chibi.gemmaanalysis.CorrelationAnalysisCLI.java

@Override
protected Exception doWork(String[] args) {
    Exception exc = processCommandLine(args);
    if (exc != null) {
        return exc;
    }/*from   w  w w  .  j  a  v a  2s  .c o  m*/

    Collection<Gene> queryGenes, targetGenes;
    try {
        queryGenes = getQueryGenes();
        targetGenes = getTargetGenes();
    } catch (IOException e) {
        return e;
    }

    // calculate matrices
    CoexpressionMatrices matrices = coexpressionAnalysisService.calculateCoexpressionMatrices(
            expressionExperiments, queryGenes, targetGenes, filterConfig, CorrelationMethod.SPEARMAN);
    DenseDouble3dMatrix<Gene, Gene, BioAssaySet> correlationMatrix = matrices.getCorrelationMatrix();
    // DenseDoubleMatrix3DNamed sampleSizeMatrix = matrices
    // .getSampleSizeMatrix();

    // DoubleMatrixNamed maxCorrelationMatrix = coexpressionAnalysisService
    // .getMaxCorrelationMatrix(correlationMatrix, kMax);
    // DoubleMatrixNamed pValMatrix = coexpressionAnalysisService
    // .calculateMaxCorrelationPValueMatrix(maxCorrelationMatrix,
    // kMax, ees);
    // DoubleMatrixNamed effectSizeMatrix = coexpressionAnalysisService
    // .calculateEffectSizeMatrix(correlationMatrix, sampleSizeMatrix);

    // get row/col name maps
    Map<Gene, String> geneNameMap = matrices.getGeneNameMap();
    Map<ExpressionExperiment, String> eeNameMap = matrices.getEeNameMap();

    DecimalFormat formatter = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US);
    formatter.applyPattern("0.0000");
    DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols();
    symbols.setNaN("NaN");
    formatter.setDecimalFormatSymbols(symbols);

    try {
        MatrixWriter<Gene, Gene> matrixOut;
        matrixOut = new MatrixWriter<Gene, Gene>(outFilePrefix + ".corr.txt", formatter);
        matrixOut.setSliceNameMap(eeNameMap);
        matrixOut.setRowNameMap(geneNameMap);
        matrixOut.setColNameMap(geneNameMap);
        matrixOut.writeMatrix(correlationMatrix, false);

        try (PrintWriter out = new PrintWriter(new FileWriter(outFilePrefix + ".corr.row_names.txt"));) {
            List<Gene> rows = correlationMatrix.getRowNames();
            for (Gene row : rows) {
                out.println(row);
            }
        }

        try (PrintWriter out = new PrintWriter(new FileWriter(outFilePrefix + ".corr.col_names.txt"));) {
            Collection<BioAssaySet> cols = correlationMatrix.getSliceNames();
            for (BioAssaySet bas : cols) {
                ExpressionExperiment ee = (ExpressionExperiment) bas;
                out.println(ee.getShortName());
            }
        }
    } catch (IOException e) {
        return e;
    }
    // out = new MatrixWriter(outFilePrefix + ".max_corr.txt", formatter,
    // geneNameMap, geneNameMap);
    // out.writeMatrix(maxCorrelationMatrix, true);
    // out.close();
    //
    // out = new MatrixWriter(outFilePrefix + ".max_corr.pVal.txt",
    // formatter, geneNameMap, geneNameMap);
    // out.writeMatrix(pValMatrix, true);
    // out.close();
    //
    // out = new MatrixWriter(outFilePrefix + ".effect_size.txt",
    // formatter, geneNameMap, geneNameMap);
    // out.writeMatrix(effectSizeMatrix, true);
    // out.close();

    return null;
}

From source file:GeMSE.GS.Analysis.Stats.OneSampleTTestPanel.java

public OneSampleTTestPanel() {
    initComponents();/*w w  w.ja v a2s.c o m*/
    _sample = new double[0];
    _studentTest = new TTest();

    _decFor = new DecimalFormat("#.#########");
    _decFor.setRoundingMode(RoundingMode.CEILING);
    DecimalFormatSymbols decFors = _decFor.getDecimalFormatSymbols();
    decFors.setNaN("NaN");
    decFors.setInfinity("");
    _decFor.setDecimalFormatSymbols(decFors);
}

From source file:GeMSE.GS.Analysis.Stats.TwoSampleTTestPanel.java

public TwoSampleTTestPanel() {
    initComponents();/*from   w ww  .  ja v  a 2 s.co m*/
    _sample1 = new double[0];
    _sample2 = new double[0];

    _decFor = new DecimalFormat("#.#########");
    _decFor.setRoundingMode(RoundingMode.CEILING);
    DecimalFormatSymbols decFors = _decFor.getDecimalFormatSymbols();
    decFors.setNaN("NaN");
    decFors.setInfinity("");
    _decFor.setDecimalFormatSymbols(decFors);

    _variance = new Variance();
    _studentTest = new TTest();
}