Package net.sf.cram.lossy

Examples of net.sf.cram.lossy.QualityScorePreservation


        sequence = Utils.trySequenceNameVariants(referenceSequenceFile,
            seqName);

    }

    QualityScorePreservation preservation;
    if (params.losslessQS)
      preservation = new QualityScorePreservation("*40");
    else
      preservation = new QualityScorePreservation(params.qsSpec);

    byte[] ref = sequence == null ? new byte[0] : sequence.getBases();

    {
      // hack:
View Full Code Here


    f.captureUnmappedBases = true;
    f.captureUnmappedScores = true;
    List<CramRecord> cramRecords = new ArrayList<CramRecord>(maxRecords);
    int prevAlStart = samRecords.get(0).getAlignmentStart();
    int index = 0;
    QualityScorePreservation preservation = new QualityScorePreservation(
        "R8X10-R40X5-N40-U40");
    for (SAMRecord samRecord : samRecords) {
      CramRecord cramRecord = f.createCramRecord(samRecord);
      cramRecord.index = index++;
      cramRecord.alignmentStartOffsetFromPreviousRecord = samRecord
          .getAlignmentStart() - prevAlStart;
      prevAlStart = samRecord.getAlignmentStart();

      cramRecords.add(cramRecord);
      int refPos = samRecord.getAlignmentStart();
      int readPos = 0;
      for (CigarElement ce : samRecord.getCigar().getCigarElements()) {
        if (ce.getOperator().consumesReferenceBases()) {
          for (int i = 0; i < ce.getLength(); i++)
            tracks.addCoverage(refPos + i, 1);
        }
        switch (ce.getOperator()) {
        case M:
        case X:
        case EQ:
          for (int i = readPos; i < ce.getLength(); i++) {
            byte readBase = samRecord.getReadBases()[readPos + i];
            byte refBase = tracks.baseAt(refPos + i);
            if (readBase != refBase)
              tracks.addMismatches(refPos + i, 1);
          }
          break;

        default:
          break;
        }

        readPos += ce.getOperator().consumesReadBases() ? ce
            .getLength() : 0;
        refPos += ce.getOperator().consumesReferenceBases() ? ce
            .getLength() : 0;
      }

      preservation.addQualityScores(samRecord, cramRecord, tracks);
    }

    // mating:
    Map<String, CramRecord> mateMap = new TreeMap<String, CramRecord>();
    for (CramRecord r : cramRecords) {
View Full Code Here

TOP

Related Classes of net.sf.cram.lossy.QualityScorePreservation

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.