Examples of IRGroupQuery


Examples of org.openscience.cdk.isomorphism.matchers.IRGroupQuery

  }

  public void setChemObject(IChemObject object) {
    if (object instanceof IRGroupQuery) {
      source = object;
      IRGroupQuery rgroupQuery = (IRGroupQuery)source;
      for (int i=0; i< rNumbers.size(); i++) {
        int r = rNumbers.get(i);
        JPanel rgrpPanel = panels.get(i);

        RGroupList rgrpList = rgroupQuery.getRGroupDefinitions().get(r);

        JTextField occurrenceField = (JTextField) (rgrpPanel.getComponent(1));
        String occ=rgrpList.getOccurrence();
        occurrenceField.setText(occ);
View Full Code Here

Examples of org.openscience.cdk.isomorphism.matchers.IRGroupQuery

      throw new IllegalArgumentException("Argument must be a IRGroupQuery");
    }
  }

  public void applyChanges() {
    IRGroupQuery rgroupQuery = (IRGroupQuery)source;

    //Validate the "occurence" input
    for (int i=0; i< rNumbers.size(); i++) {
      int r = rNumbers.get(i);
      JPanel rgrpPanel = panels.get(i);
      RGroupList rgrpList = rgroupQuery.getRGroupDefinitions().get(r);

      JTextField occurrenceField = (JTextField) (rgrpPanel.getComponent(1));
      String userOccurrenceText=occurrenceField.getText();
      if (userOccurrenceText.trim().equals("") || !RGroupList.isValidOccurrenceSyntax(userOccurrenceText)) {
        throw new RuntimeException (GT.get("Invalid occurrence specified for {0}", "R" + r));
      }
    }

    //Aply input to model
    for (int i=0; i< rNumbers.size(); i++) {
      int r = rNumbers.get(i);
      JPanel rgrpPanel = panels.get(i);
      RGroupList rgrpList = rgroupQuery.getRGroupDefinitions().get(r);

      JTextField occurrenceField = (JTextField) (rgrpPanel.getComponent(1));
      String userOccurrenceText=occurrenceField.getText();
      try {
        rgrpList.setOccurrence(userOccurrenceText);
View Full Code Here

Examples of org.openscience.cdk.isomorphism.matchers.IRGroupQuery

                    }
        }

        // RGroupQuery reading
        if (cor.accepts(RGroupQuery.class) && chemModel==null) {
          IRGroupQuery rgroupQuery = (RGroupQuery) cor.read(new RGroupQuery(DefaultChemObjectBuilder.getInstance()));
          if(rgroupQuery!=null )
            try{
              chemModel = new ChemModel();
              RGroupHandler rgHandler =  new RGroupHandler(rgroupQuery, panel);
              panel.get2DHub().setRGroupHandler(rgHandler);
View Full Code Here

Examples of org.openscience.cdk.isomorphism.matchers.IRGroupQuery

                            toPaste.add(ac);

                        }
                  } else if (reader.accepts(RGroupQuery.class)) {
                rgrpQuery=true;
                    IRGroupQuery rgroupQuery = (RGroupQuery) reader.read(new RGroupQuery(DefaultChemObjectBuilder.getInstance()));
                chemModel = new ChemModel();
                RGroupHandler rgHandler =  new RGroupHandler(rgroupQuery, this.jcpPanel);
                this.jcpPanel.get2DHub().setRGroupHandler(rgHandler);
                chemModel.setMoleculeSet(rgHandler.getMoleculeSet(chemModel));
                rgHandler.layoutRgroup();
View Full Code Here

Examples of org.openscience.cdk.isomorphism.matchers.IRGroupQuery

    IAtomContainer existingRoot=null;
    Map<IAtom, Map<Integer, IBond>> existingRootAttachmentPoints = null;
    Map<RGroup, Map<Integer,IAtom>> existingRGroupApo=null;
    Map<Integer,RGroupList> existingRgroupLists =null;

    IRGroupQuery rgrpQuery=null;
    IAtomContainer molecule=null;

    /* User action: generate possible configurations for the R-group */
    if(type.equals("rgpGenerate")) {
      if((jcpPanel.get2DHub().getRGroupHandler()==null)) {
        JOptionPane.showMessageDialog(jcpPanel, GT.get("Please define an R-group (root and substituents) first."));
        return;
      }
            try {
        JFileChooser chooser = new JFileChooser();
        chooser.setCurrentDirectory(jcpPanel.getCurrentWorkDirectory());
        chooser.setFileView(new JCPFileView());
        chooser.showSaveDialog(jcpPanel);
        File outFile = chooser.getSelectedFile();
        System.out.println(outFile);
        List<IAtomContainer> molecules= jcpPanel.get2DHub().getRGroupHandler().getrGroupQuery().getAllConfigurations();
        if (molecules.size() > 0) {
          IAtomContainerSet molSet = molecules.get(0).getBuilder().newInstance(IAtomContainerSet.class);
          for (IAtomContainer mol : molecules) {
            molSet.addAtomContainer(mol);
          }
          SDFWriter sdfWriter = new SDFWriter(new FileWriter(outFile));
          sdfWriter.write(molSet);
          sdfWriter.close();
        }
      } catch (Exception e) {
        e.printStackTrace();
        JOptionPane.showMessageDialog(jcpPanel, GT.get("There was an error generating the configurations {0}", e.getMessage()));
        return;
      }
   
    }
    /* User action: advanced R-group logic */
    else if(type.equals("rgpAdvanced")) {

      if((jcpPanel.get2DHub().getRGroupHandler()==null)) {
        JOptionPane.showMessageDialog(jcpPanel, GT.get("Please define an R-group (root and substituent) first."));
        return;
      }
      jcpPanel.get2DHub().getRGroupHandler().cleanUpRGroup(jcpPanel.get2DHub().getChemModel().getMoleculeSet());
      ChemObjectEditor editor = new RGroupEditor(hub);
      editor.setChemObject((org.openscience.cdk.ChemObject)hub.getRGroupHandler().getrGroupQuery());
      ChemObjectPropertyDialog frame = new ChemObjectPropertyDialog(JOptionPane.getFrameForComponent(editor), jcpPanel.get2DHub(),editor);
      frame.pack();
      frame.setVisible(true);
      jcpPanel.get2DHub().updateView();
    }


    //FOLLOWING actions involve undo/redo

    else
    {

      /* User action: generate possible configurations for the R-group */
      if(type.equals("clearRgroup")) {
        if((jcpPanel.get2DHub().getRGroupHandler()==null)) {
          JOptionPane.showMessageDialog(jcpPanel, GT.get("There is no R-group defined"));
          return;
        }
        rGroupHandler=hub.getRGroupHandler();
        hub.unsetRGroupHandler();
        jcpPanel.get2DHub().updateView();

      }

      /* User has indicated that a certain atom in a substituent needs to become attachment point 1 or 2 */
      else if (type.startsWith("setAtomApoAction")) {
        rGroupHandler=hub.getRGroupHandler();
        IAtom apoAtom = (IAtom) eventSource;
        apoLoop:
          for (Iterator<Integer> rnumItr=rGroupHandler.getrGroupQuery().getRGroupDefinitions().keySet().iterator(); rnumItr.hasNext();) {
            for (RGroup rgrp: rGroupHandler.getrGroupQuery().getRGroupDefinitions().get(rnumItr.next()).getRGroups()) {
              if(rgrp.getGroup().contains(apoAtom)) {
                existingRGroupApo= new HashMap <RGroup,Map<Integer,IAtom>>();
                HashMap<Integer,IAtom> map = new HashMap<Integer,IAtom>();
                map.put(1, rgrp.getFirstAttachmentPoint());
                map.put(2, rgrp.getSecondAttachmentPoint());
                existingRGroupApo.put(rgrp,map);

                boolean firstApo = type.endsWith("1");
                if (firstApo) {
                  rgrp.setFirstAttachmentPoint(apoAtom);
                }
                else {
                  rgrp.setSecondAttachmentPoint(apoAtom);
                }
                break apoLoop;
              }
            }
          }
      }

      /* User action : certain bond in the root needs to become attachment bond 1 or 2 */
      else if (type.startsWith("setBondApoAction")) {
        rGroupHandler=hub.getRGroupHandler();
        IBond apoBond = (IBond) eventSource;
        Map<Integer, IBond> apoBonds=null;

        //Undo/redo business______
        IAtom pseudo=null;
        if (apoBond.getAtom(0) instanceof IPseudoAtom)
          pseudo=apoBond.getAtom(0);
        else
          pseudo=apoBond.getAtom(1);
        Map<Integer, IBond> keepApoBonds = new HashMap<Integer, IBond>();
        if (rGroupHandler.getrGroupQuery().getRootAttachmentPoints()!=null &&
            rGroupHandler.getrGroupQuery().getRootAttachmentPoints().get(pseudo)!=null) {
          apoBonds= rGroupHandler.getrGroupQuery().getRootAttachmentPoints().get(pseudo);
          for (Iterator<Integer> apoItr =apoBonds.keySet().iterator(); apoItr.hasNext();) {
            int apoNum=apoItr.next();
            keepApoBonds.put(apoNum,apoBonds.get(apoNum));
          }
        }
        existingRootAttachmentPoints = new HashMap<IAtom, Map<Integer, IBond>>();
        existingRootAttachmentPoints.put(pseudo, keepApoBonds);
        //________________________


        //Set the new Root APO
        if (rGroupHandler.getrGroupQuery().getRootAttachmentPoints()==null) {
          rGroupHandler.getrGroupQuery().setRootAttachmentPoints(new HashMap<IAtom, Map<Integer, IBond>>());
        }
        Map<IAtom, Map<Integer, IBond>> rootApo=rGroupHandler.getrGroupQuery().getRootAttachmentPoints();
        if (rootApo.get(pseudo)==null) {
          apoBonds=new HashMap<Integer,IBond>();
          rootApo.put(pseudo, apoBonds);
        }
        else
          apoBonds=rGroupHandler.getrGroupQuery().getRootAttachmentPoints().get(pseudo);

        if (type.endsWith("1")) {
          apoBonds.put(1, apoBond);
          if (apoBonds.get(2)!=null && apoBonds.get(2).equals(apoBond))
            apoBonds.remove(2);
        }
        if (type.endsWith("2")) {
          apoBonds.put(2, apoBond);
          if (apoBonds.get(1)!=null && apoBonds.get(1).equals(apoBond))
            apoBonds.remove(1);
        }

      }


      /* User action: certain atom+bond selection is to be the root structure. */
      else if (type.equals("setRoot")) {

        IAtomContainer atc =selection.getConnectedAtomContainer();
        if (!isProperSelection(atc)) {
          JOptionPane.showMessageDialog(jcpPanel, GT.get("Please do not make a fragmented selection."));
          return;
        }

        molecule = createMolecule (atc,existingAtomDistr,existingBondDistr);
        hub.getChemModel().getMoleculeSet().addAtomContainer(molecule);

        if (hub.getRGroupHandler() == null) {
          isNewRgroup=true;
          rgrpQuery = newRGroupQuery(molecule.getBuilder());
          rGroupHandler = new RGroupHandler(rgrpQuery, this.jcpPanel);
          hub.setRGroupHandler(rGroupHandler);
        }
        else {
          rGroupHandler=hub.getRGroupHandler();
          rgrpQuery = hub.getRGroupHandler().getrGroupQuery();
          if(rgrpQuery.getRootStructure()!=null) {
            existingRoot=rgrpQuery.getRootStructure();
            rgrpQuery.getRootStructure().removeProperty(CDKConstants.TITLE);
          }
        }
        molecule.setProperty(CDKConstants.TITLE,RGroup.ROOT_LABEL);
        rgrpQuery.setRootStructure(molecule);

        //Remove old root apo's
        existingRootAttachmentPoints = rgrpQuery.getRootAttachmentPoints();
        rgrpQuery.setRootAttachmentPoints(null);

        //Define new root apo's
        Map<IAtom, Map<Integer, IBond>> apoBonds= new HashMap<IAtom, Map<Integer, IBond>>();
        for (IAtom atom : molecule.atoms()) {
          if (atom instanceof IPseudoAtom) {
            IPseudoAtom pseudo = (IPseudoAtom)atom;
            if (pseudo.getLabel()!=null && RGroupQuery.isValidRgroupQueryLabel(pseudo.getLabel())) {
              chooseRootAttachmentBonds(pseudo,molecule,apoBonds);
            }
          }
        }
        rgrpQuery.setRootAttachmentPoints(apoBonds);

      }

      /* User action: certain atom+bond selection is to be a substituent. */
      else if (type.equals("setSubstitute")) {

        if (hub.getRGroupHandler() == null || hub.getRGroupHandler().getrGroupQuery()==null ||
            hub.getRGroupHandler().getrGroupQuery().getRootStructure()==null) {
          JOptionPane.showMessageDialog(jcpPanel, GT.get("Please define a root structure first."));
          return;
        }

        IAtomContainer atc =selection.getConnectedAtomContainer();
        if (!isProperSelection(atc)) {
          JOptionPane.showMessageDialog(jcpPanel, GT.get("Please do not make a fragmented selection."));
          return;
        }

        // Check - are there any R-groups -> collect them so that user input can be validated
        Map<Integer,Integer> validRnumChoices=new HashMap<Integer,Integer>();
        for (IAtom atom : hub.getRGroupHandler().getrGroupQuery().getRootStructure().atoms()) {
          if (atom instanceof IPseudoAtom) {
            IPseudoAtom pseudo = (IPseudoAtom)atom;
            if (pseudo.getLabel()!=null && RGroupQuery.isValidRgroupQueryLabel(pseudo.getLabel())) {
              int bondCnt=0;
              int rNum=new Integer(pseudo.getLabel().substring(1));
              for (IBond b : hub.getRGroupHandler().getrGroupQuery().getRootStructure().bonds())
                if (b.contains(atom))
                  bondCnt++;

              if ((!validRnumChoices.containsKey(rNum))||
                  validRnumChoices.containsKey(rNum)&& validRnumChoices.get(rNum)<bondCnt)
                validRnumChoices.put(rNum,bondCnt);
            }
          }
        }
        // Here we test: the user wants to define a substitute, but are there any R1..R32 groups to begin with?
        if (validRnumChoices.size()==0) {
          JOptionPane.showMessageDialog(jcpPanel, GT.get("There are no numbered R-atoms in the root structure to refer to."));
          return;
        }

        //Now get user input to determine which R# atom to hook up with the substituent
        boolean inputOkay=false;
        String userInput=null;
        Integer rNum=0;
        do {
          userInput = JOptionPane.showInputDialog(GT.get("Enter an R-group number "),validRnumChoices.get(0));
          if (userInput == null)
            return;
          try {
            rNum = new Integer(userInput);
            if(!validRnumChoices.containsKey(rNum))
              JOptionPane.showMessageDialog(null, GT.get("The number you entered has no corresponding R-group in the root."));
            else
              inputOkay=true;
          } catch (NumberFormatException e) {
            JOptionPane.showMessageDialog(null, GT.get("This is not a valid R-group label.\nPlease label in range R1 .. R32"));
          }
        }
        while (!inputOkay);
        rGroupHandler=hub.getRGroupHandler();

        rgrpQuery = hub.getRGroupHandler().getrGroupQuery();
        if (rgrpQuery.getRGroupDefinitions()==null) {
          rgrpQuery.setRGroupDefinitions(new HashMap<Integer, RGroupList>());
        }

        if (rgrpQuery.getRGroupDefinitions().get(rNum)==null) {
          RGroupList rList = new RGroupList(rNum);
          rList.setRGroups(new ArrayList<RGroup>());
          rgrpQuery.getRGroupDefinitions().put(rNum, rList);
        }

        molecule = createMolecule (atc,existingAtomDistr,existingBondDistr);
        existingRgroupLists = new HashMap<Integer,RGroupList>();

        // Now see if the user's choice for a substituent has overlaps with already defined existing
        // substitutes. If so, these existing ones get thrown out (we can't have multiple substituents
        // defined for the same atoms.
        for(Iterator<Integer> itr=rgrpQuery.getRGroupDefinitions().keySet().iterator();itr.hasNext();) {
          int rgrpNum=itr.next();
          RGroupList rgrpList = rgrpQuery.getRGroupDefinitions().get(rgrpNum);
          if(rgrpList!=null) {
            existingRgroupLists.put(rgrpNum,  makeClone(rgrpList));
            List<RGroup> cleanList = new ArrayList<RGroup>();
            for (int j=0; j<rgrpList.getRGroups().size(); j++){
              RGroup subst= rgrpList.getRGroups().get(j);
              boolean remove=false;
              removeCheck:
                for(IAtom atom : molecule.atoms()) {
                  if (subst.getGroup().contains(atom)) {
                    remove=true;
                    break removeCheck;
                  }
                }
              if (!remove) {
                cleanList.add(subst);
              }
            }
            rgrpList.setRGroups(cleanList);
          }
        }

        hub.getChemModel().getMoleculeSet().addAtomContainer(molecule);
        molecule.setProperty(CDKConstants.TITLE,RGroup.makeLabel(rNum));

        RGroup rgrp = new RGroup();
        rgrp.setGroup(molecule);
        rgrpQuery.getRGroupDefinitions().get(rNum).getRGroups().add(rgrp);

        //Set default APO atoms (randomly picked) for the new substitute
        int apoCount=validRnumChoices.get(rNum);
        int apoSet=0;
        apoBreak:
View Full Code Here

Examples of org.openscience.cdk.isomorphism.matchers.IRGroupQuery

   * Initializes an empty RGroupQuery.
   *
   * @return a new empty RGroupQuery
   */
  private IRGroupQuery newRGroupQuery(IChemObjectBuilder builder) {
    IRGroupQuery rgrpQuery = new RGroupQuery(DefaultChemObjectBuilder.getInstance());
    rgrpQuery.setRootStructure(builder.newInstance(IAtomContainer.class));
    rgrpQuery
        .setRootAttachmentPoints(new HashMap<IAtom, Map<Integer, IBond>>());
    rgrpQuery.setRGroupDefinitions(new HashMap<Integer, RGroupList>());
    return rgrpQuery;
  }
View Full Code Here

Examples of org.openscience.cdk.isomorphism.matchers.IRGroupQuery

            int answer = JOptionPane.showConfirmDialog(jcpPanel, message, error, JOptionPane.YES_NO_OPTION);
            if(answer == JOptionPane.NO_OPTION)
                return null;
        }
        boolean saveAsRgrpQuery=false;
         IRGroupQuery rGroupQuery = null;
      if(jcpPanel.get2DHub().getRGroupHandler()!=null)
        rGroupQuery= jcpPanel.get2DHub().getRGroupHandler().getrGroupQuery();

        if(rGroupQuery!=null){
            String error = GT.get("Please choose a file type!");
            String message = GT.get("Would you like to save the drawing as an R-group Query File? (RGFile = extended MOLfile)");
            int answer = JOptionPane.showConfirmDialog(jcpPanel, message, error, JOptionPane.YES_NO_OPTION);
            if(answer == JOptionPane.YES_OPTION)
              saveAsRgrpQuery=true;
        }
       
        String fileName = outFile.toString();
        if (!fileName.endsWith(".mol")) {
            fileName += ".mol";
            outFile = new File(fileName);
        }
        outFile=new File(fileName);
       
        if(saveAsRgrpQuery) {
          cow = new RGroupQueryWriter(new FileWriter(outFile));
         
          boolean problem=false;
          String message="";
          jcpPanel.get2DHub().getRGroupHandler().cleanUpRGroup(jcpPanel.get2DHub().getChemModel().getMoleculeSet());

          if(!rGroupQuery.areRootAtomsDefined()) {
                message = GT.get("The R-group Query is not valid: there are substitutes that have no corresponding atom in the root structure.");
                problem=true;
          }
          if(!rGroupQuery.areSubstituentsDefined()) {
                message = GT.get("The R-group Query is not valid: the root structure has R# definitions for which no substitutes are defined.");
        problem=true;
          }
          if (problem) {
                String error = GT.get("Could not save file");
View Full Code Here

Examples of org.openscience.cdk.isomorphism.matchers.IRGroupQuery

  /**
   * Undo actions
   */
  public void undo() {

    IRGroupQuery rgrpQ= rgrpHandler.getrGroupQuery();

    if (type.equals("setSubstitute")||type.equals("setRoot")) {
      this.redoRootAttachmentPoints=rgrpHandler.getrGroupQuery().getRootAttachmentPoints();
      for (Iterator<IAtom> atItr = existingAtomDistr.keySet().iterator(); atItr.hasNext();) {
        IAtom atom = atItr.next();
        existingAtomDistr.get(atom).addAtom(atom);
      }
      for (Iterator<IBond> bndItr = existingBondDistr.keySet().iterator(); bndItr.hasNext();) {
        IBond bond = bndItr.next();
        existingBondDistr.get(bond).addBond(bond);
      }
        hub.getChemModel().getMoleculeSet().removeAtomContainer(userSelection);
     
      if (type.equals("setRoot")) {
        if (isNewRgrp) {
          rgrpQ.setRootStructure(null);
          rgrpQ.setRootAttachmentPoints(null);
          for (IAtomContainer atc: hub.getIChemModel().getMoleculeSet().atomContainers()) {
            atc.removeProperty(CDKConstants.TITLE)
          }
          hub.unsetRGroupHandler();
        }
        else {
          existingRoot.setProperty(CDKConstants.TITLE,RGroup.ROOT_LABEL)
          rgrpQ.setRootStructure(existingRoot);
          rgrpQ.setRootAttachmentPoints(existingRootAttachmentPoints);
        }
      }
 
      else if (type.equals("setSubstitute")) {
        if  (existingRgroupLists !=null) {
          for(Iterator<Integer> rNums=existingRgroupLists.keySet().iterator(); rNums.hasNext();){
            int rNum= rNums.next();
            rgrpQ.getRGroupDefinitions().put(rNum, existingRgroupLists.get(rNum));
          }
        }
      }
    }

    else if (type.startsWith("setAtomApoAction")) {
      RGroup undoRGroup=existingRGroupApo.keySet().iterator().next();     
        for (Iterator<Integer> rnumItr= hub.getRGroupHandler().getrGroupQuery().getRGroupDefinitions().keySet().iterator(); rnumItr.hasNext();) {
          for (RGroup rgrp:  hub.getRGroupHandler().getrGroupQuery().getRGroupDefinitions().get(rnumItr.next()).getRGroups()) {
            if(rgrp.equals(undoRGroup)) {
              IAtom apo1=existingRGroupApo.get(undoRGroup).get(1);
              IAtom apo2=existingRGroupApo.get(undoRGroup).get(2);
              rgrp.setFirstAttachmentPoint(apo1);
              rgrp.setSecondAttachmentPoint(apo2);
            }
          }
        }
    }
    else if (type.startsWith("setBondApoAction")) {
      for(Iterator<IAtom> atItr=existingRootAttachmentPoints.keySet().iterator(); atItr.hasNext();) {
        IAtom rAtom= atItr.next();
        Map<Integer,IBond> undoApo = existingRootAttachmentPoints.get(rAtom);
        Map<Integer,IBond> apoBonds = rgrpQ.getRootAttachmentPoints().get(rAtom);

        redoRootAttachmentPoints= new HashMap<IAtom, Map<Integer, IBond>>();
        Map<Integer,IBond> redoApo = new HashMap<Integer,IBond>();
        if(apoBonds.get(1)!=null)
          redoApo.put(1, apoBonds.get(1));
        if(apoBonds.get(2)!=null)
          redoApo.put(2, apoBonds.get(2));
        redoRootAttachmentPoints.put(rAtom, redoApo);
       
        apoBonds.remove(1); apoBonds.remove(2);
        if(undoApo.get(1)!=null) {
          apoBonds.put(1, undoApo.get(1));
        }
        if(undoApo.get(2)!=null) {
          apoBonds.put(2, undoApo.get(2));
        }
      }
    }
    else if (type.equals("clearRgroup")) {
      hub.setRGroupHandler(rgrpHandler);
      rgrpQ.getRootStructure().setProperty(CDKConstants.TITLE, RGroup.ROOT_LABEL);
        for (Iterator<Integer> rnumItr= hub.getRGroupHandler().getrGroupQuery().getRGroupDefinitions().keySet().iterator(); rnumItr.hasNext();) {
          int rNum=rnumItr.next();
          for (RGroup rgrp:  hub.getRGroupHandler().getrGroupQuery().getRGroupDefinitions().get(rNum).getRGroups()) {
            rgrp.getGroup().setProperty(CDKConstants.TITLE,RGroup.makeLabel(rNum));
          }
View Full Code Here

Examples of org.openscience.cdk.isomorphism.matchers.IRGroupQuery

   
      if (isNewRgrp) {
        hub.setRGroupHandler(rgrpHandler);
      }
 
      IRGroupQuery rgrpQ= rgrpHandler.getrGroupQuery();
      for (Iterator<IAtom> atItr = existingAtomDistr.keySet().iterator(); atItr.hasNext();) {
        IAtom atom = atItr.next();
        existingAtomDistr.get(atom).removeAtom(atom);
      }
      for (Iterator<IBond> bndItr = existingBondDistr.keySet().iterator(); bndItr.hasNext();) {
        IBond bond = bndItr.next();
        existingBondDistr.get(bond).removeBond(bond);
      }
      hub.getChemModel().getMoleculeSet().addAtomContainer(userSelection);
 
      if (type.equals("setRoot")) {
        rgrpQ.setRootStructure(redoRootStructure);
        rgrpQ.getRootStructure().setProperty(CDKConstants.TITLE,RGroup.ROOT_LABEL)
        rgrpQ.setRootAttachmentPoints(redoRootAttachmentPoints);
      }
      else if (type.equals("setSubstitute")) {
        if  (redoRgroupLists !=null) {
          for(Iterator<Integer> rNums=redoRgroupLists.keySet().iterator(); rNums.hasNext();){
            int rNum= rNums.next();
            rgrpQ.getRGroupDefinitions().put(rNum, redoRgroupLists.get(rNum));
          }
        }
      }
    }
    else if (type.startsWith("setAtomApoAction")) {
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.