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

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

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

import com.actelion.research.chem.AtomFunctionAnalyzer;
import com.actelion.research.chem.Molecule;
import com.actelion.research.chem.RingCollection;
import com.actelion.research.chem.StereoMolecule;
import com.actelion.research.chem.phesa.pharmacophore.pp.ChargePoint;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;


/**
 * derives potentially ionizable Groups, independent of the chosen explicit protonation state
 * @author wahljo1
 *
 */

public class IonizableGroupDetector {
	
	private StereoMolecule mol;
	private List> ionizableGroups;
	private RingCollection ringCollection;
	
	public IonizableGroupDetector(StereoMolecule mol) {
		this.mol = mol;
		ionizableGroups = new ArrayList>();
		ringCollection = mol.getRingSet();
	}
	
	public ArrayList detect() {
		ArrayList chargePoints = new ArrayList();
		ArrayList ionizableGroup;
		//detect tetrazoles
		for(int r=0;r tetrazole = new ArrayList();
			int[] ringAtoms = ringCollection.getRingAtoms(r);
			for(Integer atom : ringAtoms) {
				if(alreadyDetected(atom)) continue;
				if(mol.getAtomicNo(atom)==7 && mol.isAromaticAtom(atom) && mol.getConnAtoms(atom)<=2)
					tetrazole.add(atom);
			}
			if(tetrazole.size()==4) {
				ionizableGroups.add(tetrazole);
				ChargePoint cp = new ChargePoint(mol,tetrazole.get(0),Arrays.asList(tetrazole.get(1),
						tetrazole.get(2),tetrazole.get(3)),-1);
				chargePoints.add(cp);
			}
		}
		for(int a=0;a();
						ionizableGroup.add(a);
						ionizableGroup.add(aa);
						int aaa1 = mol.getConnAtom(aa, 0);
						int aaa2 = mol.getConnAtom(aa, 1);
						int aaa3 = mol.getConnAtom(aa, 2);
						int aaa = (aaa1!=a && mol.getAtomicNo(aaa1)==8) ? aaa1 : 
							(aaa2!=a && mol.getAtomicNo(aaa2)==8) ? aaa2 : 
								aaa3;
						if(alreadyDetected(aaa)) continue;
						ionizableGroup.add(aaa);
						ionizableGroups.add(ionizableGroup);
						ChargePoint cp = new ChargePoint(mol,aa,new ArrayList(),-1);
						chargePoints.add(cp);
						continue;
					}
					else if (mol.getAtomicNo(aa)==15) {//POO3H2
						ionizableGroup = new ArrayList();
						ionizableGroup.add(a);
						ionizableGroup.add(aa);
						for(int i=0;i(),-1);
						chargePoints.add(cp);
						continue;					
					}
					else if (mol.getAtomicNo(aa)==16) {//SOO3H
						ionizableGroup = new ArrayList();
						ionizableGroup.add(a);
						ionizableGroup.add(aa);
						for(int i=0;i(),-1);
						chargePoints.add(cp);
						continue;					
					}
				}
				}
				else if(mol.getAtomicNo(a)==7) {
					if(!mol.isAromaticAtom(a) && mol.getConnAtoms(a)<=2) { //HNR2 or H2NR
							boolean found=false;
							for(int i=0;i();
												ionizableGroup.add(a);
												ionizableGroup.add(aa);
												ionizableGroup.add(aaa);
												ionizableGroups.add(ionizableGroup);
												ChargePoint cp = new ChargePoint(mol,aa,new ArrayList(),1);
												chargePoints.add(cp);
												found = true;

											}
												
										}
									
								}
							}
							
					}
					
				}
					if(alreadyDetected(a))continue;
					if(AtomFunctionAnalyzer.isBasicNitrogen(mol, a)) {
						ionizableGroup = new ArrayList();
						ionizableGroup.add(a);
						ionizableGroups.add(ionizableGroup);
						ChargePoint cp = new ChargePoint(mol,a,new ArrayList(),1);
						chargePoints.add(cp);
						continue;
					}
			}
			if(alreadyDetected(a))continue;
			else {
				int charge = mol.getAtomCharge(a);
				if(charge!=0 && !hasCounterChargedNeighbour(a)) {
					charge = charge>0 ? 1 : -1;
					ChargePoint cp = new ChargePoint(mol,a,new ArrayList(),charge);
					chargePoints.add(cp);
				}
			}
		}
		return chargePoints;
	}

	public List> getIonizableGroups() {
		return ionizableGroups;
	}

	private boolean hasCounterChargedNeighbour(int a) {
		for(int aa=0;aa




© 2015 - 2024 Weber Informatics LLC | Privacy Policy