Ejemplo n.º 1
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());
    }
  }
Ejemplo n.º 2
0
  @Test
  public void testLoadGFFAliasedChrs() throws Exception {
    String filepath = TestUtils.DATA_DIR + "gff/aliased.unsorted.gff";
    Genome genome =
        IgvTools.loadGenome(TestUtils.DATA_DIR + "genomes/hg18_truncated_aliased.genome");
    List<Track> tracks = trackLoader.load(new ResourceLocator(filepath), genome);
    assertEquals(1, tracks.size());
    FeatureTrack track = (FeatureTrack) tracks.get(0);

    assertEquals("aliased.unsorted.gff", track.getName());

    List<Feature> features = track.getFeatures("chr1", 0, Integer.MAX_VALUE);
    assertEquals(56, features.size());

    features = track.getFeatures("chr5", 0, Integer.MAX_VALUE);
    assertEquals(16, features.size());

    // Non-aliased
    features = track.getFeatures("NC_007072.3", 0, Integer.MAX_VALUE);
    assertEquals(30, features.size());
  }
Ejemplo n.º 3
0
  @Test
  public void testLoadGFF() throws Exception {
    String filepath = TestUtils.DATA_DIR + "gff/simfeatures.gff3";
    List<Track> tracks = trackLoader.load(new ResourceLocator(filepath), genome);
    assertEquals(1, tracks.size());
    FeatureTrack track = (FeatureTrack) tracks.get(0);

    assertEquals("notmeaningful", track.getName());

    List<Feature> features = track.getFeatures("chr1", 0, Integer.MAX_VALUE);
    assertEquals(2, features.size());

    IGVFeature feat0 = (IGVFeature) features.get(0);
    IGVFeature feat1 = (IGVFeature) features.get(1);

    assertEquals(707 - 1, feat0.getStart());
    assertEquals(943, feat0.getEnd());
    assertEquals(7563 - 1, feat1.getStart());
    assertEquals(7938, feat1.getEnd());
  }