Package net.sf.samtools

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


    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

    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

    }

    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

Related Classes of net.sf.samtools.CigarOperator

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.