protected void setGapSequence(String newGapSequence, int whichGapSequence) {

      int sLen = 0;

      switch (whichGapSequence) {
         case GAP_ONE:
            sLen = m_s1_size;
            break;
         case GAP_TWO:
            sLen = m_s2_size;
            break;
         default:
            System.err.println("Not a valid gap sequence ID!");
            return;
      }

      int tmpGapPenality[] = new int[sLen];
      String filledGapSequence = "{";

      StringTokenizer sTok = new StringTokenizer(newGapSequence, "{}, ");

      int val = 0;
      int prevVal = 0;

//      filledGapSequence += prevVal + ", ";
//      tmpGapPenality[0] = prevVal;

      for (int i = 0; i < sLen; ++i) {

         if (sTok.hasMoreTokens()) {
            try {
               val = Integer.parseInt(sTok.nextToken());
            }
            catch (NumberFormatException ex) {
               val = 0;
            }
         }
         else {
            val = 0;
         }

         if (Math.abs(val-prevVal) > 1) {
            // Error
            JOptionPane.showMessageDialog(null,
                                          "Invalid gap values!\nThey must have " +
                                          "an offset of {-1, 0, +1}!",
                                          "Invalid gaps",
                                          JOptionPane.ERROR_MESSAGE);
            return;
         }

         tmpGapPenality[i] = val;
         prevVal = val;
         filledGapSequence += val + ", ";
      }

      filledGapSequence = filledGapSequence.substring(0,
          filledGapSequence.length() - 2) + "}";

      switch (whichGapSequence) {
         case GAP_ONE:
            m_gapPenaltyOne = tmpGapPenality;
            m_gapOne.setText(filledGapSequence);
            break;
         case GAP_TWO:
            m_gapPenaltyTwo = tmpGapPenality;
            m_gapTwo.setText(filledGapSequence);
            break;
      }

      if (m_tableReady) {
         updateGapCells();
         //m_dpTable.repaint();
         m_dpTable.paint(m_dpTable.getGraphics());
      }

   }