Package net.sf.cram.encoding

Examples of net.sf.cram.encoding.DataReaderFactory$DataReaderWithStats


    String seqName = SAMRecord.NO_ALIGNMENT_REFERENCE_NAME;
    if (s.sequenceId != SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX) {
      SAMSequenceRecord sequence = fileHeader.getSequence(s.sequenceId);
      seqName = sequence.getSequenceName();
    }
    DataReaderFactory f = new DataReaderFactory();
    Map<Integer, InputStream> inputMap = new HashMap<Integer, InputStream>();
    for (Integer exId : s.external.keySet()) {
      inputMap.put(exId, new ByteArrayInputStream(s.external.get(exId)
          .getRawContent()));
    }

    long time = 0;
    Reader reader = f.buildReader(new DefaultBitInputStream(
        new ByteArrayInputStream(s.coreBlock.getRawContent())),
        inputMap, h, s.sequenceId);

    List<CramRecord> records = new ArrayList<CramRecord>();

    long readNanos = 0;
    int prevStart = s.alignmentStart;
    for (int i = 0; i < s.nofRecords; i++) {
      CramRecord r = new CramRecord();
      r.index = i;

      try {
        time = System.nanoTime();
        reader.read(r);
        readNanos += System.nanoTime() - time;
      } catch (EOFException e) {
        e.printStackTrace();
        throw e;
      }

      if (r.sequenceId == s.sequenceId) {
        r.setSequenceName(seqName);
        r.sequenceId = s.sequenceId;
      } else {
        if (r.sequenceId == SAMRecord.NO_ALIGNMENT_REFERENCE_INDEX)
          r.setSequenceName(SAMRecord.NO_ALIGNMENT_REFERENCE_NAME);
        else {
          String name = fileHeader.getSequence(r.sequenceId)
              .getSequenceName();
          r.setSequenceName(name);
        }
      }

      records.add(r);

      if (h.AP_seriesDelta) {
        prevStart += r.alignmentStartOffsetFromPreviousRecord;
        r.setAlignmentStart(prevStart);
      }
    }
    log.debug("Slice records read time: " + readNanos / 1000000);

    Map<String, DataReaderWithStats> statMap = f.getStats(reader);
    for (String key : statMap.keySet()) {
      long value = 0;
      if (!nanoMap.containsKey(key)) {
        nanoMap.put(key, 0L);
        value = 0;
View Full Code Here

TOP

Related Classes of net.sf.cram.encoding.DataReaderFactory$DataReaderWithStats

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.