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


Java IAtomContainer.getAtomCount方法代码示例

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


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

示例1: prepareAtomContainer

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * 
 * @param container
 * @throws CDKException 
 */
protected void prepareAtomContainer(IAtomContainer container) throws CDKException {
	while(true) {
   		try {
       		AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(container);
			Aromaticity arom = new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet());
			arom.apply(container);
   		} catch (java.lang.NullPointerException e) { 
   			//bad workaround for cdk bug?! but what shall I do...
   			//sometimes NullPointerException occurs but not in one of the further trials?!
       		continue;
       	}
   		break;
       }
       CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(container.getBuilder());
       for(int i = 0; i < container.getAtomCount(); i++) {
      		hAdder.addImplicitHydrogens(container, container.getAtom(i));
       }
       AtomContainerManipulator.convertImplicitToExplicitHydrogens(container);
       hAdder = null;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:26,代码来源:OnlinePubChemDatabaseMicha.java

示例2: getAromaticAtoms

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * 
 * @param molecule
 * @return
 */
public static BitArray getAromaticAtoms(IAtomContainer molecule) {
	Aromaticity arom = new Aromaticity(ElectronDonation.cdk(),
	Cycles.cdkAromaticSet());
	BitArray aromaticAtoms = new BitArray(molecule.getAtomCount());
	try {
		AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
		arom.apply(molecule);
		Set<IBond> aromaticBonds = arom.findBonds(molecule);
		Iterator<IBond> it = aromaticBonds.iterator();
		while(it.hasNext()) {
			IBond bond = it.next();
			for(int k = 0; k < bond.getAtomCount(); k++)
				aromaticAtoms.set(molecule.getAtomNumber(bond.getAtom(k)));
		}
	} catch (CDKException e) {
		e.printStackTrace();
	}
	return aromaticAtoms;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:25,代码来源:InChIDeuteriumGeneration.java

示例3: determineCarbonAtomStatistics

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static void determineCarbonAtomStatistics(IAtomContainer mol, ICandidate candidate, java.util.Vector<Integer> aromaticAtomIndexes) {
	int numberC = 0;
	int numberAliphaticCH = 0;
	int numberAromaticCH = 0;
	for(int i = 0; i < mol.getAtomCount(); i++) {
		IAtom atom = mol.getAtom(i);
		if(atom.getSymbol().equals("C")) {
			numberC++;
			int hydrogens = atom.getImplicitHydrogenCount();
			if(aromaticAtomIndexes.contains(i)) numberAromaticCH += hydrogens;
			else numberAliphaticCH += hydrogens;
		}
	}

	candidate.setProperty("#C", numberC);
	candidate.setProperty("#aliphaticCH", numberAliphaticCH);
	candidate.setProperty("#aromaticCH", numberAromaticCH);
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:19,代码来源:CalculateAtomStatistics.java

示例4: calculateInchiKey

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * 
 * @param con
 * @return
 * @throws CDKException
 */
public static String calculateInchiKey(IAtomContainer con) throws CDKException {
	AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(con);
       CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(con.getBuilder());
       for(int i = 0; i < con.getAtomCount(); i++) {
       	try {
       		hAdder.addImplicitHydrogens(con, con.getAtom(i));
       	} 
       	catch(CDKException e) {
       		continue;
       	}
       }
       AtomContainerManipulator.convertImplicitToExplicitHydrogens(con);
	InChIGeneratorFactory factory = InChIGeneratorFactory.getInstance();
	InChIGenerator gen = factory.getInChIGenerator(con);
	return gen.getInchiKey().split("-")[0];
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:23,代码来源:GetRankOfCandidateCSV.java

示例5: searchForDeuteriumExchangeablePositions

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * 
 * @param elementsToExchange
 * @param its
 * @return
 */
public static int[] searchForDeuteriumExchangeablePositions(
		String[] elementsToExchange, IAtomContainer its) {
	Vector<Integer> positionsToExchange = new Vector<Integer>();
	for (int i = 0; i < its.getAtomCount(); i++) {
		String symbol = its.getAtom(i).getSymbol();
		if (symbol.equals("H"))
			continue;
		for (int k = 0; k < elementsToExchange.length; k++) {
			if (symbol.equals(elementsToExchange[k])) {
				int numHs = getNumberExplicitHydrogens(its, i);
				for(int l = 0; l < numHs; l++) {
					positionsToExchange.add(i);
				}
				break;
			}
		}
	}
	int[] array = new int[positionsToExchange.size()];
	for(int i = 0; i < positionsToExchange.size(); i++) {
		array[i] = positionsToExchange.get(i);
	}
	
	return array;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:31,代码来源:SDFDeuteriumGeneration.java

示例6: 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

示例7: computeDistanceMatrix

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * computes the distance matrix of all atoms corrected by stretching factor
 * and mathematically rounded
 * 
 * @param ac
 * @return
 */
public int[][] computeDistanceMatrix(IAtomContainer ac) {
	final int dimension = ac.getAtomCount();
	final int[][] distanceMatrix = new int[dimension][dimension];
	for (int i = 0; i < dimension; i++) {
		for (int j = i; j < dimension; j++) {
			final Point3d start = ac.getAtom(i).getPoint3d();
			final Point3d end = ac.getAtom(j).getPoint3d();
			
			double distance;
			if(start == null || end == null){
				final Point2d start2d = ac.getAtom(i).getPoint2d();
				final Point2d end2d = ac.getAtom(j).getPoint2d();
				distance = Math.round(start2d.distance(end2d) * this.getStretchingFactor());					
			}else{
				distance = Math.round(start.distance(end) * this.getStretchingFactor());					
			}
			distanceMatrix[i][j] = (int) distance;
			distanceMatrix[j][i] = (int) distance;
		}
	}
	return distanceMatrix;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:30,代码来源:Encoding3D.java

示例8: getFingerprint

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
@Override
public ArrayList<IFeature> getFingerprint(IAtomContainer ac) {
	final ArrayList<IFeature> result = new ArrayList<IFeature>();
	for (int i = 0; i < ac.getAtomCount(); i++) {
		final List<List<IAtom>> lae = PathTools.getPathsOfLengthUpto(ac, ac.getAtom(i), super.getSearchDepth());
		HashMap<Integer, List<List<IAtom>>> laeMap = getFeaturesBySearchDepth(lae);
		Set<Integer> keySet = laeMap.keySet();

		for (Integer key : keySet) {
			List<String> localFragment = new ArrayList<String>();
			try {
				localFragment = this.getPaths(laeMap.get(key), ac);
			} catch (MoltyperException e) {
				e.printStackTrace();
			}
			final String shellD = localFragment.toString().replaceAll(" ", "");
			final NumericStringFeature feature = new NumericStringFeature(shellD, 1.0);
			result.add(feature);
		}
	}
	return result;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:23,代码来源:Encoding2DLocalAtomEnvironment.java

示例9: extractSubstructure

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
private static IAtomContainer extractSubstructure(
   IAtomContainer atomContainer,
   int... atomIndices
) throws CloneNotSupportedException {
   IAtomContainer substructure = (IAtomContainer) atomContainer.clone();
   int numberOfAtoms = substructure.getAtomCount();
   IAtom[] atoms = new IAtom[numberOfAtoms];
   for (int atomIndex = 0; atomIndex < numberOfAtoms; atomIndex++) {
      atoms[atomIndex] = substructure.getAtom(atomIndex);
   }
   Arrays.sort(atomIndices);
   for (int index = 0; index < numberOfAtoms; index++) {
      if (Arrays.binarySearch(atomIndices, index) < 0) {
         IAtom atom = atoms[index];
         substructure.removeAtomAndConnectedElectronContainers(atom);
      }
  }
  return substructure;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:20,代码来源:ECFPFeature.java

示例10: getFingerprint

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
@Override
public List<IFeature> getFingerprint(IAtomContainer ac) {
	final ArrayList<PathFeature> rawfingerprint = new ArrayList<PathFeature>();

	for (int i = 0; i < ac.getAtomCount(); i++) {
		final List<PathFeature> localpaths = getAllPathFeatures(ac, (Atom) ac.getAtom(i), super.getSearchDepth());
		rawfingerprint.addAll(localpaths);
	}

	final ArrayList<IFeature> fingerprint = new ArrayList<IFeature>();
	for (int i = 0; i < rawfingerprint.size(); i++) {
		final String string = rawfingerprint.get(i).toString();
		final NumericStringFeature feature = new NumericStringFeature(string, 1.0);
		fingerprint.add(feature);
	}
	return fingerprint;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:18,代码来源:Encoding2DAllPaths.java

示例11: negativeCOOHPOOHSOOHDetection

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
private void negativeCOOHPOOHSOOHDetection(HashMap<Integer, Vector<PotentialPharmacophorePoint>> PPPAssignment,
		IAtomContainer mol) {
	// Search for COOH, POOH, and SOOH groups
	final PotentialPharmacophorePoint ppp = new PotentialPharmacophorePoint("N", "no pattern",
			"carbon, sulfur, or phosphorus atom of COOH, SOOH, or POOH");
	for (int i = 0; i < mol.getAtomCount(); i++) {
		final IAtom a = mol.getAtom(i);
		if (a.getAtomicNumber().equals(6) || a.getAtomicNumber().equals(15) || a.getAtomicNumber().equals(16)) {
			// Possible starting point of group
			// Check neighbor
			if (this.isCOOHPOOHSOOHGroup(a, mol)) {
				if (!PPPAssignment.containsKey(mol.getAtomNumber(a))) {
					final Vector<PotentialPharmacophorePoint> temp = new Vector<PotentialPharmacophorePoint>();
					temp.add(ppp);
					PPPAssignment.put(mol.getAtomNumber(a), temp);
				} else {
					PPPAssignment.get(mol.getAtomNumber(a)).add(ppp);
				}
			}
		}
	}
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:23,代码来源:PharmacophorePointAssigner.java

示例12: process

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
@Override
void process(IAtomContainer mol) {
    long  t0   = System.nanoTime();
    int[] prev = new int[mol.getAtomCount()];
    int[] next = new int[mol.getAtomCount()];
    for (int i = 0; i < mol.getAtomCount(); i++) {
        next[i] = prev[i] = mol.getAtom(i).getAtomicNumber();
    }
    for (int rep = 0; rep < mol.getAtomCount(); rep++) {
        for (int j = 0; j < mol.getAtomCount(); j++) {
            IAtom atom = mol.getAtom(j);
            for (IBond bond : mol.getConnectedBondsList(atom)) {
                IAtom nbr = bond.getConnectedAtom(atom);
                next[j] += prev[mol.getAtomNumber(nbr)];
            }
        }
        System.arraycopy(next, 0, prev, 0, next.length);
    }
    long t1 = System.nanoTime();
    tRun += t1 - t0;
    for (int aNext : next) check += aNext;
}
 
开发者ID:johnmay,项目名称:efficient-bits,代码行数:23,代码来源:Benchmark.java

示例13: makeGraph

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
private void makeGraph(IAtomContainer base){
	graph = new SparseUndirectedGraph();
	for(int i=0; i<base.getAtomCount(); i++){
		graph.add(i);
		atomsToNodes.put(base.getAtom(i), i);
		nodesToAtoms.put(i, base.getAtom(i));
		for(int j=0; j<i; j++){
			IBond bond = base.getBond(base.getAtom(i), base.getAtom(j));
			if(  bond != null){
				Edge newEdge = new SimpleEdge(i,j);
				bondsToEdges.put(bond, newEdge);
				edgesToBonds.put(newEdge, bond);
				graph.add( newEdge);
			}
		}
	}
}
 
开发者ID:ndaniels,项目名称:Ammolite,代码行数:18,代码来源:MolStruct.java

示例14: containsOnlyKnownElements

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * 
 * @param molecule
 * @return
 */
protected boolean containsOnlyKnownElements(IAtomContainer molecule) {
	for(int i = 0; i < molecule.getAtomCount(); i++) {
		if(Constants.ELEMENTS.indexOf(molecule.getAtom(i).getSymbol()) == -1)
			return false;
	}
	return true;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:13,代码来源:OnlinePubChemDatabase.java

示例15: determineSulfurAtomStatistics

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static void determineSulfurAtomStatistics(IAtomContainer mol, ICandidate candidate, java.util.Vector<Integer> aromaticAtomIndexes) {
	int numberS = 0;
	int numberSH = 0;
	int numberSOO = 0;
	int numberSOOO = 0;
	int numberSOOOO = 0;
	int numberSnoH = 0;
	
	for(int i = 0; i < mol.getAtomCount(); i++) {
		IAtom atom = mol.getAtom(i);
		if(atom.getSymbol().equals("S")) {
			numberS++;
			int hydrogens = atom.getImplicitHydrogenCount();
			int oxygens = countOxygens(mol.getConnectedAtomsList(atom));
			if(oxygens == 4) numberSOOOO++;
			else if(oxygens == 3) numberSOOO++;
			else if(oxygens == 2) numberSOO++;
			else if(hydrogens == 1) numberSH++;
			else if(hydrogens == 0)  numberSnoH++;
			else System.err.println("Somthing wrong with S and " + candidate.getProperty("Identifier"));
		}
	}
	
	candidate.setProperty("#S", numberS);
	candidate.setProperty("#SH", numberSH);
	candidate.setProperty("#SO2", numberSOO);
	candidate.setProperty("#SO3", numberSOOO);
	candidate.setProperty("#SO4", numberSOOOO);	
	candidate.setProperty("#S(noH)", numberSnoH);		
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:31,代码来源:CalculateAtomStatistics.java


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