Exemplo n.º 1
0
 private ArrayList<Integer> listSwitchType(String _type) {
   if (_type.equals("helix")) return _vp.getRNA().findHelix(_vp.getNearestBase());
   if (_type.equals("current")) {
     return _vp.getSelectionIndices();
   }
   if (_type.equals("allBases")) {
     return _vp.getRNA().findAll();
   }
   if (_type.equals("loop1")) {
     return _vp.getRNA().findLoopForward(_vp.getNearestBase());
   }
   if (_type.equals("loop2")) {
     return _vp.getRNA().findLoopBackward(_vp.getNearestBase());
   }
   if (_type.equals("stem")) return _vp.getRNA().findStem(_vp.getNearestBase());
   if (_type.equals("base")) {
     ArrayList<Integer> list = new ArrayList<Integer>();
     list.add(_vp.getNearestBase());
     return list;
   }
   if (_type.equals("basepair") || _type.equals("bpcolor") || _type.equals("bp")) {
     ArrayList<Integer> list = new ArrayList<Integer>();
     int i = _vp.getNearestBase();
     list.add(i);
     ModeleBase mb = _vp.getRNA().get_listeBases().get(i);
     int j = mb.getElementStructure();
     if (mb.getElementStructure() != -1) {
       list.add(i);
       list.add(j);
     }
     return list;
   }
   if (_type.equals("5'")) return _vp.getRNA().findNonPairedBaseGroup(_vp.getNearestBase());
   if (_type.equals("3'")) return _vp.getRNA().findNonPairedBaseGroup(_vp.getNearestBase());
   if (_type.equals("bulge")) return _vp.getRNA().findNonPairedBaseGroup(_vp.getNearestBase());
   if (_type.equals("all")) return _vp.getRNA().findAll();
   return new ArrayList<Integer>();
 }
Exemplo n.º 2
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;
  }