Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Iterator;
- import java.util.Map;
- import org.openscience.cdk.*;
- import org.openscience.cdk.exception.CDKException;
- import org.openscience.cdk.qsar.descriptors.molecular.*;
- import org.openscience.cdk.smiles.*;
- import org.openscience.cdk.qsar.*;
- import org.openscience.cdk.qsar.result.IDescriptorResult;
- /**
- *
- * @author Hari
- * @since 19-12-2010
- * @version 1.0
- */
- public class descr {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) throws CDKException {
- // TODO code application logic here
- BCUTDescriptor descriptor = new BCUTDescriptor();
- Molecule molecule = (Molecule) new SmilesParser(DefaultChemObjectBuilder.getInstance()).parseSmiles("NC(CO)C(=O)O");
- // The first program in wiki link for Descriptor Calculator
- DescriptorValue value = descriptor.calculate(molecule);
- IDescriptorResult theNumbers = value.getValue();
- System.out.print(theNumbers.toString()+"\n\n");
- // Second program
- DescriptorEngine engine = new DescriptorEngine(DescriptorEngine.MOLECULAR);
- engine.process(molecule);
- /**
- * The function getProperties returns a Map value. Map represents a Key Value set.
- * It is retrieved using an iterator. Since the key is of DescriptorSpecification class and the
- * value is of type DescriptorValue we have to typecast the key and value with the same while retrieving.
- * since they have not override the same to String.
- */
- Map i = molecule.getProperties();
- Iterator iterator = i.keySet().iterator();
- /**
- * The following prints the key and Value set.
- */
- while(iterator. hasNext()){
- String key = ((DescriptorSpecification)iterator.next()).getSpecificationReference().toString();
- System.out.print(key.substring(key.lastIndexOf("#")+1)+" : ");
- System.out.print(((DescriptorValue)i.get((DescriptorSpecification)iterator.next())).getValue().toString()+"\n\n");
- }
- }
- }
Add Comment
Please, Sign In to add comment