Пример #1
0
  @Override
  public GCResult createResult(Result result) {
    if (result.getRow() != null) {
      GCResult gcResult = new GCResult(result.getRow());
      gcResult.setChromosome(result.getValue(Bytes.toBytes("chr"), Bytes.toBytes("name")));

      byte[] family = Bytes.toBytes("gc");
      gcResult.setMin(result.getValue(family, Bytes.toBytes("min")));
      gcResult.setMax(result.getValue(family, Bytes.toBytes("max")));

      gcResult.setTotalFragments(result.getValue(Bytes.toBytes("frag"), Bytes.toBytes("total")));

      return gcResult;
    }
    return null;
  }
Пример #2
0
 public Map<String, List<GCResult>> getBins() throws IOException {
   Map<String, List<GCResult>> byChr = new HashMap<String, List<GCResult>>();
   for (GCResult r : this.getRows()) {
     if (!byChr.containsKey(r.getChromosome()))
       byChr.put(r.getChromosome(), new ArrayList<GCResult>());
     byChr.get(r.getChromosome()).add(r);
   }
   for (String chr : byChr.keySet()) {
     Collections.sort(
         byChr.get(chr),
         new Comparator<GCResult>() {
           @Override
           public int compare(GCResult a, GCResult b) {
             return (a.getMax() < b.getMax()) ? -1 : (a.getMax() > b.getMax()) ? 1 : 0;
           }
         });
   }
   return byChr;
 }