Exemple #1
0
  @Test
  public void testWigAndBigWig() throws Exception {
    String wigPath = TestUtils.DATA_DIR + "wig/test_fixedStep.wig";
    String bigWigPath = TestUtils.DATA_DIR + "wig/test_fixedStep.bigwig";
    List<Track> wigtracks = tstLoadFi(wigPath, 1, false);
    List<Track> bigWigtracks = tstLoadFi(bigWigPath, 1, false);

    String chr = "chr19";
    int start = 5930725;
    int end = 5930764;
    int zoom = 21;

    DataSourceTrack wigTrack = (DataSourceTrack) wigtracks.get(0);
    DataSourceTrack bigWigTrack = (DataSourceTrack) bigWigtracks.get(0);

    int trials = 10;

    for (int ii = 0; ii < trials; ii++) {
      int strt = start + ii;
      List<LocusScore> wigScores = wigTrack.getSummaryScores(chr, strt, end, zoom);
      List<LocusScore> bigWigScores = bigWigTrack.getSummaryScores(chr, strt, end, zoom);
      assertEquals(wigScores.size(), bigWigScores.size());
      int ind = 0;
      for (LocusScore ws : wigScores) {
        LocusScore bws = bigWigScores.get(ind);
        assertEquals(ws.getScore(), bws.getScore());
        ind++;
      }
    }
  }
  @Test
  public void testLoadDataSourceTrack() throws Exception {
    String path = TestUtils.DATA_DIR + "sessions/tdf_session.xml";
    rewriteRestoreSession(path);

    DataSourceTrack track = (DataSourceTrack) IGV.getInstance().getAllTracks().get(0);
    assertEquals(true, TestUtils.runMethod(track, "getNormalize"));
    assertEquals("NA12878.SLX.egfr.sam.tdf", track.getName());
  }
  @Test
  public void testLoadCombinedDataSourceSession() throws Exception {
    String sessionpath = TestUtils.DATA_DIR + "sessions/subtypes_wdiff.xml";
    rewriteRestoreSession(sessionpath);

    String combPart0 = "TRIBE_p_TCGAaffx_B1_2_GBM_Nsp_GenomeWideSNP_6_E11_155884";
    String combPart1 = "TRIGS_p_TCGAaffxB5_sty_GenomeWideSNP_6_D05_223156";

    DataTrack track0 =
        Iterables.find(IGV.getInstance().getDataTracks(), new ContIdPredicate(combPart0));
    DataTrack track1 =
        Iterables.find(IGV.getInstance().getDataTracks(), new ContIdPredicate(combPart1));

    DataSourceTrack combTrack =
        (DataSourceTrack)
            Iterables.find(
                IGV.getInstance().getDataTracks(),
                new ContIdPredicate(new String[] {combPart0, combPart1}));

    assertTrue(combTrack.getRenderer() instanceof BarChartRenderer);
    assertEquals("Difference", combTrack.getName());

    String chr = "chr1";
    int start = 0;
    int end = 1000;

    LocusScore sumScore0 = track0.getSummaryScores(chr, start, end, 0).get(0);
    LocusScore sumScore1 = track1.getSummaryScores(chr, start, end, 0).get(0);
    LocusScore sumScoreComb = combTrack.getSummaryScores(chr, start, end, 0).get(0);

    assertEquals(sumScore0.getStart(), sumScore1.getStart());
    assertEquals(sumScore0.getStart(), sumScoreComb.getStart());
    assertEquals(sumScore1.getEnd(), sumScoreComb.getEnd());

    assertEquals(sumScore0.getScore() - sumScore1.getScore(), sumScoreComb.getScore(), 1e-10);
  }