Search in sources :

Example 6 with IdsvSamFileMetrics

use of au.edu.wehi.idsv.metrics.IdsvSamFileMetrics in project gridss by PapenfussLab.

the class CollectIdsvMetricsTest method should_calc_read_pairing_statistics.

@Test
public void should_calc_read_pairing_statistics() {
    File metricFiles = new File(testFolder.getRoot(), "metrics.txt");
    CollectIdsvMetrics c = new CollectIdsvMetrics();
    c.OUTPUT = metricFiles;
    c.setup(null, null);
    c.acceptRead(RP(0, 1, 2, 1)[1], null);
    c.acceptRead(RP(0, 1, 2, 1)[0], null);
    c.acceptRead(RP(0, 1, 7, 5)[0], null);
    c.acceptRead(RP(0, 1, 7, 5)[1], null);
    c.acceptRead(Read(0, 1, "100M"), null);
    c.acceptRead(OEA(0, 1, "1M", true)[0], null);
    c.acceptRead(OEA(0, 1, "1M", true)[1], null);
    c.acceptRead(Unmapped(100), null);
    SAMRecord[] unmapped = RP(0, 1, 2, 1);
    unmapped[0].setReadUnmappedFlag(true);
    unmapped[1].setReadUnmappedFlag(true);
    SAMRecordUtil.pairReads(unmapped[0], unmapped[1]);
    c.acceptRead(unmapped[0], null);
    c.acceptRead(unmapped[1], null);
    c.finish();
    IdsvMetrics metrics = new IdsvSamFileMetrics(null, metricFiles, null, null, false).getIdsvMetrics();
    assertEquals(4, metrics.READ_PAIRS);
    assertEquals(2, metrics.READ_PAIRS_BOTH_MAPPED);
    assertEquals(1, metrics.READ_PAIRS_ONE_MAPPED);
    assertEquals(1, metrics.READ_PAIRS_ZERO_MAPPED);
}
Also used : SAMRecord(htsjdk.samtools.SAMRecord) IdsvSamFileMetrics(au.edu.wehi.idsv.metrics.IdsvSamFileMetrics) File(java.io.File) IntermediateFilesTest(au.edu.wehi.idsv.IntermediateFilesTest) Test(org.junit.Test)

Example 7 with IdsvSamFileMetrics

use of au.edu.wehi.idsv.metrics.IdsvSamFileMetrics in project gridss by PapenfussLab.

the class ScoringComparisonTest method printSoftClipComparison.

private void printSoftClipComparison(VariantScoringModel model1, VariantScoringModel model2) {
    List<CigarDetailMetrics> sc = CigarSizeDistributionTest.data_778();
    IdsvSamFileMetrics metrics = new IdsvSamFileMetrics(null, null, null, null, sc);
    System.out.println("Split Read:");
    System.out.println("mapq1,mapq2,sclength,score1,score2");
    for (int i = 0; i < mapq.length; i++) {
        int mapq1 = mapq[i];
        for (int j = i; j < mapq.length; j++) {
            int mapq2 = mapq[j];
            for (int scLength = 0; scLength < sc.size(); scLength += 5) {
                System.out.println(String.format("%d,%d,%d,%f,%f", mapq1, mapq2, scLength, model1.scoreSplitRead(metrics, scLength, mapq1, mapq2), model2.scoreSplitRead(metrics, scLength, mapq1, mapq2)));
            }
        }
    }
    System.out.println("SoftClip:");
    System.out.println("mapq1,sclength,score1,score2");
    for (int i = 0; i < mapq.length; i++) {
        int mapq1 = mapq[i];
        for (int scLength = 0; scLength < sc.size(); scLength += 5) {
            System.out.println(String.format("%d,%d,%f,%f", mapq1, scLength, model1.scoreSoftClip(metrics, scLength, mapq1), model2.scoreSoftClip(metrics, scLength, mapq1)));
        }
    }
}
Also used : IdsvSamFileMetrics(au.edu.wehi.idsv.metrics.IdsvSamFileMetrics) CigarDetailMetrics(gridss.analysis.CigarDetailMetrics)

Aggregations

IdsvSamFileMetrics (au.edu.wehi.idsv.metrics.IdsvSamFileMetrics)7 File (java.io.File)5 Test (org.junit.Test)5 IntermediateFilesTest (au.edu.wehi.idsv.IntermediateFilesTest)4 SAMRecord (htsjdk.samtools.SAMRecord)3 CigarDetailMetrics (gridss.analysis.CigarDetailMetrics)2 CollectGridssMetrics (gridss.analysis.CollectGridssMetrics)1 IdsvMetrics (gridss.analysis.IdsvMetrics)1 InsertSizeDistribution (gridss.analysis.InsertSizeDistribution)1 MapqMetrics (gridss.analysis.MapqMetrics)1 MetricsFile (htsjdk.samtools.metrics.MetricsFile)1 InsertSizeMetrics (picard.analysis.InsertSizeMetrics)1