예제 #1
0
 private boolean optionEditRNA() {
   if (_type.equals("editallbps")) {
     _vp.getVARNAUI().UIEditAllBasePairs();
   } else if (_type.equals("editallbases")) {
     _vp.getVARNAUI().UIEditAllBases();
   } else return false;
   return true;
 }
예제 #2
0
 private boolean optionTitle() {
   if (_type.equals("titleDisplay")) {
     _vp.getVARNAUI().UISetTitleFont();
   } else if (_type.equals("setTitle")) {
     _vp.getVARNAUI().UISetTitle();
   } else if (_type.equals("titleColor")) {
     _vp.getVARNAUI().UISetTitleColor();
   } else return false;
   return true;
 }
예제 #3
0
 private boolean optionBasePair() {
   if (_type.equals("basepair")) {
     _vp.getVARNAUI().UIEditBasePair();
     return true;
   } else if (_type.equals("bpcolor")) {
     _vp.getVARNAUI().UIColorBasePair();
     return true;
   } else if (_type.equals("thickness")) {
     _vp.getVARNAUI().UIThicknessBasePair();
     return true;
   }
   return false;
 }
예제 #4
0
 private boolean optionColorMap() {
   if (_type.equals("toggleshowcolormap")) {
     _vp.getVARNAUI().UIToggleColorMap();
   } else if (_type.equals("colormapcaption")) {
     _vp.getVARNAUI().UISetColorMapCaption();
   } else if (_type.equals("colormapstyle")) {
     _vp.getVARNAUI().UISetColorMapStyle();
   } else if (_type.equals("colormaploadvalues")) {
     _vp.getVARNAUI().UILoadColorMapValues();
   } else if (_type.equals("colormapvalues")) {
     _vp.getVARNAUI().UISetColorMapValues();
   } else return false;
   return true;
 }
예제 #5
0
 private boolean optionView() {
   if (_type.equals("background")) {
     _vp.getVARNAUI().UISetBackground();
   } else if (_type.equals("shownc")) {
     _vp.getVARNAUI().UIToggleShowNCBP();
   } else if (_type.equals("shownp")) {
     _vp.getVARNAUI().UIToggleShowNonPlanar();
   } else if (_type.equals("spaceBetweenBases")) {
     _vp.getVARNAUI().UISetSpaceBetweenBases();
   } else if (_type.equals("bpheightincrement")) {
     _vp.getVARNAUI().UISetBPHeightIncrement();
   } else if (_type.equals("borderSize")) {
     _vp.getVARNAUI().UISetBorder();
   } else if (_type.startsWith("zoom")) {
     if (_type.equals("zoom")) {
       _vp.getVARNAUI().UICustomZoom();
     } else {
       String factor = _type.substring("zoom".length());
       double pc = Integer.parseInt(factor);
       pc /= 100.0;
       _vp.setZoom(new Double(pc));
       _vp.repaint();
     }
   } else if (_type.equals("rotation")) {
     _vp.getVARNAUI().UIGlobalRotation();
   } else return false;
   return true;
 }
예제 #6
0
 private boolean optionBase() {
   if (_type.equals("baseChar")) {
     _vp.getVARNAUI().UISetBaseCharacter();
     return true;
   } else {
     return colorBases();
   }
 }
예제 #7
0
 private boolean optionImport() {
   if (_type.equals("userInput")) {
     try {
       _vp.getVARNAUI().UIManualInput();
     } catch (ParseException e1) {
       errorDialog(e1);
     } catch (ExceptionNonEqualLength e2) {
       errorDialog(e2);
     }
   } else if (_type.equals("file")) {
     try {
       _vp.getVARNAUI().UIFile();
     } catch (ExceptionNonEqualLength e1) {
       errorDialog(e1);
     }
   } else if (_type.equals("print")) {
     _vp.getVARNAUI().UIPrint();
   } else if (_type.equals("about")) {
     _vp.getVARNAUI().UIAbout();
   } else return false;
   return true;
 }
예제 #8
0
 private boolean optionRedraw() {
   if (_type.equals("reset")) {
     _vp.getVARNAUI().UIReset();
   } else if (_type.equals("circular")) {
     _vp.getVARNAUI().UICircular();
   } else if (_type.equals("radiate")) {
     _vp.getVARNAUI().UIRadiate();
   } else if (_type.equals("naview")) {
     _vp.getVARNAUI().UINAView();
   } else if (_type.equals("varnaview")) {
     _vp.getVARNAUI().UIVARNAView();
   } else if (_type.equals("motifview")) {
     _vp.getVARNAUI().UIMOTIFView();
   } else if (_type.equals("line")) {
     _vp.getVARNAUI().UILine();
   } else if (_type.equals("flat")) {
     _vp.getVARNAUI().UIToggleFlatExteriorLoop();
   } else return false;
   return true;
 }
