Examples of CigarOperator


Examples of htsjdk.samtools.CigarOperator

    public int updateReadStates() {
        int nRemoved = 0;
        final Iterator<AlignmentStateMachine> it = iterator();
        while (it.hasNext()) {
            final AlignmentStateMachine state = it.next();
            final CigarOperator op = state.stepForwardOnGenome();
            if (op == null) {
                // we discard the read only when we are past its end AND indel at the end of the read (if any) was
                // already processed. Keeping the read state that returned null upon stepForwardOnGenome() is safe
                // as the next call to stepForwardOnGenome() will return null again AND will clear hadIndel() flag.
                it.remove();                                                // we've stepped off the end of the object
View Full Code Here

Examples of htsjdk.samtools.CigarOperator

                    mismatchHistogram.increment(mismatchCount);
                    hqMismatchHistogram.increment(hqMismatchCount);

                    // Add any insertions and/or deletions to the global count
                    for (final CigarElement elem : record.getCigar().getCigarElements()) {
                        final CigarOperator op = elem.getOperator();
                        if (op == CigarOperator.INSERTION || op == CigarOperator.DELETION) ++ this.indels;
                    }
                }
            }
View Full Code Here

Examples of net.sf.samtools.CigarOperator

      String chromosome = fields[2];
      int pos = Integer.parseInt(fields[3]);
      int refLen = Integer.parseInt(fields[5]);
      int altLen = Integer.parseInt(fields[6]);
      int length = 0;
      CigarOperator indelType;
     
      if (refLen > 1) {
        indelType = CigarOperator.D;
        length = refLen - 1;
      } else if (altLen > 1) {
View Full Code Here

Examples of net.sf.samtools.CigarOperator

    byte[] bases = samRecord.getReadBases();
    byte[] qualityScore = samRecord.getBaseQualities();

    for (CigarElement cigarElement : cigarElements) {
      cigarElementLength = cigarElement.getLength();
      CigarOperator operator = cigarElement.getOperator();

      switch (operator) {
      case D:
        features.add(new Deletion(zeroBasedPositionInRead + 1,
            cigarElementLength));
View Full Code Here

Examples of net.sf.samtools.CigarOperator

    int size = cigarElements.size();
    for (i = y = 0, x = start; i < size; ++i) {
      CigarElement ce = cigarElements.get(i);
      int j, l = ce.getLength();
      CigarOperator op = ce.getOperator();
      if (op == CigarOperator.MATCH_OR_MISMATCH || op == CigarOperator.EQ
          || op == CigarOperator.X) {
        for (j = 0; j < l; ++j) {
          int z = y + j;
View Full Code Here

Examples of net.sf.samtools.CigarOperator

    }

    List<CigarElement> list = new ArrayList<CigarElement>();
    int totalOpLen = 1;
    CigarElement ce;
    CigarOperator lastOperator = CigarOperator.MATCH_OR_MISMATCH;
    int lastOpLen = 0;
    int lastOpPos = 1;
    CigarOperator co = null;
    int rfLen = 0;
    for (ReadFeature f : features) {

      int gap = f.getPosition() - (lastOpPos + lastOpLen);
      if (gap > 0) {
        if (lastOperator != CigarOperator.MATCH_OR_MISMATCH) {
          list.add(new CigarElement(lastOpLen, lastOperator));
          lastOpPos += lastOpLen;
          totalOpLen += lastOpLen;
          lastOpLen = gap;
        } else {
          lastOpLen += gap;
        }

        lastOperator = CigarOperator.MATCH_OR_MISMATCH;
      }

      switch (f.getOperator()) {
      case Insertion.operator:
        co = CigarOperator.INSERTION;
        rfLen = ((Insertion) f).getSequence().length;
        break;
      case SoftClip.operator:
        co = CigarOperator.SOFT_CLIP;
        rfLen = ((SoftClip) f).getSequence().length;
        break;
      case HardClip.operator:
        co = CigarOperator.HARD_CLIP ;
        rfLen = ((HardClip) f).getSequence().length;
        break;
      case InsertBase.operator:
        co = CigarOperator.INSERTION;
        rfLen = 1;
        break;
      case Deletion.operator:
        co = CigarOperator.DELETION;
        rfLen = ((Deletion) f).getLength();
        break;
      case RefSkip.operator:
        co = CigarOperator.SKIPPED_REGION;
        rfLen = ((RefSkip) f).getLength();
        break;
      case Padding.operator:
        co = CigarOperator.PADDING ;
        rfLen = ((Padding) f).getLength();
        break;
      case Substitution.operator:
      case ReadBase.operator:
        co = CigarOperator.MATCH_OR_MISMATCH;
        rfLen = 1;
        break;
      default:
        continue;
      }

      if (lastOperator != co) {
        // add last feature
        if (lastOpLen > 0) {
          list.add(new CigarElement(lastOpLen, lastOperator));
          totalOpLen += lastOpLen;
        }
        lastOperator = co;
        lastOpLen = rfLen;
        lastOpPos = f.getPosition();
      } else
        lastOpLen += rfLen;

      if (!co.consumesReadBases())
        lastOpPos -= rfLen;
    }

    if (lastOperator != null) {
      if (lastOperator != CigarOperator.M) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.