Search in sources :

Example 31 with MetricsFile

use of htsjdk.samtools.metrics.MetricsFile in project gridss by PapenfussLab.

the class TestHelper method IDSV.

public IdsvMetrics IDSV(Collection<SAMRecord> input) {
    IdsvSamFileMetricsCollector c = new IdsvSamFileMetricsCollector(null);
    for (SAMRecord r : input) {
        c.acceptRecord(r, null);
    }
    MetricsFile<IdsvMetrics, Integer> idsv = new MetricsFile<IdsvMetrics, Integer>();
    MetricsFile<InsertSizeMetrics, Integer> is = new MetricsFile<InsertSizeMetrics, Integer>();
    MetricsFile<CigarDetailMetrics, Integer> sc = new MetricsFile<CigarDetailMetrics, Integer>();
    MetricsFile<MapqMetrics, Integer> mqm = new MetricsFile<MapqMetrics, Integer>();
    c.finish(is, idsv, mqm, sc);
    IdsvMetrics metrics = idsv.getMetrics().get(0);
    return metrics;
}
Also used : MetricsFile(htsjdk.samtools.metrics.MetricsFile) IdsvMetrics(gridss.analysis.IdsvMetrics) SAMRecord(htsjdk.samtools.SAMRecord) InsertSizeMetrics(picard.analysis.InsertSizeMetrics) MapqMetrics(gridss.analysis.MapqMetrics) CigarDetailMetrics(gridss.analysis.CigarDetailMetrics) IdsvSamFileMetricsCollector(au.edu.wehi.idsv.metrics.IdsvSamFileMetricsCollector)

Example 32 with MetricsFile

use of htsjdk.samtools.metrics.MetricsFile in project gridss by PapenfussLab.

the class InsertSizeDistribution method create.

public static InsertSizeDistribution create(File insertSizeMetricsFile) {
    InsertSizeDistribution result = null;
    if (insertSizeMetricsFile != null && insertSizeMetricsFile.exists()) {
        FileReader reader = null;
        try {
            reader = new FileReader(insertSizeMetricsFile);
            MetricsFile<InsertSizeMetrics, Integer> file = new MetricsFile<InsertSizeMetrics, Integer>();
            file.read(reader);
            result = InsertSizeDistribution.create(file.getHistogram());
        } catch (FileNotFoundException e) {
            log.error("Missing insert size distribution for ", insertSizeMetricsFile);
        } finally {
            CloserUtil.close(reader);
        }
        if (result == null) {
            log.debug("Unable to extract insert size distribution from ", insertSizeMetricsFile);
        }
    }
    return result;
}
Also used : MetricsFile(htsjdk.samtools.metrics.MetricsFile) InsertSizeMetrics(picard.analysis.InsertSizeMetrics) FileNotFoundException(java.io.FileNotFoundException) FileReader(java.io.FileReader)

Aggregations

MetricsFile (htsjdk.samtools.metrics.MetricsFile)32 FileReader (java.io.FileReader)21 File (java.io.File)19 Test (org.testng.annotations.Test)15 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)14 SAMRecord (htsjdk.samtools.SAMRecord)10 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)9 SamReader (htsjdk.samtools.SamReader)6 FileNotFoundException (java.io.FileNotFoundException)5 UserException (org.broadinstitute.hellbender.exceptions.UserException)5 IntervalList (htsjdk.samtools.util.IntervalList)4 Transition (org.broadinstitute.hellbender.tools.picard.analysis.artifacts.Transition)4 ProgressLogger (org.broadinstitute.hellbender.utils.runtime.ProgressLogger)4 InsertSizeMetrics (picard.analysis.InsertSizeMetrics)3 CigarDetailMetrics (gridss.analysis.CigarDetailMetrics)2 IdsvMetrics (gridss.analysis.IdsvMetrics)2 MapqMetrics (gridss.analysis.MapqMetrics)2 SAMFileWriter (htsjdk.samtools.SAMFileWriter)2 SAMFileWriterFactory (htsjdk.samtools.SAMFileWriterFactory)2 SAMReadGroupRecord (htsjdk.samtools.SAMReadGroupRecord)2