예제 #9
0
 private boolean optionExport() {
   if (_type.equals("saveas")) {
     try {
       _vp.getVARNAUI().UISaveAs();
     } catch (ExceptionExportFailed e1) {
       errorDialog(e1);
     } catch (ExceptionPermissionDenied e1) {
       errorDialog(e1);
     }
   } else if (_type.equals("dbn")) {
     try {
       _vp.getVARNAUI().UISaveAsDBN();
     } catch (ExceptionExportFailed e) {
       errorDialog(e);
     } catch (ExceptionPermissionDenied e) {
       errorDialog(e);
     }
   } else if (_type.equals("bpseq")) {
     try {
       _vp.getVARNAUI().UISaveAsBPSEQ();
     } catch (ExceptionExportFailed e) {
       errorDialog(e);
     } catch (ExceptionPermissionDenied e) {
       errorDialog(e);
     }
   } else if (_type.equals("ct")) {
     try {
       _vp.getVARNAUI().UISaveAsCT();
     } catch (ExceptionExportFailed e) {
       errorDialog(e);
     } catch (ExceptionPermissionDenied e) {
       errorDialog(e);
     }
   } else if (_type.equals("eps")) {
     try {
       _vp.getVARNAUI().UIExportEPS();
     } catch (ExceptionWritingForbidden e1) {
       errorDialog(e1);
     } catch (ExceptionExportFailed e) {
       errorDialog(e);
     }
   } else if (_type.equals("xfig")) {
     try {
       _vp.getVARNAUI().UIExportXFIG();
     } catch (ExceptionWritingForbidden e1) {
       errorDialog(e1);
     } catch (ExceptionExportFailed e) {
       errorDialog(e);
     }
   } else if (_type.equals("svg")) {
     try {
       _vp.getVARNAUI().UIExportSVG();
     } catch (ExceptionWritingForbidden e1) {
       errorDialog(e1);
     } catch (ExceptionExportFailed e) {
       errorDialog(e);
     }
   } else if (_type.equals("jpeg")) {
     try {
       _vp.getVARNAUI().UIExportJPEG();
     } catch (ExceptionJPEGEncoding e1) {
       errorDialog(e1);
     } catch (ExceptionExportFailed e1) {
       errorDialog(e1);
     }
   } else if (_type.equals("png")) {
     try {
       _vp.getVARNAUI().UIExportPNG();
     } catch (ExceptionExportFailed e1) {
       errorDialog(e1);
     }
   } else return false;
   return true;
 }
예제 #10
0
 private boolean optionRNADisplay() {
   // les options d'affichages generales
   if (_type.equals("gaspin")) {
     _vp.getVARNAUI().UIToggleGaspinMode();
   } else if (_type.equals("backbone")) {
     _vp.getVARNAUI().UISetBackboneColor();
   } else if (_type.equals("bonds")) {
     Color c = JColorChooser.showDialog(_vp, "Choose new bonds color", _vp.getBackground());
     if (c != null) {
       _vp.setDefaultBPColor(c);
       _vp.repaint();
     }
   } else if (_type.equals("basecolorforBP")) {
     if (_source != null) {
       if (_source instanceof JCheckBoxMenuItem) {
         JCheckBoxMenuItem check = (JCheckBoxMenuItem) _source;
         _vp.setUseBaseColorsForBPs(check.getState());
         _vp.repaint();
       }
     }
   } else if (_type.equals("bpstyle")) {
     _vp.getVARNAUI().UISetBPStyle();
   } else if (_type.equals("specialbasecolored")) {
     _vp.getVARNAUI().UIToggleColorSpecialBases();
   } else if (_type.equals("showwarnings")) {
     _vp.getVARNAUI().UIToggleShowWarnings();
   } else if (_type.equals("dashbasecolored")) {
     _vp.getVARNAUI().UIToggleColorGapsBases();
   } else if (_type.equals("numPeriod")) {
     _vp.getVARNAUI().UISetNumPeriod();
   } else if (_type.equals("eachKind")) {
     if (_vp.getRNA().get_listeBases() != null) {
       _vp.getVARNAUI().UIBaseTypeColor();
     } else {
       _vp.emitWarning("No base");
     }
   } else if (_type.equals("eachCouple")) {
     if (_vp.getRNA().get_listeBases() != null && _vp.getRNA().get_listeBases().size() != 0) {
       _vp.getVARNAUI().UIBasePairTypeColor();
     } else {
       _vp.emitWarning("No base");
     }
   } else if (_type.equals("eachBase")) {
     if (_vp.getRNA().get_listeBases() != null && _vp.getRNA().get_listeBases().size() != 0) {
       _vp.getVARNAUI().UIBaseAllColor();
     } else {
       _vp.emitWarning("No base");
     }
   } else if (_type.equals("specialBasesColor")) {
     _vp.getVARNAUI().UIPickSpecialBasesColor();
   } else if (_type.equals("dashBasesColor")) {
     _vp.getVARNAUI().UIPickGapsBasesColor();
   } else return colorBases();
   return true;
 }
