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

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

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

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;

public class AromRingPoint implements IPharmacophorePoint {
	private int referenceAtom;
	private List ringAtoms;
	private Coordinates center;
	private Coordinates directionality = new Coordinates(0.0,0.0,0.0);
	
	public AromRingPoint(StereoMolecule mol, int a, List ringAtoms) {
		referenceAtom = a;
		this.ringAtoms = ringAtoms;
		updateCoordinates(mol);
	}
	
	public AromRingPoint(AromRingPoint aP) {
		referenceAtom = aP.referenceAtom;
		directionality = new Coordinates(aP.directionality);
		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(StereoMolecule mol) {
		Coordinates com = new Coordinates(0,0,0);
		for(int ringAtom : ringAtoms) {
			com.add(mol.getCoordinates(ringAtom));
		}
		com.scale(1.0/( ringAtoms.size()));

		center = com;
	}
	
	@Override
	public void updateCoordinates(Conformer conf) {
		Coordinates com = new Coordinates(0,0,0);
		for(int ringAtom : ringAtoms) {
			com.add(conf.getCoordinates(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 - 2025 Weber Informatics LLC | Privacy Policy