Example #1
0
    synchronized Iterator<Mutation> getFeatures(String trackKey, String chr, int start, int end)
        throws IOException {
      if (currentRange == null || !currentRange.contains(chr, start, end)) {
        Iterator<Feature> features = tribbleFeatureSource.getFeatures(chr, start, end);

        while (features.hasNext()) {
          Mutation feat = (Mutation) features.next();
          String thisKey = feat.getSampleId();
          List<Mutation> keyFeatures = featureMap.get(thisKey);
          if (keyFeatures == null) {
            keyFeatures = new ArrayList<Mutation>();
            featureMap.put(thisKey, keyFeatures);
          }
          keyFeatures.add(feat);
          currentRange = new Range(chr, start, end);
        }
      }
      List<Mutation> featureList = featureMap.get(trackKey);
      return featureList == null ? Collections.EMPTY_LIST.iterator() : featureList.iterator();
    }
Example #2
0
 public boolean overlaps(Range range) {
   return this.overlaps(range.getChr(), range.getStart(), range.getEnd());
 }