Examples of TCharArrayList


Examples of gnu.trove.list.array.TCharArrayList

    TIntArrayList stack = new TIntArrayList();
    ArrayList<TIntArrayList> nodes = new ArrayList<TIntArrayList>();
    ArrayList<RNANodeLabel> tmpLabelsList = new ArrayList<RNANodeLabel>();
    nodes.add(new TIntArrayList());
    tmpLabelsList.add(new RNANodeLabel(RNANodeLabel.ROOT,
        new TCharArrayList("ROOT".toCharArray()), -1, -1, -1));

    nodes.add(new TIntArrayList());
    stack.add(1);
    tmpLabelsList.add(new RNANodeLabel(RNANodeLabel.EXTERNAL,
        new TCharArrayList("EXT".toCharArray()), -1, -1, -1));
    // connect root to external
    connectNodes(nodes, 0, 1);
    TIntArrayList tmpStemSizes = new TIntArrayList();
    TIntArrayList tmpIntervalSizes = new TIntArrayList();
    tmpStemSizes.add(0);

    int group = 0;
    while (seqIx < seqEnd) {
      if (structure[seqIx] == CLOSE_BRACKET) {
        while (tmpLabelsList.get(peek(stack)).getType() != RNANodeLabel.BASE_PAIR) {
          remove(stack);
        }
        remove(stack);
        seqIx++;
      } else if (structure[seqIx] == OPEN_BRACKET) {
        nodes.add(new TIntArrayList());
        // check if parent is ML or EXT then change the group id
        if (tmpLabelsList.get(peek(stack)).getType() != RNANodeLabel.BASE_PAIR
            && tmpLabelsList.get(peek(stack)).getType() != RNANodeLabel.IL_LOOP) {
          group++;
        }
        tmpLabelsList.add(new RNANodeLabel(RNANodeLabel.BASE_PAIR,
            new TCharArrayList(new char[] { sequence[seqIx],
                sequence[pairs[seqIx]] }), seqIx + 1,
            pairs[seqIx] + 1, group));
        tmpStemSizes.set(tmpStemSizes.size() - 1,
            tmpStemSizes.get(tmpStemSizes.size() - 1) + 1);
        // connect to head
        connectNodes(nodes, nodeIx, peek(stack));
        stack.add(nodeIx);
        nodeIx++;

        if (pairs[seqIx + 1] != pairs[seqIx] - 1) {
          // not part of stack
          nodes.add(new TIntArrayList());
          int type = RNANodeLabel.HP_LOOP;
          String typeName = "HP";
          if (branches[seqIx] == 1) {
            type = RNANodeLabel.IL_LOOP;
            typeName = "IL";
          } else if (branches[seqIx] > 1) {
            type = RNANodeLabel.ML_LOOP;
            typeName = "ML";
            group++;
          }
          tmpStemSizes.add(0);
          numOfStems++;

          tmpLabelsList.add(new RNANodeLabel(type,
              new TCharArrayList(typeName.toCharArray()), -1, -1,
              group));
          // connect to head
          connectNodes(nodes, nodeIx, peek(stack));
          stack.add(nodeIx);
          nodeIx++;
        }
        seqIx++;
      } else {
        // base interval
        int start = seqIx;
        while (seqIx < sequence.length
            && (structure[seqIx] != OPEN_BRACKET && structure[seqIx] != CLOSE_BRACKET)) {
          seqIx++;
        }

        // create an interval node
        nodes.add(new TIntArrayList());
        char[] label = new char[seqIx - start];
        System.arraycopy(sequence, start, label, 0, label.length);
        tmpLabelsList.add(new RNANodeLabel(RNANodeLabel.BASE_INTERVAL,
            new TCharArrayList(label), start + 1, seqIx, group));
        tmpIntervalSizes.add(label.length);
        // connect to head
        connectNodes(nodes, nodeIx, peek(stack));
        nodeIx++;
      }
View Full Code Here

Examples of gnu.trove.list.array.TCharArrayList

      if (labels[i].getType() == RNANodeLabel.BASE_PAIR) {
        bpNodes.add(i);
      } else if (labels[i].getType() == RNANodeLabel.BASE_INTERVAL) {
        inNodes.add(i);
        // copy all the chars to the pool of chars
        TCharArrayList list = labels[i].getLabelValue();
        for (int c = 0; c < list.size(); c++) {
          intervalChars.add(list.get(c));
        }
      } else if (labels[i].getType() == RNANodeLabel.EXTERNAL) {
        externalId = i;
      } else if (labels[i].getType() == RNANodeLabel.ROOT) {
        rootId = i;
      } else if (labels[i].getType() == RNANodeLabel.ML_LOOP) {
        mlNodes.add(i);
      } else {
        openNodes.add(i);
      }
    }

    intervalChars.shuffle(rand);
    shuffleList(inNodes, rand);
    shuffleList(bpNodes, rand);
    shuffleList(openNodes, rand);
    shuffleList(mlNodes, rand);

    // shuffle the EXT node
    if (mlNodes.size() != 0) {
      // if we have a node to replace the EXT with add the EXT to the list
      // and shuffle it again
      final int index = rand.nextInt(mlNodes.size() + 1);
      if (index != mlNodes.size()) {
        // if the selected node is different then the old one, replace
        // their data and save the new one as the EXT
        final int selected = mlNodes.removeAt(index);
        // find location
        int bpLocation = -1;
        for (int i = 0; i < outDeg(selected) && bpLocation == -1; i++) {
          if (labels[outAdjLists[selected][i]].getType() == RNANodeLabel.BASE_PAIR) {
            bpLocation = i;
          }
        }
        // switch the neighbors information
        int tmp = outAdjLists[selected][bpLocation];
        outAdjLists[selected][bpLocation] = rootId;
        outAdjLists[externalId][getNeighborIx(externalId, rootId)] = tmp;
        // switch type
        labels[selected].setType(RNANodeLabel.EXTERNAL);
        labels[externalId].setType(RNANodeLabel.ML_LOOP);
        // switch type data
        TCharArrayList tmpList = labels[externalId].getLabelValue();
        labels[externalId].setLabelValue(labels[selected]
            .getLabelValue());
        labels[selected].setLabelValue(tmpList);
        // add the old one back to the list and mark the selected as the
        // new EXT node
        mlNodes.add(externalId);
        externalId = selected;
      }
    }

    // move the rest mlNodes to the openNodes
    while (mlNodes.size() != 0) {
      openNodes.add(mlNodes.removeAt(mlNodes.size() - 1));
    }

    int intervalSum = 0;
    // divide the interval data
    for (int i = 0; i < inNodes.size(); i++) {
      TCharArrayList list = labels[inNodes.get(i)].getLabelValue();
      intervalSum += list.size();
      list.resetQuick();
      // add at least one char for each interval
      list.add(intervalChars.removeAt(intervalChars.size() - 1));
    }

    // divide the rest of the data
    while (intervalChars.size() > 0) {
      final int val = rand.nextInt(intervalSum) + 1;
View Full Code Here

Examples of gnu.trove.list.array.TCharArrayList

      oneEndElements = new TIntArrayList();
    } else {
      oneEndElements.resetQuick();
    }
    if (intervalChars == null) {
      intervalChars = new TCharArrayList();
    } else {
      intervalChars.resetQuick();
    }
  }
