当前位置: 首页>>代码示例>>Java>>正文


Java IAtomContainer.getConnectedAtomsList方法代码示例

本文整理汇总了Java中org.openscience.cdk.interfaces.IAtomContainer.getConnectedAtomsList方法的典型用法代码示例。如果您正苦于以下问题:Java IAtomContainer.getConnectedAtomsList方法的具体用法?Java IAtomContainer.getConnectedAtomsList怎么用?Java IAtomContainer.getConnectedAtomsList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openscience.cdk.interfaces.IAtomContainer的用法示例。


在下文中一共展示了IAtomContainer.getConnectedAtomsList方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAtomContainerFromSMILES

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static IAtomContainer getAtomContainerFromSMILES(String smiles) throws Exception {
	IAtomContainer molecule = sp.parseSmiles(smiles);
	for(int i = 0; i < molecule.getAtomCount(); i++) {
		if(molecule.getAtom(i).getSymbol().equals("H")) continue;
		else {
			java.util.List<IAtom> atoms = molecule.getConnectedAtomsList(molecule.getAtom(i));
			short numDs = 0;
			for(IAtom atom : atoms)
				if(atom.getSymbol().equals("H") && (atom.getMassNumber() != null && atom.getMassNumber() == 2))
					numDs++;
			molecule.getAtom(i).setProperty(VariableNames.DEUTERIUM_COUNT_NAME, numDs);
		}
	}
	try {
		AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
		Aromaticity arom = new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet());
		arom.apply(molecule);
	} catch (CDKException e) {
		e.printStackTrace();
	}
	return molecule;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:23,代码来源:MoleculeFunctions.java