예제 #11
0
  private boolean optionAnnotation() {
    if (!_type.contains("annotation")) return false;
    // a partir du menu principale (gestion des annotations)
    if (_type.equals("annotationsaddPosition")) {
      _vp.getVARNAUI()
          .UIAnnotationsAddPosition(
              _vp.getPopup().getSpawnPoint().x, _vp.getPopup().getSpawnPoint().y);
    } else if (_type.equals("annotationsaddBase")) {
      _vp.getVARNAUI()
          .UIAnnotationsAddBase(_vp.getPopup().getSpawnPoint().x, _vp.getPopup().getSpawnPoint().y);
    } else if (_type.equals("annotationsaddLoop")) {
      _vp.getVARNAUI()
          .UIAnnotationsAddLoop(_vp.getPopup().getSpawnPoint().x, _vp.getPopup().getSpawnPoint().y);
    } else if (_type.equals("annotationsaddChemProb")) {
      _vp.getVARNAUI()
          .UIAnnotationsAddChemProb(
              _vp.getPopup().getSpawnPoint().x, _vp.getPopup().getSpawnPoint().y);
    } else if (_type.equals("annotationsaddRegion")) {
      _vp.getVARNAUI()
          .UIAnnotationsAddRegion(
              _vp.getPopup().getSpawnPoint().x, _vp.getPopup().getSpawnPoint().y);
    } else if (_type.equals("annotationsaddHelix")) {
      _vp.getVARNAUI()
          .UIAnnotationsAddHelix(
              _vp.getPopup().getSpawnPoint().x, _vp.getPopup().getSpawnPoint().y);
    } else if (_type.equals("annotationsautohelices")) {
      _vp.getVARNAUI().UIAutoAnnotateHelices();
    } else if (_type.equals("annotationsautointerior")) {
      _vp.getVARNAUI().UIAutoAnnotateInteriorLoops();
    } else if (_type.equals("annotationsautoterminal")) {
      _vp.getVARNAUI().UIAutoAnnotateTerminalLoops();
    } else if (_type.equals("annotationsautohelices")) {
      _vp.getVARNAUI().UIAutoAnnotateHelices();
    } else if (_type.equals("annotationsremove")) {
      _vp.getVARNAUI().UIAnnotationsRemove();
    } else if (_type.equals("annotationsautoextremites")) {
      _vp.getVARNAUI().UIAutoAnnotateStrandEnds();
    } else if (_type.equals("annotationsedit")) {
      _vp.getVARNAUI().UIAnnotationsEdit();
      // a partir du menu selection (annotation la plus proche)
    } else if (_type.equals("Selectionannotationremove")) {
      _vp.getVARNAUI().UIAnnotationRemoveFromAnnotation(_vp.get_selectedAnnotation());
    } else if (_type.equals("Selectionannotationedit")) {
      _vp.getVARNAUI().UIAnnotationEditFromAnnotation(_vp.get_selectedAnnotation());

      // a partir d'une structure(base, loop, helix) dans l'arn
      // (annotation li� a la structure)
    } else if (_type.endsWith("annotationadd")
        || _type.contains("annotationremove")
        || _type.contains("annotationedit")) {
      try {
        TextAnnotation.AnchorType type = trouverAncrage();
        ArrayList<Integer> listeIndex = new ArrayList<Integer>();
        switch (type) {
          case BASE:
            listeIndex.add(_vp.getNearestBase());
          case LOOP:
            if (_type.startsWith("loop1"))
              listeIndex = _vp.getRNA().findLoopForward(_vp.getNearestBase());
            else if (_type.startsWith("loop2"))
              listeIndex = _vp.getRNA().findLoopBackward(_vp.getNearestBase());
            else listeIndex = _vp.getRNA().findLoop(_vp.getNearestBase());
            break;
          case HELIX:
            listeIndex = _vp.getRNA().findHelix(_vp.getNearestBase());
            break;
        }
        if (_type.endsWith("annotationadd")) {
          _vp.getVARNAUI().UIAnnotationAddFromStructure(type, listeIndex);
        } else if (_type.contains("annotationremove")) {
          _vp.getVARNAUI().UIAnnotationRemoveFromStructure(trouverAncrage(), listeIndex);
        } else if (_type.contains("annotationedit")) {
          _vp.getVARNAUI().UIAnnotationEditFromStructure(trouverAncrage(), listeIndex);
        }

      } catch (Exception e2) {
        e2.printStackTrace();
      }
    } else return false;
    return true;
  }