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

com.actelion.research.chem.sar.SARScaffoldGroup Maven / Gradle / Ivy

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

import com.actelion.research.chem.Molecule;
import com.actelion.research.chem.StereoMolecule;

import java.util.ArrayList;

/**
 * A scaffold group comprises all scaffolds that arise from a match of the same query substructure in multiple
 * processed molecules. A scaffold group may contain more than one scaffold, if the substructure contains wild card
 * elements like atom lists, or multiple allowed bond orders. A special case are bridge bonds, which cause a query
 * match to contain more atoms than the query itself. Interestingly, these atoms may also carry R-groups, which needs
 * to be handled differently from the R-groups on the core atoms. Core atoms are those atoms for which an associated
 * atom exists in the query structure. R-groups (exit vectors) on core atom are numbered consistently within all
 * scaffolds that belong to the same scaffold group, i.e. that were detected from the same query structure.
 */
public class SARScaffoldGroup {
	private int mRGroupCount;
	private ExitVector[] mExitVector;
	private ArrayList mScaffoldList;

	protected SARScaffoldGroup(StereoMolecule query) {
		super();
		mRGroupCount = -1;
		analyzeExitVectors(query);
		mScaffoldList = new ArrayList<>();
	}

	public void addScaffold(SARScaffold scaffold) {
		mScaffoldList.add(scaffold);
	}

	public ArrayList getScaffoldList() {
		return mScaffoldList;
	}

	private void analyzeExitVectors(StereoMolecule query) {
		ArrayList evList = new ArrayList<>();
		for (int atom=0; atom= two exit vectors (with both one and two connAtoms in the query)
					// we assume that we can distinuish the exit vectors by topicity (any stereo criteria)
					int topicity = (exitVectorCount >= 2) ? i : -1;
					evList.add(new ExitVector(atom, true, i, topicity));
				}
			}
		}
		mExitVector = evList.toArray(new ExitVector[0]);
	}

	protected int getExitVectorCount() {
		return mExitVector.length;
	}

	/**
	 * Find correct exit vector index defining the core atom and for it either the exit vectors topicity
	 * (if exit vectors are stereo-heterotop) or just an index (if exit vectors are homotop)
	 * @param queryAtom respective atom index of query
	 * @param connIndex 0-based exo-query neighbour index (not used if topicity != -1 and neighbours are stereotop
	 * @param topicity -1, if exit vector neighbours are homotop, otherise 0 or 1
	 * @return index into list of all exit vectors of scaffold
	 */
	protected int getExitVectorIndex(int queryAtom, int connIndex, int topicity) {
		for (int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy