Exemplo n.º 1
0
  static List<Track> tstLoadFi(
      TrackLoader trackLoader,
      String filepath,
      Integer expected_tracks,
      Genome genome,
      boolean makeIndex)
      throws Exception {
    ResourceLocator locator = new ResourceLocator(filepath);

    // Try creating an index
    // UI would ask for confirmation
    if (makeIndex) {
      try {
        TestUtils.createIndex(filepath);
      } catch (Exception e) {

      }
    }
    List<Track> tracks = trackLoader.load(locator, genome);
    if (expected_tracks != null) {
      assertEquals(expected_tracks.intValue(), tracks.size());
      if (expected_tracks == 0) {
        return tracks;
      }
    }

    Track track = tracks.get(0);
    assertEquals(locator, track.getResourceLocator());

    return tracks;
  }
Exemplo n.º 2
0
  @Test
  public void testBedAndBigBed() throws Exception {
    String bedPath = TestUtils.DATA_DIR + "bed/Unigene.sample.nolong.bed";
    String bigBedPath = TestUtils.DATA_DIR + "bed/Unigene.sample.nolong.bigbed";

    File bigBedFile = new File(bigBedPath);

    // Need to index so query of bed file is accurate
    TestUtils.createIndex(bedPath);

    List<Track> bedtracks = tstLoadFi(bedPath, 1, false);
    List<Track> bigBedtracks = tstLoadFi(bigBedPath, 1, false);

    String chr = "chr2";
    int start = 178711404 - 1;
    int end = 179189619 + 1;

    FeatureTrack bedTrack = (FeatureTrack) bedtracks.get(0);
    FeatureTrack bigBedTrack = (FeatureTrack) bigBedtracks.get(0);

    // Multiple trials because we're concerned about file open/close issues
    int trials = 10;

    for (int ii = 0; ii < trials; ii++) {
      int strt = start + ii;
      List<Feature> bedFeatures = bedTrack.getFeatures(chr, strt, end);
      List<Feature> bigBedFeatures = bigBedTrack.getFeatures(chr, strt, end);
      TestUtils.assertFeatureListsEqual(bedFeatures.iterator(), bigBedFeatures.iterator());

      // NOT FOOLPROOF
      assertTrue(bigBedFile.canWrite());
    }
  }
Exemplo n.º 3
0
  /**
   * Test that we properly load a vcf file, even though the extension is upper-case. IGV-2012
   *
   * @throws Exception
   */
  @Test
  public void testLoadVCFUpperCase() throws Exception {
    String filepath = TestUtils.DATA_DIR + "vcf/HC_MOD_CAPS.VCF";
    ResourceLocator locator = new ResourceLocator(filepath);
    TestUtils.createIndex(filepath);

    List<Track> tracks = trackLoader.load(locator, genome);
    assertEquals(1, tracks.size());
    assertTrue("VCF file loaded incorrect track type", tracks.get(0) instanceof VariantTrack);
  }
Exemplo n.º 4
0
 @Test
 public void testLoadBEDtxt() throws Exception {
   String filepath = TestUtils.DATA_DIR + "bed/intervalTest.bed.txt";
   TestUtils.createIndex(filepath);
   tstLoadFi(filepath, 1, true);
 }