Exemplo n.º 1
0
  private void loadIGVFile(ResourceLocator locator, List<Track> newTracks, Genome genome) {

    if (locator.isLocal()) {
      if (!checkSize(locator)) {
        return;
      }
    }

    String dsName = locator.getTrackName();
    IGVDataset ds = new IGVDataset(locator, genome);
    ds.setName(dsName);

    TrackProperties trackProperties = ds.getTrackProperties();
    String path = locator.getPath();
    TrackType type = ds.getType();
    for (String trackName : ds.getTrackNames()) {

      DatasetDataSource dataSource = new DatasetDataSource(trackName, ds, genome);
      String trackId = path + "_" + trackName;
      DataSourceTrack track = new DataSourceTrack(locator, trackId, trackName, dataSource);

      // track.setRendererClass(HeatmapRenderer.class);
      track.setTrackType(ds.getType());
      track.setProperties(trackProperties);

      if (type == TrackType.ALLELE_FREQUENCY) {
        track.setRendererClass(PointsRenderer.class);
        track.setHeight(40);
      }
      newTracks.add(track);
    }
  }
Exemplo n.º 2
0
  /**
   * Add the provided SegmentedDataSet to the list of tracks, set other relevant properties
   *
   * @param locator
   * @param newTracks
   * @param genome
   * @param ds
   */
  private void loadSegTrack(
      ResourceLocator locator, List<Track> newTracks, Genome genome, SegmentedDataSet ds) {
    String path = locator.getPath();

    TrackProperties props = null;
    if (ds instanceof SegmentedAsciiDataSet) {
      props = ((SegmentedAsciiDataSet) ds).getTrackProperties();
    }

    // The "freq" track.  TODO - make this optional
    if ((ds.getType() == TrackType.COPY_NUMBER || ds.getType() == TrackType.CNV)
        && ds.getSampleNames().size() > 1) {
      FreqData fd = new FreqData(ds, genome);
      String freqTrackId = path;
      String freqTrackName = "CNV Summary";
      CNFreqTrack freqTrack = new CNFreqTrack(locator, freqTrackId, freqTrackName, fd);
      newTracks.add(freqTrack);
    }

    for (String trackName : ds.getSampleNames()) {
      String trackId = path + "_" + trackName;
      SegmentedDataSource dataSource = new SegmentedDataSource(trackName, ds);
      DataSourceTrack track = new DataSourceTrack(locator, trackId, trackName, dataSource);
      track.setRendererClass(HeatmapRenderer.class);
      track.setTrackType(ds.getType());

      if (props != null) {
        track.setProperties(props);
      }

      newTracks.add(track);
    }
  }