test_class.declarator: logger = LoggingToolFactory.createLoggingTool(FractionalPSADescriptorTest.class)
test_class.modifier: private static
test_class.original_string: private static ILoggingTool logger = LoggingToolFactory.createLoggingTool(FractionalPSADescriptorTest.class);
test_class.type: ILoggingTool
test_class.var_name: logger
test_class.file: descriptor/qsarmolecular/src/test/java/org/openscience/cdk/qsar/descriptors/molecular/FractionalPSADescriptorTest.java
test_class.identifier: FractionalPSADescriptorTest
test_class.superclass: extends MolecularDescriptorTest
test_case.body: @Test
      public void testDescriptors() throws Exception {
          String fnmol = "data/cdd/pyridineacid.mol";
          MDLV2000Reader mdl = new MDLV2000Reader(this.getClass().getClassLoader().getResourceAsStream(fnmol));
          AtomContainer mol = new AtomContainer();
          mdl.read(mol);
          mdl.close();
  
          FractionalPSADescriptor fpsa = new FractionalPSADescriptor();
          DescriptorValue results = fpsa.calculate(mol);
  
          // note: test currently assumes that just one descriptor is calculated
          String[] names = results.getNames();
          if (names.length != 1 || !names[0].equals("tpsaEfficiency"))
              throw new CDKException("Only expecting 'tpsaEfficiency'");
          DoubleResult value = (DoubleResult) results.getValue();
          double tpsaEfficiency = value.doubleValue();
          final double ANSWER = 0.4036, ANSWER_LO = ANSWER * 0.999, ANSWER_HI = ANSWER * 1.001; // (we can tolerate rounding errors)
          if (tpsaEfficiency < ANSWER_LO || tpsaEfficiency > ANSWER_HI) {
              throw new CDKException("Got " + tpsaEfficiency + ", expected " + ANSWER);
          }
      }
