Package org.bioinfo.ngs.qc.qualimap.gui.utils

Examples of org.bioinfo.ngs.qc.qualimap.gui.utils.StatsKeeper


    public StatsReporter() {
        name = "Results";
        namePostfix = "";
        fileName = "qualimapReport";
        inputDataKeeper = new StatsKeeper();
        summaryStatsKeeper = new StatsKeeper();
        tableDataStatsKeeper = new StatsKeeper();
    }
View Full Code Here


    }

    private void prepareChromosomeStatsKeeper(BamStats.ChromosomeInfo[] statsArray) {

        tableDataStatsKeeper = new StatsKeeper();
        tableDataStatsKeeper.setName("Chromosome stats" + namePostfix );

        StatsKeeper.Section headerSection = new StatsKeeper.Section(Constants.TABLE_STATS_HEADER);
        String[] header = {
                "Name", "Length", "Mapped bases", "Mean coverage", "Standard deviation"
View Full Code Here

    private void createSummaryTable(StatsReporter reporter) throws IOException {

        logLine("Creating summary...\n");

        StatsKeeper summaryKeeper = reporter.getSummaryStatsKeeper();

        StatsKeeper.Section section = new StatsKeeper.Section("Globals");
        section.addRow("Number of samples", Integer.toString( bamQCResults.size() ));
        summaryKeeper.addSection(section);

        StatsKeeper tableDataKeeper = reporter.getTableDataStatsKeeper();

        StatsKeeper.Section headerSection = new StatsKeeper.Section("header");
        String[] header = {"Sample name", "Coverage mean", "Coverage std",
                "GC percentage", "Mapping quality mean", "Insert size median" };
        headerSection.addRow( header );
        tableDataKeeper.addSection(headerSection);

        StatsKeeper.Section dataSection = new StatsKeeper.Section("data");

        for (SampleInfo bamQcResult : bamQCResults) {
            String path = bamQcResult.path + File.separator + "genome_results.txt";
            BamStats stats = loadSummaryStats(path);

            String[] row = new String[header.length];
            row[0] = bamQcResult.name;
            row[1] = Double.toString( stats.getMeanCoverage() );
            row[2] = Double.toString( stats.getStdCoverage() );
            row[3] = Double.toString( stats.getMeanGcRelativeContent() );
            row[4] = Double.toString( stats.getMeanMappingQualityPerWindow() );
            row[5] = Double.toString( stats.getMedianInsertSize() );
            dataSection.addRow(row);

            double[] sample = new double[NUM_FEATURES];
            sample[0] = stats.getMeanCoverage();
            sample[1] = stats.getStdCoverage();
            sample[2] = stats.getMeanGcRelativeContent();
            sample[3] = stats.getMeanMappingQualityPerWindow();
            sample[4] = stats.getMedianInsertSize();
            sampleData.add(sample);


        }
        tableDataKeeper.addSection(dataSection);



    }
View Full Code Here

    }

    void appendChromosomeStats() {

        StatsKeeper chrStatsKeeper = reporter.getTableDataStatsKeeper();
        List<Section> sections = chrStatsKeeper.getSections();

        append("\n<div class=table-summary>");
        append("<h3>" + chrStatsKeeper.getName() + "</h3>" );
        append("<table class=\"summary hovertable\">");

        for(Section s : sections) {
            boolean sectionIsHeader = s.getName().equals(Constants.TABLE_STATS_HEADER);
            for (String[] row : s.getRows()) {
View Full Code Here

    }

    private void prepareHtmlSummary(StatsReporter reporter) {


        StatsKeeper summaryKeeper = reporter.getSummaryStatsKeeper();
        StringUtilsSwing sdf = new StringUtilsSwing();
        TranscriptDataHandler th = computeCountsTask.getTranscriptDataHandler();

        StatsKeeper.Section readsAlignment = new StatsKeeper.Section("Reads alignment");

        readsAlignment.addRow("Aligned to genes:", sdf.formatLong(computeCountsTask.getTotalReadCounts()));
        readsAlignment.addRow("No feature assigned:", sdf.formatLong(computeCountsTask.getNoFeatureNumber()));
        readsAlignment.addRow("Non-unique alignment:", sdf.formatLong(computeCountsTask.getAlignmentNotUniqueNumber()));
        readsAlignment.addRow("Ambiguous alignment:", sdf.formatLong(computeCountsTask.getAmbiguousNumber()));
        readsAlignment.addRow("Not aligned:", sdf.formatLong(computeCountsTask.getNotAlignedNumber()));

        summaryKeeper.addSection(readsAlignment);

        StatsKeeper.Section readsOrigin = new StatsKeeper.Section("Reads genomic origin");
        long totalReadCount = computeCountsTask.getTotalReadCounts() + computeCountsTask.getNoFeatureNumber();
        long exonicReadCount = totalReadCount - computeCountsTask.getNoFeatureNumber();
        long intronicReadCount = th.getNumIntronicReads();
        long intergenicReadCount = th.getNumIntergenicReads();
        readsOrigin.addRow("Exonic: ", sdf.formatLong(exonicReadCount) + " / " +
                sdf.formatPercentage( (100.*exonicReadCount) /  totalReadCount ));
        readsOrigin.addRow("Intronic: ", sdf.formatLong(intronicReadCount) + " / " +
                sdf.formatPercentage( (100.*intronicReadCount) /  totalReadCount ));
        readsOrigin.addRow("Intergenic: ", sdf.formatLong(intergenicReadCount) + " / " +
                sdf.formatPercentage( (100.*intergenicReadCount) /  totalReadCount ));
        summaryKeeper.addSection(readsOrigin);

        //TODO: fix this in case of SE reads
        /*if (computeCountsTask.getLibraryProtocol() != LibraryProtocol.NON_STRAND_SPECIFIC) {
            StatsKeeper.Section libraryProtocol = new StatsKeeper.Section("Library protocol");
            double correctlyMappedPercentage =
                    (100.*computeCountsTask.getProtocolCorrectlyMapped()) / computeCountsTask.getTotalFragmentCount() ;
            libraryProtocol.addRow("Concordant fragments: ",
                    sdf.formatLong(computeCountsTask.getProtocolCorrectlyMapped()) + " / " +
                    sdf.formatPercentage(correctlyMappedPercentage));
        }*/


        TranscriptDataHandler transcriptDataHandler = computeCountsTask.getTranscriptDataHandler();
        StatsKeeper.Section transcriptCoverage = new StatsKeeper.Section("Transcript coverage profile");
        transcriptCoverage.addRow("5' bias:", sdf.formatDecimal(transcriptDataHandler.getMedianFivePrimeBias()));
        transcriptCoverage.addRow("3' bias:", sdf.formatDecimal(transcriptDataHandler.getMedianThreePrimeBias()));
        transcriptCoverage.addRow("5'-3' bias:", sdf.formatDecimal(transcriptDataHandler.getMedianFiveToThreeBias()));

        summaryKeeper.addSection(transcriptCoverage);

        StatsKeeper.Section junctionAnalysisSection = new StatsKeeper.Section("Junction analysis");
        long numReadsWithJunctions = th.getNumReadsWithJunctions();
        junctionAnalysisSection.addRow("Reads at junctions:", sdf.formatLong(numReadsWithJunctions));
        if (numReadsWithJunctions > 0) {
            List<JunctionInfo> junctionList = th.computeSortedJunctionsMap();

            int count = 0;
            for(int i = junctionList.size() -1; i >= 0 && count <= 10; i--){
                JunctionInfo info = junctionList.get(i);
                junctionAnalysisSection.addRow(info.getJunctionString(), sdf.formatPercentage(info.getPercentage()));
                count += 1;
            }

        }
        summaryKeeper.addSection(junctionAnalysisSection);




    }
View Full Code Here

            section.add(table);
        }


        StatsKeeper chrStatsKeeper = reporter.getTableDataStatsKeeper();
        List<StatsKeeper.Section> chromosomeSections = chrStatsKeeper.getSections();
        Paragraph chrTitle = createSectionTitle(chrStatsKeeper.getName());
        Section chrSection = summaryChapter.addSection(chrTitle);

        Table chrTable = new Table(5);
        chrTable.setPadding(2);
        chrTable.setSpacing(2);
View Full Code Here

TOP

Related Classes of org.bioinfo.ngs.qc.qualimap.gui.utils.StatsKeeper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.