Ejemplo n.º 1
0
  public String getNotation()
      throws NotationException, IOException, MonomerException, JDOMException {
    ComplexProtein cp = new ComplexProtein();
    cp.setSequences(getSequences());

    if (annotationTable.getCellEditor() != null) {
      annotationTable.getCellEditor().stopCellEditing();
    }
    cp.setAnnotations(annotationTableModel.getPopulatedSeqeuenceAnnotations());

    if (connectionTable.getCellEditor() != null) {
      connectionTable.getCellEditor().stopCellEditing();
    }
    cp.setConnections(connectionTableModel.getPopulatedConnections());
    return cp.getNotation();
  }
Ejemplo n.º 2
0
  public void setNotation(String notation) {
    if (null == notation || notation.length() == 0) {
      notFiringOnChange = true;
      sequenceTextArea.setText("");
      connectionTableModel.setupEmptyData(CONNECTION_TABLE_ROW_COUNT);
      annotationTableModel.setupEmptyData(ANNOTATION_TABLE_ROW_COUNT);
      notFiringOnChange = false;
      return;
    }

    notFiringOnChange = true;
    try {
      ComplexProtein cp = ComplexProtein.convert(notation);
      List<String> sequences = cp.getSequences();
      if (null != sequences && !sequences.isEmpty()) {
        StringBuilder sb = new StringBuilder();
        for (String seq : sequences) {
          if (sb.length() > 0) {
            sb.append(ComplexProtein.SEQUENCE_SEPARATOR_SYMBOL);
            sb.append("\n");
          }
          sb.append(toBlockedSequence(seq));
          sb.append("\n");
        }
        sequenceTextArea.setText(sb.toString());

        List<PeptideConnection> conList = cp.getConnections();
        if (null != conList && !conList.isEmpty()) {
          if (conList.size() >= CONNECTION_TABLE_ROW_COUNT) {
            connectionTableModel.setData(conList);
          } else {
            List<PeptideConnection> l = new ArrayList<PeptideConnection>();
            l.addAll(conList);
            for (int i = 0; i < CONNECTION_TABLE_ROW_COUNT - conList.size(); i++) {
              l.add(new PeptideConnection());
            }
            connectionTableModel.setData(l);
          }
        } else {
          connectionTableModel.setupEmptyData(CONNECTION_TABLE_ROW_COUNT);
        }

        List<SequenceAnnotation> annList = cp.getAnnotations();
        if (null != annList && !annList.isEmpty()) {
          if (annList.size() >= ANNOTATION_TABLE_ROW_COUNT) {
            annotationTableModel.setData(annList);
          } else {
            List<SequenceAnnotation> l = new ArrayList<SequenceAnnotation>();
            l.addAll(annList);
            for (int i = 0; i < ANNOTATION_TABLE_ROW_COUNT - annList.size(); i++) {
              l.add(new SequenceAnnotation());
            }
            annotationTableModel.setData(l);
          }
        } else {
          annotationTableModel.setupEmptyData(ANNOTATION_TABLE_ROW_COUNT);
        }

      } else {
        sequenceTextArea.setText("");
        connectionTableModel.setupEmptyData(CONNECTION_TABLE_ROW_COUNT);
        annotationTableModel.setupEmptyData(ANNOTATION_TABLE_ROW_COUNT);
      }
    } catch (Exception ex) {
      Logger.getLogger(ProteinEditor.class.getName()).log(Level.SEVERE, null, ex);
      ExceptionHandler.handleException(ex);
    }
    notFiringOnChange = false;
  }