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


Java IAtomContainer.getAtom方法代码示例

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


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

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

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

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

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

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

示例6: determineNitrogenAtomStatistics

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static void determineNitrogenAtomStatistics(IAtomContainer mol, ICandidate candidate, java.util.Vector<Integer> aromaticAtomIndexes) {
	int numberN = 0;
	int numberNH = 0;
	int numberNHH = 0;
	int aromaticNH = 0;
	int aromaticN = 0;
	
	for(int i = 0; i < mol.getAtomCount(); i++) {
		IAtom atom = mol.getAtom(i);
		if(atom.getSymbol().equals("N")) {
			numberN++;
			int hydrogens = atom.getImplicitHydrogenCount();
			if(aromaticAtomIndexes.contains(i)) {
				if(hydrogens == 0) aromaticN++;
				else if(hydrogens == 1) aromaticNH++;
				else System.err.println("Somthing wrong with aromatic N and " + candidate.getProperty("Identifier"));
			}
			else {
				if(hydrogens == 0) continue;
				else if(hydrogens == 1) numberNH++;
				else if(hydrogens == 2) numberNHH++;
				else System.err.println("Somthing wrong with aliphatic N and " + candidate.getProperty("Identifier"));
			}
		}
	}
	
	candidate.setProperty("#N", numberN);
	candidate.setProperty("#NHonly", numberNH);
	candidate.setProperty("#NH2", numberNHH);
	candidate.setProperty("#aromaticNH", aromaticNH);
	candidate.setProperty("#aromaticN", aromaticN);		
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:33,代码来源:CalculateAtomStatistics.java

示例7: getFingerprint

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
@Override
public List<IFeature> getFingerprint(IAtomContainer ac) {
	final int[][] admat = AdjacencyMatrix.getMatrix(ac);
	final int[][] shortest_path = PathTools.computeFloydAPSP(admat);
	final List<PathFeature> allShortestPaths = new ArrayList<PathFeature>();

	for (int i = 0; i < ac.getAtomCount(); i++) {
		final Atom start = (Atom) ac.getAtom(i);
		// we may skip the other half of the matrix because we generate a
		// canonical features afterwards
		for (int j = i; j < ac.getAtomCount(); j++) {
			if (i == j) {
				continue;
			}
			final Atom end = (Atom) ac.getAtom(j);
			if (shortest_path[i][j] <= super.getSearchDepth()) {
				final List<PathFeature> allShortestPathsIndex = getAllShortestPath(ac, start, end,
						shortest_path[i][j]);
				allShortestPaths.addAll(allShortestPathsIndex);
			}
		}
	}

	final ArrayList<IFeature> fingerprint = new ArrayList<IFeature>();
	for (int i = 0; i < allShortestPaths.size(); i++) {
		final String string = allShortestPaths.get(i).toString();
		final NumericStringFeature feature = new NumericStringFeature(string, 1.0);
		fingerprint.add(feature);
	}

	return fingerprint;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:33,代码来源:Encoding2DAllShortestPath.java

示例8: getBondRefs

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static BondRef[] getBondRefs(IAtomContainer mol) {

        final int numAtoms = mol.getAtomCount();
        final int numBonds = mol.getBondCount();
        BondRef[] bonds    = new BondRef[numBonds];

        final Map<IAtom, AtomRef> atomCache = new IdentityHashMap<>(mol.getAtomCount());

        for (int i = 0; i < numAtoms; i++) {
            final IAtom atom = mol.getAtom(i);
            final AtomRef atomrf = new AtomRef(i,
                                               atom,
                                               new ArrayList<BondRef>());
            atomCache.put(atomrf.atom, atomrf);
        }
        for (int i = 0; i < numBonds; i++) {
            final IBond   bond    = mol.getBond(i);
            AtomRef       beg     = atomCache.get(bond.getAtom(0));
            AtomRef       end     = atomCache.get(bond.getAtom(1));
            final BondRef bondref = new BondRef(bond, i, beg, end);
            beg.bonds.add(bondref);
            end.bonds.add(bondref);
            bonds[i] = bondref;
        }

        return bonds;
    }
 
开发者ID:johnmay,项目名称:efficient-bits,代码行数:28,代码来源:BondRef.java

示例9: getAtomRefs

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
public static AtomRef[] getAtomRefs(IAtomContainer mol) {

        final int numAtoms = mol.getAtomCount();
        final int numBonds = mol.getBondCount();
        AtomRef[] atoms    = new AtomRef[numAtoms];

        final Map<IAtom, AtomRef> atomCache = new IdentityHashMap<>(mol.getAtomCount());

        for (int i = 0; i < numAtoms; i++) {
            final IAtom atom = mol.getAtom(i);
            final AtomRef atomrf = new AtomRef(i,
                                               atom,
                                               new ArrayList<BondRef>());
            atomCache.put(atomrf.atom, atomrf);
            atoms[i] = atomrf;
        }
        for (int i = 0; i < numBonds; i++) {
            final IBond   bond    = mol.getBond(i);
            AtomRef       beg     = atomCache.get(bond.getAtom(0));
            AtomRef       end     = atomCache.get(bond.getAtom(1));
            final BondRef bondref = new BondRef(bond, i, beg, end);
            beg.bonds.add(bondref);
            end.bonds.add(bondref);
        }

        return atoms;
    }
 
开发者ID:johnmay,项目名称:efficient-bits,代码行数:28,代码来源:AtomRef.java

示例10: dfs

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
private int dfs(IAtomContainer mol, int[][] adjlist, int src, int prev) {
    check++;
    IAtom atm = mol.getAtom(src);
    atm.setFlag(CDKConstants.VISITED, true);
    for (int dst : adjlist[src]) {
        if (dst == prev)
            continue;
        IAtom nbr = mol.getAtom(dst);
        if (!nbr.getFlag(CDKConstants.VISITED))
            dfs(mol, adjlist, dst, src);
    }
    return 0;
}
 
开发者ID:johnmay,项目名称:efficient-bits,代码行数:14,代码来源:Benchmark.java

示例11: getFingerprint3Point

import org.openscience.cdk.interfaces.IAtomContainer; //导入方法依赖的package包/类
/**
 * generates all possible patterns between three atoms
 * 
 * @param ac
 * @param matrix
 * @param distanceCutoff
 * @param typer
 * @return
 */
public List<IFeature> getFingerprint3Point(IAtomContainer ac, int[][] matrix, int distanceCutoff,
		ExtendedAtomAndBondTyper typer) {
	final ArrayList<IFeature> features = new ArrayList<IFeature>();

	for (int i = 0; i < matrix.length; i++) {
		for (int j = 0; j < matrix.length; j++) {
			if (i == j) {
				continue;
			}
			if (matrix[i][j] > distanceCutoff) {
				continue;
			}

			for (int k = 0; k < matrix.length; k++) {
				if ((i == k) || (j == k)) {
					continue;
				}
				if (matrix[j][k] > distanceCutoff) {
					continue;
				}
				if (matrix[k][i] > distanceCutoff) {
					continue;
				}

				final StringBuffer sb = new StringBuffer();
				final IAtom atomA = ac.getAtom(i);
				final IAtom atomB = ac.getAtom(j);
				final IAtom atomC = ac.getAtom(k);

				try {
					sb.append(typer.getAtomLabel(atomA));
					sb.append("-");
					sb.append(matrix[i][j]);
					sb.append("-");
					sb.append(typer.getAtomLabel(atomB));
					sb.append("-");
					sb.append(matrix[j][k]);
					sb.append("-");
					sb.append(typer.getAtomLabel(atomC));
					sb.append("-");
					sb.append(matrix[k][i]);
				} catch (final MoltyperException e) {
					e.printStackTrace();
				}

				final NumericStringFeature feature = new NumericStringFeature(sb.toString(), 1.0);
				features.add(feature);
			}
		}
	}
	return features;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:62,代码来源:CombinatorialPatternHelper.java


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