Package net.sf.cram.encoding.read_features

Examples of net.sf.cram.encoding.read_features.Substitution


        refBase = 'N';
      else
        refBase = refBases[refCoord];

      if (bases[i + fromPosInRead] != refBase) {
        Substitution sv = new Substitution();
        sv.setPosition(oneBasedPositionInRead);
        sv.setBase(bases[i + fromPosInRead]);
        sv.setRefernceBase(refBase);
        // sv.setBaseChange(new BaseChange(sv.getRefernceBase(), sv
        // .getBase()));
        sv.setBaseChange(null);

        features.add(sv);

        if (losslessQS || noQS)
          continue;
View Full Code Here


      for (; posInRead < v.getPosition(); posInRead++)
        bases[posInRead - 1] = ref[alignmentStart + posInSeq++];

      switch (v.getOperator()) {
      case Substitution.operator:
        Substitution sv = (Substitution) v;
        byte refBase = ref[alignmentStart + posInSeq];
        byte base = substitutionMatrix.base(refBase, sv.getCode());
        // switch (base) {
        // case 'A':
        // case 'C':
        // case 'G':
        // case 'T':
        // case 'N':
        // break;
        //
        // default:
        // throw new RuntimeException("Invalid base: " + base) ;
        // }
        sv.setBase(base);
        sv.setRefernceBase(refBase);
        bases[posInRead++ - 1] = base;
        posInSeq++;
        break;
      case Insertion.operator:
        Insertion iv = (Insertion) v;
View Full Code Here

          if (r.getReadFeatures() == null)
            continue;
          else
            for (ReadFeature rf : r.getReadFeatures())
              if (rf.getOperator() == Substitution.operator) {
                Substitution s = ((Substitution) rf);
                byte refBase = s.getRefernceBase();
                byte base = s.getBase();
                freqs[refBase][base]++;
              }
        }

        h.substitutionMatrix = new SubstitutionMatrix(freqs);
      } else h.substitutionMatrix = substitutionMatrix ;

      HuffmanParamsCalculator calculator = new HuffmanParamsCalculator();
      for (CramRecord r : records)
        if (r.getReadFeatures() == null)
          continue;
        else
          for (ReadFeature rf : r.getReadFeatures()) {
            if (rf.getOperator() == Substitution.operator) {
              Substitution s = ((Substitution) rf);
              if (s.getCode() == -1) {
                byte refBase = s.getRefernceBase();
                byte base = s.getBase();
                s.setCode(h.substitutionMatrix.code(refBase,
                    base));
              }
              calculator.add(s.getCode());
            }
          }
      calculator.calculate();

      h.eMap.put(EncodingKey.BS_BaseSubstitutionCode,
View Full Code Here

            ReadBase rb = new ReadBase(pos, bc.readData(),
                qc.readData());
            rf.add(rb);
            break;
          case Substitution.operator:
            Substitution sv = new Substitution();
            sv.setPosition(pos);
            byte code = bsc.readData();
            sv.setCode(code);
            // sv.setBaseChange(new BaseChange(bsc.readData()));
            rf.add(sv);
            break;
          case Insertion.operator:
            Insertion iv = new Insertion(pos, inc.readData());
View Full Code Here

          ReadBase rb = (ReadBase) f;
          bc.writeData(rb.getBase());
          qc.writeData(rb.getQualityScore());
          break;
        case Substitution.operator:
          Substitution sv = (Substitution) f;
          if (sv.getCode() < 0)
            bsc.writeData(substitutionMatrix.code(
                sv.getRefernceBase(), sv.getBase()));
          else
            bsc.writeData(sv.getCode());
          // bsc.writeData((byte) sv.getBaseChange().getChange());
          break;
        case Insertion.operator:
          Insertion iv = (Insertion) f;
          inc.writeData(iv.getSequence());
View Full Code Here

          prevPos = newPos;

          byte op = ops[random.nextInt(ops.length)];
          switch (op) {
          case Substitution.operator:
            Substitution sv = new Substitution();
            sv.setPosition(newPos);
            sv.setBaseChange(new BaseChange(random.nextInt(4)));
            record.getReadFeatures().add(sv);
            break;
          case Deletion.operator:
            Deletion dv = new Deletion();
            dv.setPosition(newPos);
View Full Code Here

TOP

Related Classes of net.sf.cram.encoding.read_features.Substitution

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.