Examples of RGroupList


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

      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);

        JComboBox restHBox = (JComboBox) (rgrpPanel.getComponent(3));
        boolean restH=rgrpList.isRestH();
        String restHString= restH? GT.get("True"): GT.get("False");
        restHBox.setSelectedItem(restHString);

        JComboBox ifThenBox = (JComboBox) (rgrpPanel.getComponent(5));
        int ifThenR = rgrpList.getRequiredRGroupNumber();
        String ifThenRString= ifThenR==0?GT.get("None"):"R"+ifThenR;
        ifThenBox.setSelectedItem(ifThenRString);
      }

    } else {
View Full Code Here

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

    //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);
      } catch (CDKException e) {
        // won't happen - already checked in previous loop
        e.printStackTrace();
      }

      JComboBox restHBox = (JComboBox) (rgrpPanel.getComponent(3));
      String restHString= (String) (restHBox.getSelectedItem());
      if (restHString.equals(GT.get("True")))
        rgrpList.setRestH(true);
      else
        rgrpList.setRestH(false);


      JComboBox ifThenBox = (JComboBox) (rgrpPanel.getComponent(5));
      String ifThenR= (String) (ifThenBox.getSelectedItem());
      if (ifThenR.equals(GT.get("None")))
        rgrpList.setRequiredRGroupNumber(0);
      else {
        int userRnumInput = new Integer (ifThenR.substring(1));
        rgrpList.setRequiredRGroupNumber(userRnumInput);
      }
    }


  }
View Full Code Here

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

        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));
View Full Code Here

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

   *
   * @param original
   * @return
   */
  private static RGroupList makeClone(RGroupList original) {
    RGroupList clone = new RGroupList(original.getRGroupNumber());
    try {
      clone.setOccurrence(original.getOccurrence());
      clone.setRequiredRGroupNumber(original.getRequiredRGroupNumber());
      clone.setRestH(original.isRestH());
      List<RGroup> rgpList = new ArrayList<RGroup>();
      for (RGroup r : original.getRGroups()) {
        rgpList.add(r);
      }
      clone.setRGroups(rgpList);
    } catch (CDKException e) {
      e.printStackTrace();
    }
    return clone;
  }
View Full Code Here

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

    IAtomContainerSet moleculeSet = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
    moleculeSet.addAtomContainer(rGroupQuery.getRootStructure());
    chemModel.setMoleculeSet(moleculeSet);
    for (int rgrpNum : sortRGroupNumbers()) {
      RGroupList rgrpList = rGroupQuery.getRGroupDefinitions().get(rgrpNum);
      for (RGroup rgrp : rgrpList.getRGroups()) {
        chemModel.getMoleculeSet().addAtomContainer(rgrp.getGroup());
      }
    }
    return moleculeSet;
  }
View Full Code Here

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

    double minListYBottom=yBottom;

    for (int rgrpNum : sortRGroupNumbers()) {
      double listXRight=xLeft;

      RGroupList rgrpList = rGroupQuery.getRGroupDefinitions().get(rgrpNum);
      for (RGroup rgrp : rgrpList.getRGroups()) {

        double rgrpXleft=(findBoundary(rgrp.getGroup(),true,true,Double.POSITIVE_INFINITY));
        double rgrpYtop=(findBoundary(rgrp.getGroup(),false,false,Double.NEGATIVE_INFINITY));
        double shiftX= (listXRight - rgrpXleft);
        double shiftY= (yBottom - rgrpYtop);
View Full Code Here

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

     * @param atom
     */
    public boolean isAtomPartOfSubstitute(IAtom atom) {
      if (rGroupQuery!=null && rGroupQuery.getRGroupDefinitions()!=null) {
      for (Iterator<Integer> itr = rGroupQuery.getRGroupDefinitions().keySet().iterator(); itr.hasNext(); ) {
        RGroupList rgpList =rGroupQuery.getRGroupDefinitions().get(itr.next());
        if(rgpList!=null && rgpList.getRGroups()!=null) {
          for (RGroup rgrp: rgpList.getRGroups() ) {
            if(rgrp.getGroup().contains(atom)) {
              return true;
            }
          }
        }
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.