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

com.actelion.research.chem.phesa.pharmacophore.pp.AromRingPoint Maven / Gradle / Ivy

There is a newer version: 2024.11.2
Show newest version
package com.actelion.research.chem.phesa.pharmacophore.pp;

import java.util.ArrayList;
import java.util.List;

import com.actelion.research.chem.Coordinates;
import com.actelion.research.chem.StereoMolecule;
import com.actelion.research.chem.conf.Conformer;
import com.actelion.research.util.ArrayUtils;

public class AromRingPoint implements IPharmacophorePoint {
	private int referenceAtom;
	private List ringAtoms;
	private Coordinates center;
	private static final Coordinates directionality = new Coordinates(1.0,0.0,0.0);

	/**
	 *
	 * @param mol
	 * @param a is included in ringAtoms
	 * @param ringAtoms
	 */
	public AromRingPoint(StereoMolecule mol, int a, List ringAtoms) {
		referenceAtom = a;
		this.ringAtoms = ringAtoms;
		updateCoordinates(mol.getAtomCoordinates());
	}
	
	public AromRingPoint(AromRingPoint aP) {
		referenceAtom = aP.referenceAtom;
		center = new Coordinates(aP.center);
		ringAtoms = new ArrayList();
		for(int ringAtom : aP.ringAtoms) {
			ringAtoms.add(ringAtom);
		}
	}

	@Override
	public Coordinates getCenter() {
		return center;
	}

	@Override
	public void updateCoordinates(Coordinates[] coords) {
		Coordinates com = new Coordinates(0,0,0);
		for(int ringAtom : ringAtoms) {
			com.add(coords[ringAtom]);
		}
		com.scale(1.0/( ringAtoms.size()));

		center = com;
	}
	

	

	@Override
	public Coordinates getDirectionality() {
		// TODO Auto-generated method stub
		return directionality;
	}
	
	private AromRingPoint(String ppString, StereoMolecule mol) {
		decode(ppString,mol);
	}
	
	public static AromRingPoint fromString(String ppString, StereoMolecule mol) {
		return new AromRingPoint(ppString,mol);
	}
	

	private void decode(String ppString, StereoMolecule mol) {
		String[] strings = ppString.split(" ");
		referenceAtom = Integer.decode(strings[1]);
		ringAtoms = new ArrayList();
		for(int i=2;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy