Examples of GATKReportTable


Examples of org.broadinstitute.gatk.engine.report.GATKReportTable

            final String stratStateString = stratManager.getStratsAndStatesStringForKey(key);
            final List<Pair<VariantStratifier, Object>> stratsAndStates = stratManager.getStratsAndStatesForKey(key);
            final EvaluationContext nec = stratManager.get(key);

            for ( final VariantEvaluator ve : nec.getVariantEvaluators() ) {
                final GATKReportTable table = report.getTable(ve.getSimpleName());

                final AnalysisModuleScanner scanner = new AnalysisModuleScanner(ve);
                final Map<Field, DataPoint> datamap = scanner.getData();
                try {
                    if ( scanner.hasMoltenField() ) {
                        final Field field = scanner.getMoltenField();
                        final Object fieldValue = field.get(ve);

                        if ( fieldValue == null || ! (fieldValue instanceof Map) )
                            throw new ReviewedGATKException("BUG field " + field.getName() + " must be a non-null instance of Map in " + scanner.getAnalysis().name());
                        final Map<Object, Object> map = (Map<Object, Object>)fieldValue;
                        if ( map.isEmpty() )
                            throw new ReviewedGATKException("BUG: map is null or empty in analysis " + scanner.getAnalysis());
                       
                        int counter = 0; // counter is used to ensure printing order is as defined by entrySet
                        for ( Map.Entry<Object, Object> keyValue : map.entrySet() ) {
                            // "%05d" is a terrible hack to ensure sort order
                            final String moltenStratStateString = stratStateString + String.format("%05d", counter++);
                            setStratificationColumns(table, moltenStratStateString, stratsAndStates);
                            table.set(moltenStratStateString, scanner.getMoltenAnnotation().variableName(), keyValue.getKey());
                            table.set(moltenStratStateString, scanner.getMoltenAnnotation().valueName(), keyValue.getValue());
                        }
                    } else {
                        setStratificationColumns(table, stratStateString, stratsAndStates);
                        for ( final Field field : datamap.keySet()) {
                            table.set(stratStateString, field.getName(), field.get(ve));
                        }
                    }
                } catch (IllegalAccessException e) {
                    throw new ReviewedGATKException("BUG: analysis field not public: " + e);
                }
View Full Code Here

Examples of org.broadinstitute.gatk.engine.report.GATKReportTable

            final String tableName = ve.getSimpleName();
            final String tableDesc = ve.getClass().getAnnotation(Analysis.class).description();
            report.addTable(tableName, tableDesc, 1 + stratifiers.size() + (scanner.hasMoltenField() ? 2 : datamap.size()), GATKReportTable.TableSortingWay.SORT_BY_ROW);

            // grab the table, and add the columns we need to it
            final GATKReportTable table = report.getTable(tableName);
            table.addColumn(tableName, tableName);

            // first create a column to hold each stratifier state
            for (final VariantStratifier vs : stratifiers) {
                final String columnName = vs.getName();
                table.addColumn(columnName, vs.getFormat());
            }

            if ( scanner.hasMoltenField() ) {
                // deal with molten data
                table.addColumn(scanner.getMoltenAnnotation().variableName(), scanner.getMoltenAnnotation().variableFormat());
                table.addColumn(scanner.getMoltenAnnotation().valueName(), scanner.getMoltenAnnotation().valueFormat());
            } else {
                if ( datamap.isEmpty() )
                    throw new ReviewedGATKException("Datamap is empty for analysis " + scanner.getAnalysis());
               
                // add DataPoint's for each field marked as such
                for (final Map.Entry<Field, DataPoint> field : datamap.entrySet()) {
                    try {
                        field.getKey().setAccessible(true);

                        // this is an atomic value, add a column for it
                        final String format = field.getValue().format();
                        table.addColumn(field.getKey().getName(), format);
                    } catch (SecurityException e) {
                        throw new GATKException("SecurityException: " + e);
                    }
                }
            }
View Full Code Here

Examples of org.broadinstitute.gatk.engine.report.GATKReportTable

    @Override
    public void onTraversalDone(Integer sum) {
        final GATKReport report = new GATKReport();
        report.addTable(TABLE_NAME, "Table of read group properties", 12);
        GATKReportTable table = report.getTable(TABLE_NAME);
        DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.SHORT);

        table.addColumn("readgroup");
        //* Emits a GATKReport containing read group, sample, library, platform, center, median insert size and
        //* median read length for each read group in every BAM file.
        table.addColumn("sample", "%s");
        table.addColumn("library", "%s");
        table.addColumn("platform", "%s");
        table.addColumn("center", "%s");
        table.addColumn("date", "%s");
        table.addColumn("has.any.reads");
        table.addColumn("is.paired.end");
        table.addColumn("n.reads.analyzed", "%d");
        table.addColumn("simple.read.type", "%s");
        table.addColumn("median.read.length");
        table.addColumn("median.insert.size");

        for ( final SAMReadGroupRecord rg : getToolkit().getSAMFileHeader().getReadGroups() ) {
            final String rgID = rg.getId();
            table.addRowID(rgID, true);
            PerReadGroupInfo info = readGroupInfo.get(rgID);

            // we are paired if > 25% of reads are paired
            final boolean isPaired = info.nReadsPaired / (1.0 * (info.nReadsSeen+1)) > 0.25;
            final boolean hasAnyReads = info.nReadsSeen > 0;
View Full Code Here

Examples of org.broadinstitute.gatk.engine.report.GATKReportTable

    }

    final private GATKReport createGATKReport(){
        final GATKReport report = new GATKReport();
        report.addTable("ReadLengthDistribution", "Table of read length distributions", 1 + (readGroupsLocation.isEmpty() ? 1 : readGroupsLocation.size()));
        final GATKReportTable tableReport = report.getTable("ReadLengthDistribution");

        tableReport.addColumn("readLength");

        if (readGroupsLocation.isEmpty()){
            tableReport.addColumn("SINGLE_SAMPLE");
            int rowIndex = 0;
            for (Integer length : table.keySet()){
                tableReport.set(rowIndex,0,length);
                tableReport.set(rowIndex,1,table.get(length)[0]);
                rowIndex++;
            }
        }
        else{
            for (SAMReadGroupRecord rg : readGroups)
                tableReport.addColumn(rg.getSample());
            int rowIndex = 0;
            for (Integer length : table.keySet()){
                tableReport.set(rowIndex,0,length);
                for (int i=0; i < readGroupsLocation.size(); i++)
                    tableReport.set(rowIndex,i+1,table.get(length)[i]);
                rowIndex++;
            }

        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.