Logo Search packages:      
Sourcecode: cdk version File versions  Download package

void org::openscience::cdk::tools::GenerateFragments::generateMurckoFragments ( IMolecule  molecule,
boolean  sidechainHetatoms,
boolean  exocyclicDoubleBonds,
int  minimumRingSize 
) throws CDKException [inline]

generates Murcko fragments takes two parameters

Parameters:
moleculethe molecule
sidechainHetatomsboolean if sidchain hetero atoms should be included (true)
exocyclicDoubleBondsboolean if bonds with order >1 should be included on ring systems and linkers
minimumRingSizeint indicates the minimum ring size as to considered as fragment (ringSize<minimimRingSize) return void

Definition at line 110 of file GenerateFragments.java.

References org::openscience::cdk::interfaces::IAtomContainer::add(), org::openscience::cdk::interfaces::IAtomContainer::addAtom(), addFragmentBonds(), addPathFragments(), checkPath(), org::openscience::cdk::interfaces::IAtomContainer::contains(), org::openscience::cdk::graph::PathTools::depthFirstTargetSearch(), generateRingFragments(), org::openscience::cdk::interfaces::IAtomContainer::getAtom(), org::openscience::cdk::interfaces::IAtomContainerSet::getAtomContainer(), org::openscience::cdk::interfaces::IAtomContainerSet::getAtomContainerCount(), org::openscience::cdk::interfaces::IAtomContainer::getAtomCount(), org::openscience::cdk::interfaces::IChemObject::getBuilder(), org::openscience::cdk::interfaces::IChemObject::getFlag(), getPossibleLinkerSubstituents(), org::openscience::cdk::CDKConstants::ISINRING, and org::openscience::cdk::interfaces::IChemObjectBuilder::newAtomContainer().

                                                                                                                                                               {
            //logger.debug("****** generatemurckoFragments *******");
            //VARIABLES
            this.murckoFragments =new Vector();
            this.linkerFragments=new Vector();
            this.sidechainHetatoms=sidechainHetatoms;
            this.exocyclicDoubleBonds=exocyclicDoubleBonds;
                              
            IAtom firstRingAtom = null;   
            IAtom secondRingAtom = null;  
            IAtomContainer firstRingAtomContainer=null;
            IAtomContainer secondRingAtomContainer=null;
            IAtomContainer firstRingSubstituents=null;
            IAtomContainer secondRingSubstituents=null;
            IAtomContainer path=null;
            IMolecule murckoFragment=null;
            IMolecule linkerFragment=null;
            List tmpRingFragments=new Vector();
            
            //Initialize
            generateRingFragments(molecule);
            
            for (int i = 0; i < molecule.getAtomCount(); i++) {
                  molecule.getAtom(i).setFlag(CDKConstants.ISINRING, false);
            }
                        
            //logger.debug("Number of RingSystems:"+this.ringFragments.size());
            for (int f = 0; f < this.ringFragments.size(); f++) {
                  firstRingAtomContainer = molecule.getBuilder().newAtomContainer();
                  IRingSet ringSet = (IRingSet)this.ringFragments.get(f);
                  for (int i=0;i<ringSet.getAtomContainerCount();i++) {
                        firstRingAtomContainer.add(ringSet.getAtomContainer(i));
                  }
                  
                  if (firstRingAtomContainer.getAtomCount()>=minimumRingSize){
                        tmpRingFragments.add(firstRingAtomContainer);
                        for (int g = 0; g < firstRingAtomContainer.getAtomCount(); g++) {
                              molecule.getAtom(molecule.getAtomNumber(firstRingAtomContainer.getAtom(g))).setFlag(CDKConstants.ISINRING, true);
                        }
                        
                  }
            }

//          START
            //logger.debug("Number of RingSystems:"+tmpRingFragments.size());
            if (tmpRingFragments.size() > 1) {
                  //go through all ringsystems
                  //for (int f = 0; f < this.ringFragments.size()-1; f++) {
                  for (int f = 0; f < tmpRingFragments.size()-1; f++) { 
                  //firstRingAtomContainer = RingSetManipulator.getAllInOneContainer((IRingSet) this.ringFragments.get(f));
                        firstRingAtomContainer = (IAtomContainer)tmpRingFragments.get(f);
                        //for (int g = f+1; g < this.ringFragments.size(); g++) {
                              //secondRingAtomContainer = RingSetManipulator.getAllInOneContainer((IRingSet) this.ringFragments.get(g));
                        for (int g = f+1; g < tmpRingFragments.size(); g++) {
                              secondRingAtomContainer = (IAtomContainer)tmpRingFragments.get(g);
                              for (int h = 0; h < firstRingAtomContainer.getAtomCount(); h++){
                                    firstRingAtom=firstRingAtomContainer.getAtom(h);
                                    firstRingSubstituents=getPossibleLinkerSubstituents(firstRingAtom,molecule,firstRingAtomContainer);
                                    if (firstRingSubstituents.getAtomCount()>0){
                                          //go through substituents of first ring
                                          for (int i = 0; i < firstRingSubstituents.getAtomCount(); i++){
//                                              logger.debug("First Ring Sub is in RING");
//                                              //check for ring-ring system
                                                //Is a zero-atom linker
                                                if (firstRingSubstituents.getAtom(i).getFlag(CDKConstants.ISINRING) && secondRingAtomContainer.contains(firstRingSubstituents.getAtom(i))){
                                                      //logger.debug("\tFound a ring-ring System");
                                                      murckoFragment=new Molecule();
                                                      
                                                      murckoFragment=addFragments(firstRingAtomContainer,murckoFragment,molecule);
                                                      murckoFragment=addFragments(secondRingAtomContainer,murckoFragment,molecule);
                                                      murckoFragment=addFragmentBonds(murckoFragment,molecule);
                                                      
                                                      linkerFragment=new Molecule();
                                                      linkerFragment.addAtom(firstRingAtom);
                                                      linkerFragment.addAtom(firstRingSubstituents.getAtom(i));
                                                      linkerFragment=addFragmentBonds(linkerFragment, molecule);
                                                      
                                                      this.linkerFragments.add(linkerFragment);
                                                      this.murckoFragments.add(murckoFragment);
                                                      //logger.debug("MFragment:"+murckoFragment.getAtomCount()+" CC:"+ConnectivityChecker.isConnected(murckoFragment));
                                                      //logger.debug(murckoFragment.toString());
                                                      //logger.debug("\tADD MURCKOFRAGMENT");
                                                      break;
                                                }
//                                              compare to substituents of second ring
                                                for (int j = 0; j < secondRingAtomContainer.getAtomCount(); j++){
                                                      secondRingAtom=secondRingAtomContainer.getAtom(j);
                                                      secondRingSubstituents=getPossibleLinkerSubstituents(secondRingAtom,molecule,secondRingAtomContainer);
                                                      if (secondRingSubstituents.getAtomCount()>0){
                                                            //go through substituents of second ring
                                                            for (int k = 0; k < secondRingSubstituents.getAtomCount(); k++){//For-k
                                                                  
                                                                  //logger.debug("First Ring Size:"+firstRingAtomContainer.getAtomCount()+" 2.Ring Size:"+secondRingAtomContainer.getAtomCount());
                                                                  //logger.debug(f+".ringSub:"+molecule.getAtomNumber(firstRingSubstituents.getAtomAt(i))+" Sym:"+firstRingSubstituents.getAtomAt(i).getSymbol()+" "+g+".ringSub:"+molecule.getAtomNumber(secondRingSubstituents.getAtomAt(k)));
                                                                  path=new AtomContainer();
                                                                  resetFlags(molecule);
                                                                  PathTools.depthFirstTargetSearch(molecule,firstRingSubstituents.getAtom(i),secondRingSubstituents.getAtom(k),path);
                                                                  /*logger.debug("\tPATHSIZE:"+path.getAtomCount());
                                                                  logger.debug("\tFIRST PATHATOM:"+molecule.getAtomNumber(path.getAtomAt(0)));
                                                                  try{
                                                                        logger.debug("\tLAST PATHATOM:"+molecule.getAtomNumber(path.getAtomAt(path.getAtomCount()-1)));
                                                                  }catch(Exception eS){
                                                                        logger.debug("\tNO LAST PATHATOM");
                                                                  }*/
                                                                  
                                                                  if (firstRingSubstituents.getAtom(i)==secondRingSubstituents.getAtom(k)){
                                                                        //logger.debug("\tSubstituents are equal");
                                                                        path.addAtom(firstRingSubstituents.getAtom(i));
                                                                  }
                                                                  
                                                                  //Check Path, direct connection between the substituents ->linker
                                                                  if ((checkPath(firstRingAtom, secondRingAtom, path) && path.getAtomCount()>0)){
                                                                        murckoFragment=new Molecule();
                                                                        
                                                                        //add both root atoms to path
                                                                        if (!path.contains(firstRingSubstituents.getAtom(i))){
                                                                              path.addAtom(firstRingSubstituents.getAtom(i));
                                                                        }
                                                                        if (!path.contains(secondRingSubstituents.getAtom(k))){
                                                                              path.addAtom(secondRingSubstituents.getAtom(k));
                                                                        }
//                                                                            //add both ring atoms to path
                                                                        //if (!path.contains(firstRingAtom)){
                                                                        //    path.addAtom(firstRingAtom);
                                                                        //}
                                                                        //if (!path.contains(secondRingAtom)){
                                                                        //    path.addAtom(secondRingAtom);
                                                                        //}
                                                                        //1. add path
                                                                        //2. add rings  
                                                                        //3. connect ring atoms to path
                                                                        murckoFragment=addPathFragments(path,murckoFragment,molecule);
                                                                        linkerFragment=new Molecule(murckoFragment);
                                                                        if (!linkerFragment.contains(firstRingAtom)){
                                                                              linkerFragment.addAtom(firstRingAtom);
                                                                        }
                                                                        if (!linkerFragment.contains(secondRingAtom)){
                                                                              linkerFragment.addAtom(secondRingAtom);
                                                                        }                                                                             
                                                                        linkerFragment=addFragmentBonds(linkerFragment, molecule);
                                                                        murckoFragment=addFragments(firstRingAtomContainer,murckoFragment,molecule);
                                                                        murckoFragment=addFragments(secondRingAtomContainer,murckoFragment,molecule);
                                                                        
                                                                        murckoFragment=addFragmentBonds(murckoFragment,molecule);
                                                                                                                                                                                                                                                                                                      
                                                                        this.linkerFragments.add(linkerFragment);
                                                                        this.murckoFragments.add(murckoFragment);
                                                                        //logger.debug("\tADD MURCKOFRAGMENT");
                                                                  }else{
                                                                        //logger.debug("\tEND PATH");
                                                                  }
                                                            }//For-k
                                                      }//if 2.ring sub
                                                }//For-j
                                          }//For-i
                                    }//if 1.ring sub
                              }//For-h
                        }//For-g                      
                  }//For-f                      
            }else if (tmpRingFragments.size() ==1){
                  //logger.debug("Number of RingSystems is 1");
                  murckoFragment=new Molecule();
                  murckoFragment=addFragments((IRingSet) this.ringFragments.get(0),murckoFragment,molecule);
                  murckoFragment=addFragmentBonds(murckoFragment,molecule);
                  this.murckoFragments.add(murckoFragment);
            }
            
      }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index