Changeset 5800


Ignore:
Timestamp:
Dec 19, 2019, 10:51:12 AM (2 years ago)
Author:
Nicklas Nordborg
Message:

References #1216: Finalize the "Confirm MIPs demux" wizard

Metrics file is split into individual files if demuxing multiple sequencing runs together.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/grid/MipsDemuxJobCreator.java

    r5786 r5800  
    692692            dc.saveItem(metricsFile);
    693693          }
    694           metricsFile.upload(new ByteArrayInputStream(metrics.getBytes(Charset.forName("UTF-8"))), false);
     694          String metricsForDemux = demuxNames.size() > 1 ? extractSections(metrics, demuxName) : metrics;
     695          metricsFile.upload(new ByteArrayInputStream(metricsForDemux.getBytes(Charset.forName("UTF-8"))), false);
    695696         
    696697          AnyToAny dxMetrics = AnyToAny.getNew(dc, dx, metricsFile, "DemultiplexMetrics", true);
     
    791792      return total;
    792793    }
     794
     795    /**
     796      Split the metrics file so that only sections related to the given
     797      demux/flow cell remains.
     798    */
     799    private String extractSections(String allMetrics, String demuxName)
     800    {
     801     
     802      String[] lines = allMetrics.split("\n");
     803      StringBuilder extracted = new StringBuilder();
     804      boolean clone = false;
     805      for (String line : lines)
     806      {
     807        if (line.startsWith("# [") && line.endsWith("]"))
     808        {
     809          // This is a new section -- see if it matches our wanted demux
     810          clone = line.contains(demuxName);
     811        }
     812        if (clone) extracted.append(line).append("\n");
     813      }
     814      return extracted.toString();
     815    }
     816
    793817  }
    794  
    795818 
    796819  private static class Reads
Note: See TracChangeset for help on using the changeset viewer.