All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.actelion.research.chem.mmp.MMPPropertyCalculator Maven / Gradle / Ivy

There is a newer version: 2024.11.2
Show newest version
/*
 * Copyright (c) 2017
 * Actelion Pharmaceuticals Ltd.
 * Gewerbestrasse 16
 * CH-4123 Allschwil, Switzerland
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 3. Neither the name of the copyright holder nor the
 *    names of its contributors may be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * @author Gregori Gerebtzoff
 */

package com.actelion.research.chem.mmp;

import com.actelion.research.chem.*;
import com.actelion.research.chem.conf.MolecularFlexibilityCalculator;
import com.actelion.research.chem.prediction.CLogPPredictor;
import com.actelion.research.chem.prediction.PolarSurfaceAreaPredictor;
import com.actelion.research.util.DoubleFormat;

import java.util.TreeSet;

public class MMPPropertyCalculator {
	String propertyName;
	String shortDisplayedPropertyName;
	String longDisplayedPropertyName;
	int calculatedPropertyAttributeIndex;
	String value;
	
	public MMPPropertyCalculator() {}
	
	/**
	 * @param propertyName Name of the calculated property
	 * @param calculatedPropertyAttributeIndex Column index of the calculated property
	 */
	private void CalculateCompound(String propertyName, StereoMolecule mol, int calculatedPropertyAttributeIndex) {
		this.propertyName = propertyName;
		this.calculatedPropertyAttributeIndex = calculatedPropertyAttributeIndex;
		this.value = null;
		if (propertyName.toLowerCase().equals("total_weight") || propertyName.toLowerCase().equals("mw")) {
			this.shortDisplayedPropertyName = "MW";
			this.longDisplayedPropertyName = "Molecular Weight";
			double totalWeight = new MolecularFormula(mol).getRelativeWeight();
			value = DoubleFormat.toString(totalWeight, 6, true);
		}
		else if (propertyName.toLowerCase().equals("logp")) {
			this.shortDisplayedPropertyName = "LogP";
			this.longDisplayedPropertyName = "LogP";
			CLogPPredictor predictor = new CLogPPredictor();
			float cLogP = predictor.assessCLogP(mol);
			value = Float.toString(cLogP);
		}
		else if (propertyName.toLowerCase().equals("acceptors")) {
			this.shortDisplayedPropertyName = "Acceptors";
			this.longDisplayedPropertyName = "Acceptors";
			int count = 0;
			for (int atom=0; atom 0)
					count++;
			value = ""+count;
		}
		else if (propertyName.toLowerCase().equals("psa")) {
			this.shortDisplayedPropertyName = "PSA";
			this.longDisplayedPropertyName = "Polar Surface Area";
			PolarSurfaceAreaPredictor predictor = new PolarSurfaceAreaPredictor();
			float psa = predictor.assessPSA(mol);
			value = Float.toString(psa);
		}
		else if (propertyName.toLowerCase().equals("shape")) {
			this.shortDisplayedPropertyName = "Shape";
			this.longDisplayedPropertyName = "Shape";
			value = DoubleFormat.toString(assessMolecularShape(mol));
		}
		else if (propertyName.toLowerCase().equals("flexibility")) {
			this.shortDisplayedPropertyName = "Flexibility";
			this.longDisplayedPropertyName = "Flexibility";
			MolecularFlexibilityCalculator predictor = new MolecularFlexibilityCalculator();
			float flexibility = predictor.calculateMolecularFlexibility(mol);
			value = Float.toString(flexibility);
		}
		else if (propertyName.toLowerCase().equals("complexity")) {
			this.shortDisplayedPropertyName = "Complexity";
			this.longDisplayedPropertyName = "Complexity";
			value = DoubleFormat.toString(assessMolecularComplexity(mol));
		}
		else if (propertyName.replace(" ",  "_").toLowerCase().equals("heavy_atoms")) {
			this.shortDisplayedPropertyName = "Heavy atoms";
			this.longDisplayedPropertyName = "Heavy atoms";
			value = ""+mol.getAtoms();
		}
		else if (propertyName.replace(" ",  "_").toLowerCase().equals("noncarbon_atoms") || propertyName.toLowerCase().equals("non-carbon atoms")) {
			this.shortDisplayedPropertyName = "Non-carbon atoms";
			this.longDisplayedPropertyName = "Non-carbon atoms";
			int count = 0;
			mol.ensureHelperArrays(StereoMolecule.cHelperNeighbours);
			for (int atom=0; atom fragmentSet = new TreeSet();
	    int[] atomMap = new int[mol.getAllAtoms()];
	
	    boolean[][] bondsTouch = new boolean[mol.getBonds()][mol.getBonds()];
	    for (int atom=0; atom




© 2015 - 2024 Weber Informatics LLC | Privacy Policy