test_case.class_method_signature: FractionalPSADescriptorTest.testDescriptors()
test_case.full_signature: @Test public void testDescriptors()
test_case.identifier: testDescriptors
test_case.invocations: getResourceAsStream getClassLoader getClass read close calculate getNames equals getValue doubleValue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDescriptors()
focal_class.file: descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/FractionalPSADescriptor.java
focal_class.identifier: FractionalPSADescriptor
focal_class.interfaces: implements IMolecularDescriptor
focal_class.class_method_signature: FractionalPSADescriptor.FractionalPSADescriptor()
focal_class.full_signature: public  FractionalPSADescriptor()
focal_class.identifier: FractionalPSADescriptor
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  FractionalPSADescriptor()
focal_class.class_method_signature: FractionalPSADescriptor.initialise(IChemObjectBuilder builder)
focal_class.full_signature: @Override public void initialise(IChemObjectBuilder builder)
focal_class.identifier: initialise
focal_class.modifiers: @Override public
focal_class.parameters: (IChemObjectBuilder builder)
focal_class.return: void
focal_class.signature: void initialise(IChemObjectBuilder builder)
focal_class.class_method_signature: FractionalPSADescriptor.getSpecification()
focal_class.full_signature: @Override public DescriptorSpecification getSpecification()
focal_class.identifier: getSpecification
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: DescriptorSpecification
focal_class.signature: DescriptorSpecification getSpecification()
focal_class.class_method_signature: FractionalPSADescriptor.setParameters(Object[] params)
focal_class.full_signature: @Override public void setParameters(Object[] params)
focal_class.identifier: setParameters
focal_class.modifiers: @Override public
focal_class.parameters: (Object[] params)
focal_class.return: void
focal_class.signature: void setParameters(Object[] params)
focal_class.class_method_signature: FractionalPSADescriptor.getParameters()
focal_class.full_signature: @Override public Object[] getParameters()
focal_class.identifier: getParameters
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Object[]
focal_class.signature: Object[] getParameters()
focal_class.class_method_signature: FractionalPSADescriptor.getDescriptorNames()
focal_class.full_signature: @Override public String[] getDescriptorNames()
focal_class.identifier: getDescriptorNames
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String[]
focal_class.signature: String[] getDescriptorNames()
focal_class.class_method_signature: FractionalPSADescriptor.getDummyDescriptorValue(Exception e)
focal_class.full_signature: private DescriptorValue getDummyDescriptorValue(Exception e)
focal_class.identifier: getDummyDescriptorValue
focal_class.modifiers: private
focal_class.parameters: (Exception e)
focal_class.return: DescriptorValue
focal_class.signature: DescriptorValue getDummyDescriptorValue(Exception e)
focal_class.class_method_signature: FractionalPSADescriptor.calculate(IAtomContainer mol)
focal_class.full_signature: @Override public DescriptorValue calculate(IAtomContainer mol)
focal_class.identifier: calculate
focal_class.modifiers: @Override public
focal_class.parameters: (IAtomContainer mol)
focal_class.return: DescriptorValue
focal_class.signature: DescriptorValue calculate(IAtomContainer mol)
focal_class.class_method_signature: FractionalPSADescriptor.getDescriptorResultType()
focal_class.full_signature: @Override public IDescriptorResult getDescriptorResultType()
focal_class.identifier: getDescriptorResultType
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: IDescriptorResult
focal_class.signature: IDescriptorResult getDescriptorResultType()
focal_class.class_method_signature: FractionalPSADescriptor.getParameterNames()
focal_class.full_signature: @Override public String[] getParameterNames()
focal_class.identifier: getParameterNames
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String[]
focal_class.signature: String[] getParameterNames()
focal_class.class_method_signature: FractionalPSADescriptor.getParameterType(String name)
focal_class.full_signature: @Override public Object getParameterType(String name)
focal_class.identifier: getParameterType
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: Object
focal_class.signature: Object getParameterType(String name)
focal_method.body: @Override
      public DescriptorValue calculate(IAtomContainer mol) {
          try {
              mol = mol.clone();
          } catch (CloneNotSupportedException ex) {
          }
          double polar = 0, weight = 0;
          try {
              // type & assign implicit hydrogens
              IChemObjectBuilder builder = mol.getBuilder();
              CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(builder);
              for (IAtom atom : mol.atoms()) {
                  IAtomType type = matcher.findMatchingAtomType(mol, atom);
                  AtomTypeManipulator.configure(atom, type);
              }
              CDKHydrogenAdder adder = CDKHydrogenAdder.getInstance(builder);
              adder.addImplicitHydrogens(mol);
  
              // polar surface area: chain it off the TPSADescriptor
              TPSADescriptor tpsa = new TPSADescriptor();
              DescriptorValue value = tpsa.calculate(mol);
              polar = ((DoubleResult) value.getValue()).doubleValue();
  
              //  molecular weight
              for (IAtom atom : mol.atoms()) {
                  weight += Isotopes.getInstance().getMajorIsotope(atom.getSymbol()).getExactMass();
                  Integer hcount = atom.getImplicitHydrogenCount();
                  if (hcount != CDKConstants.UNSET) weight += hcount * 1.00782504;
              }
          } catch (CDKException | IOException exception) {
              return getDummyDescriptorValue(exception);
          }
  
          return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new DoubleResult(
                  weight == 0 ? 0 : polar / weight), getDescriptorNames());
      }
focal_method.class_method_signature: FractionalPSADescriptor.calculate(IAtomContainer mol)
focal_method.full_signature: @Override public DescriptorValue calculate(IAtomContainer mol)
focal_method.identifier: calculate
focal_method.invocations: clone getBuilder getInstance atoms findMatchingAtomType configure getInstance addImplicitHydrogens calculate doubleValue getValue atoms getExactMass getMajorIsotope getInstance getSymbol getImplicitHydrogenCount getDummyDescriptorValue getSpecification getParameterNames getParameters getDescriptorNames
focal_method.modifiers: @Override public
focal_method.parameters: (IAtomContainer mol)
focal_method.return: DescriptorValue
focal_method.signature: DescriptorValue calculate(IAtomContainer mol)