示例2: removeHydrogens

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static void removeHydrogens(IAtomContainer molecule) {
	java.util.Vector<IAtom> hydrogenAtoms = new java.util.Vector<IAtom>();
	java.util.Iterator<IAtom> atoms = molecule.atoms().iterator();
	while(atoms.hasNext()) {
		IAtom currentAtom = atoms.next();
		if(currentAtom.getSymbol().equals("H")) hydrogenAtoms.add(currentAtom);
		java.util.List<IAtom> neighbours = molecule.getConnectedAtomsList(currentAtom);
		int numberHydrogens = 0;
		for(int k = 0; k < neighbours.size(); k++) {
			if(neighbours.get(k).getSymbol().equals("H")) numberHydrogens++;
		}
		currentAtom.setImplicitHydrogenCount(numberHydrogens);
	}
	for(IAtom atom : hydrogenAtoms) {
		molecule.removeAtomAndConnectedElectronContainers(atom);
	}
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:18,代码来源:MoleculeFunctions.java

示例3: isValidDoubleBondConfiguration

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 *  Tells if a certain bond is center of a valid double bond configuration.
 *
 *@param  container  The atomcontainer.
 *@param  bond       The bond.
 *@return            true=is a potential configuration, false=is not.
 */
public boolean isValidDoubleBondConfiguration(IAtomContainer container, IBond bond)
{
	IAtom atom0 = bond.getAtom(0);
	IAtom atom1 = bond.getAtom(1);
	List<IAtom> connectedAtoms = container.getConnectedAtomsList(atom0);
	IAtom from = null;
       for (IAtom connectedAtom : connectedAtoms) {
           if (connectedAtom != atom1) {
               from = connectedAtom;
           }
       }
       boolean[] array = new boolean[container.getBondCount()];
	for (int i = 0; i < array.length; i++)
	{
		array[i] = true;
	}
	if (isStartOfDoubleBond(container, atom0, from, array) && isEndOfDoubleBond(container, atom1, atom0, array) && !bond.getFlag(CDKConstants.ISAROMATIC))
	{
		return (true);
	} else
	{
		return (false);
	}
}
 
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:32,代码来源:SmilesGenerator.java

示例4: hasWedges

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
private IAtom hasWedges(IAtomContainer ac, IAtom a)
	{
        List<IAtom> atoms = ac.getConnectedAtomsList(a);
        //		for (int i = 0; i < atoms.size(); i++)
//		{
//			atomi = (IAtom)atoms.get(i);
//			if (ac.getBond(a, atomi).getStereo() != IBond.Stereo.NONE && !atomi.getSymbol().equals("H"))
//			{
//				return (atomi);
//			}
//		}
        for (IAtom atom : atoms) {
            if (ac.getBond(a, atom).getStereo() != IBond.Stereo.NONE) {
                return (atom);
            }
        }
        return (null);
	}
 
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:19,代码来源:SmilesGenerator.java

示例5: getNumberExplicitHydrogens

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static int getNumberExplicitHydrogens(IAtomContainer its, int pos) {
	java.util.List<IAtom> atoms = its.getConnectedAtomsList(its.getAtom(pos));
	int numHs = 0;
	for(IAtom atom : atoms)
		if(atom.getSymbol().equals("H")) numHs++;
	return numHs;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:8,代码来源:SDFDeuteriumGeneration.java

示例6: getNumberExplicitRealHydrogens

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static int getNumberExplicitRealHydrogens(IAtomContainer its, int pos) {
	java.util.List<IAtom> atoms = its.getConnectedAtomsList(its.getAtom(pos));
	int numHs = 0;
	for(IAtom atom : atoms)
		if(atom.getSymbol().equals("H") && (atom.getMassNumber() == null || atom.getMassNumber() == 1)) numHs++;
	return numHs;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:8,代码来源:SDFDeuteriumGeneration.java

示例7: getNumberExplicitDeuteriums

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static int getNumberExplicitDeuteriums(IAtomContainer its, int pos) {
	java.util.List<IAtom> atoms = its.getConnectedAtomsList(its.getAtom(pos));
	int numDs = 0;
	for(IAtom atom : atoms)
		if(atom.getSymbol().equals("H") && (atom.getMassNumber() != null && atom.getMassNumber() == 2)) numDs++;
	return numDs;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:8,代码来源:SDFDeuteriumGeneration.java

示例8: addExplicitDeuterium

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static boolean addExplicitDeuterium(IAtomContainer its, int pos) {
	java.util.List<IAtom> atoms = its.getConnectedAtomsList(its.getAtom(pos));
	for(IAtom atom : atoms) {
		if(atom.getSymbol().equals("H") && (atom.getMassNumber() == null || atom.getMassNumber() == 1)) {
			atom.setMassNumber(2);
			return true;
		}
	}
	return false;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:11,代码来源:SDFDeuteriumGeneration.java

示例9: setAllExplicitDeuteriums

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static int setAllExplicitDeuteriums(IAtomContainer its, int pos) {
	java.util.List<IAtom> atoms = its.getConnectedAtomsList(its.getAtom(pos));
	int exchanged = 0;
	for(IAtom atom : atoms)
		if(atom.getSymbol().equals("H") && (atom.getMassNumber() == null || atom.getMassNumber() == 1)) {
			atom.setMassNumber(2);
			exchanged++;
		}
	return exchanged;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:11,代码来源:SDFDeuteriumGeneration.java

示例10: isCOOHPOOHSOOHGroup

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
private boolean isCOOHPOOHSOOHGroup(IAtom a, IAtomContainer mol) {
	int falseNeighbor = 0;
	boolean doubleBondSeen = false;
	boolean singleBondSeen = false;
	boolean hydrogenSeen = false;

	for (final IAtom n : mol.getConnectedAtomsList(a)) {
		if (!n.getAtomicNumber().equals(8)) {
			if (falseNeighbor == 1) {
				return false;
			} else {
				falseNeighbor++;
			}
		} else {
			// Oxygen neighbor check bond type
			final IBond b = mol.getBond(a, n);
			if (b.getOrder().equals(IBond.Order.SINGLE)) {
				if (!singleBondSeen) {
					singleBondSeen = true;
					if (n.getImplicitHydrogenCount() > 0)
						hydrogenSeen = true;
				} else {
					return false;
				}
			} else if (b.getOrder().equals(IBond.Order.DOUBLE)) {
				if (!doubleBondSeen) {
					doubleBondSeen = true;
				} else {
					return false;
				}
			}
		}
	}
	if (doubleBondSeen && singleBondSeen && hydrogenSeen) {
		return true;
	} else {
		return false;
	}
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:40,代码来源:PharmacophorePointAssigner.java

示例11: neighborsCarbonAtom

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * This method performs the limited DFS search at an carbon atom a. The
 * method returns true if all adjacent atoms are carbons.
 * 
 * @param mol
 *            - IAtomContainer
 * @param a
 *            - IAtom Root atom for the neighbor check
 * @return boolean - True if all neighbors of a are carbon atoms, otherwise
 *         false
 */
private boolean neighborsCarbonAtom(IAtomContainer mol, IAtom a) {
	for (final IAtom n : mol.getConnectedAtomsList(a)) {
		// Ignore hydrogen atoms
		if (n.getAtomicNumber() == 1) {
			continue;
		}
		if (n.getAtomicNumber() != 6) {
			return false;
		}
	}
	return true;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:24,代码来源:PharmacophorePointAssigner.java

示例12: isStartOfDoubleBond

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 *  Says if an atom is the start of a double bond configuration
 *
 *@param  a                        The atom which is the start of configuration
 *@param  container                The atomContainer the atom is in
 *@param  parent                   The atom we came from
 *@param  doubleBondConfiguration  The array indicating where double bond
 *      configurations are specified (this method ensures that there is
 *      actually the possibility of a double bond configuration)
 *@return                          false=is not start of configuration, true=is
 */
private boolean isStartOfDoubleBond(IAtomContainer container, IAtom a, IAtom parent, boolean[] doubleBondConfiguration)
{
	// TO-DO: We make the silent assumption of unset hydrogen count equals zero hydrogen count here.
	int lengthAtom = container.getConnectedAtomsCount(a) + ((a.getImplicitHydrogenCount() == CDKConstants.UNSET) ? 0 : a.getImplicitHydrogenCount());
	if (lengthAtom != 3 && (lengthAtom != 2 && !a.getSymbol().equals("N")))
	{
		return (false);
	}
	List<IAtom> atoms = container.getConnectedAtomsList(a);
	IAtom one = null;
	IAtom two = null;
	boolean doubleBond = false;
	IAtom nextAtom = null;
       for (IAtom atomi : atoms) {
           if (atomi != parent && container.getBond(atomi, a).getOrder() == CDKConstants.BONDORDER_DOUBLE && isEndOfDoubleBond(container, atomi, a, doubleBondConfiguration)) {
               doubleBond = true;
               nextAtom = atomi;
           }
           if (atomi != nextAtom && one == null) {
               one = atomi;
           } else if (atomi != nextAtom && one != null) {
               two = atomi;
           }
       }
	String[] morgannumbers = MorganNumbersTools.getMorganNumbersWithElementSymbol(container);
	if (one != null && ((!a.getSymbol().equals("N") && two != null && !morgannumbers[container.getAtomNumber(one)].equals(morgannumbers[container.getAtomNumber(two)]) && doubleBond && doubleBondConfiguration[container.getBondNumber(a, nextAtom)]) || (doubleBond && a.getSymbol().equals("N") && Math.abs(BondTools.giveAngleBothMethods(nextAtom, a, parent, true)) > Math.PI / 10)))
	{
		return (true);
	} else
	{
		return (false);
	}
}
 
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:45,代码来源:SmilesGenerator.java


注:本文中的org.openscience.cdk.interfaces.IAtomContainer.getConnectedAtomsList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。