View Full Code Here

Examples of gnu.trove.list.array.TCharArrayList

  public AbsSequenceAlignmentNoMatrix(char[] str1, char[] str2,
      AlphabetUtils alphabet, ScoringMatrix matrix) {
    this.scoringMatrix = matrix;
    this.alphabet = alphabet;
    this.str1 = new TCharArrayList();
    this.str2 = new TCharArrayList();
    this.setSequences(str1, str2);

  }
View Full Code Here

Examples of gnu.trove.list.array.TCharArrayList

    length1 = size1;
    length2 = size2;

    dpRow1 = new double[length2 + 1];
    dpRow2 = new double[length2 + 1];
    this.str1 = new TCharArrayList();
    this.str2 = new TCharArrayList();
  }
View Full Code Here

Examples of gnu.trove.list.array.TCharArrayList

  private TCharArrayList sequenceLeft;
  private TCharArrayList sequenceRight;

  public InnerStructure() {
    // create the lists
    this.sequenceLeft = new TCharArrayList();
    this.sequenceRight = new TCharArrayList();
  }
View Full Code Here

Examples of gnu.trove.list.array.TCharArrayList

  }

  @Override
  public void setSequences(TCharArrayList str1, TCharArrayList str2) {
    if (str2.size() < str1.size()) {
      TCharArrayList temp = str2;
      str2 = str1;
      str1 = temp;
    }

    aligner.setSequences(str1, str2);
View Full Code Here

Examples of gnu.trove.list.array.TCharArrayList

  }
 
  public NodeLabel(String str) {
    super();
    type = 0;
    labelValue = new TCharArrayList();
    for (int i=0;i<str.length();i++){
      labelValue.add(str.charAt(i));
    }
  }
View Full Code Here

Examples of gnu.trove.list.array.TCharArrayList

  public AbsSequenceAlignment(int size1, int size2, AlphabetUtils alphabet,
      ScoringMatrix matrix) {
    this.scoringMatrix = matrix;
    this.alphabet = alphabet;
    this.str1 = new TCharArrayList();
    this.str2 = new TCharArrayList();
    length1 = size1;
    length2 = size2;

    dpTable = new double[length1 + 1][length2 + 1];
View Full Code Here

Examples of gnu.trove.list.array.TCharArrayList

    if (danglingAligner != null) {
      this.danglingAligner = danglingAligner;
    } else {
      this.danglingAligner = sequenceAligner;
    }
    emptyListHelper = new TCharArrayList();
    shouldCountDangling = false;
  }
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.