本文整理汇总了Java中org.openscience.cdk.interfaces.IAtom类的典型用法代码示例。如果您正苦于以下问题:Java IAtom类的具体用法?Java IAtom怎么用?Java IAtom使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAtom类属于org.openscience.cdk.interfaces包,在下文中一共展示了IAtom类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getStructureAsAromaticIAtomContainer
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
public IAtomContainer getStructureAsAromaticIAtomContainer() {
IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
IAtomContainer fragmentStructure = builder.newInstance(IAtomContainer.class);
for(int i = 0; i < this.bondsBitArray.getSize(); i++) {
if(this.bondsBitArray.get(i)) {
IBond curBond = this.precursorMolecule.getStructureAsIAtomContainer().getBond(i);
if(this.precursorMolecule.isAromaticBond(i)) curBond.setIsAromatic(true);
for(IAtom atom : curBond.atoms()) {
atom.setImplicitHydrogenCount(0);
if(this.precursorMolecule.isAromaticBond(i)) atom.setIsAromatic(true);
fragmentStructure.addAtom(atom);
}
fragmentStructure.addBond(curBond);
}
}
// loss of hydrogens
// MoleculeFunctions.prepareAtomContainer(fragmentStructure);
return fragmentStructure;
}
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:22,代码来源:DefaultBitArrayFragment.java
示例2: getStructureAsIAtomContainer
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
public IAtomContainer getStructureAsIAtomContainer() {
IChemObjectBuilder builder = DefaultChemObjectBuilder.getInstance();
IAtomContainer fragmentStructure = builder.newInstance(IAtomContainer.class);
for(int i = 0; i < this.bondsBitArray.getSize(); i++) {
if(this.bondsBitArray.get(i)) {
IBond curBond = this.precursorMolecule.getStructureAsIAtomContainer().getBond(i);
for(IAtom atom : curBond.atoms()) {
fragmentStructure.addAtom(atom);
}
fragmentStructure.addBond(curBond);
}
}
// loss of hydrogens
// MoleculeFunctions.prepareAtomContainer(fragmentStructure);
return fragmentStructure;
}
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:19,代码来源:DefaultBitArrayFragment.java
示例3: determineCarbonAtomStatistics
import org.openscience.cdk.interfaces.IAtom; //导入依赖的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: getAtomContainerFromSMILES
import org.openscience.cdk.interfaces.IAtom; //导入依赖的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
示例5: removeHydrogens
import org.openscience.cdk.interfaces.IAtom; //导入依赖的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
示例6: getFingerprint
import org.openscience.cdk.interfaces.IAtom; //导入依赖的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
示例7: getCorrectness
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
public double getCorrectness(FamilyDB families) {
if (!this.alreadyCalculate)
this.calculateGreedyCoverage();
if (this.corrects == null)
this.calculateCorrectIncorrectNotFound(families);
int pepAtoms = 0;
for (@SuppressWarnings("unused") IAtom a : this.co.getMolecule().atoms())
pepAtoms++;
int corAtoms = 0;
for (Residue res : this.corrects.keySet()) {
int resAtoms = res.getMolecule().getAtomCount();
corAtoms += resAtoms * this.corrects.get(res);
}
double ratio = new Double(corAtoms) / new Double(pepAtoms);
return ratio;
}
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:21,代码来源:Coverage.java
示例8: initMappingTest
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
@Test
public void initMappingTest() {
List<MappedChain> mbs = Isomorphism.searchFromPreviousMapping(this.mb0, this.ext1, MatchingType.STRONG);
if (mbs.size() != 2)
fail("2 matches needed");
boolean isGood = true;
for (MappedChain mb : mbs) {
IMolecule mol = mb.getChemObject().getMolecule();
IAtom a1 = (mol.getAtom(mb.getAtomsMapping().get(0)));
IAtom a2 = (mol.getAtom(mb.getAtomsMapping().get(1)));
if (!((a1.getSymbol().equals("C") && a2.getSymbol().equals("S")) ||
(a1.getSymbol().equals("S") && a2.getSymbol().equals("C"))))
isGood = false;
}
Assert.assertTrue(isGood);
}
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:19,代码来源:IsomorphismTests.java
示例9: calculateFingerprint
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
private void calculateFingerprint(IAtomContainer ac) throws FingerPrinterException, MoltyperException,CDKException{
this.iteration=0;
this.completeFeatures=new ArrayList<IFeature>();
this.molecule=ac;
this.featuresOfLastIteration = new HashMap<IAtom,ECFPFeature>();
computeInitialIdentifiers();
for(int i=0;i<this.getSearchDepth();i++){
iteration++;
computeIteration();
}
// wegner: this is still ugly, I would prefer the molecule is persistent within this object, which it is only
// for the lifetime of a calculateFingerprint function call, very strange design, and not in a good way.
// Anyway, workaround is to pass a molecule object along to the ECFPFeature as workaround.
this.featuresOfLastIteration=null;
this.molecule=null;
}
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:20,代码来源:Encoding2DECFP.java
示例10: computeIterationForAtom
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
private ECFPFeature computeIterationForAtom(IAtom atom) throws FingerPrinterException, MoltyperException{
ECFPFeature oldFeature = featuresOfLastIteration.get(atom);
IAtomContainer newSubstructure = oldFeature.getNonDeepCloneOfSubstructure();
List<BondOrderIdentifierTupel> connectivity = new ArrayList<BondOrderIdentifierTupel>();
for(IAtom connectedAtom: molecule.getConnectedAtomsList(atom)){
int identifierOfConnectedAtom = featuresOfLastIteration.get(connectedAtom).hashCode();
//System.out.println("iterate "+connectedAtom.getAtomTypeName()+",id="+identifierOfConnectedAtom+",id="+featuresOfLastIteration.get(connectedAtom).featureToString(true));
connectivity.add(new BondOrderIdentifierTupel(this.getBondOrder(molecule.getBond(atom,connectedAtom)),identifierOfConnectedAtom));
IAtomContainer structure = this.featuresOfLastIteration.get(connectedAtom).representedSubstructure();
for(IAtom a: structure.atoms()){
if(!newSubstructure.contains(a))
newSubstructure.addAtom(a);
}
for(IBond b: structure.bonds()){
if(!newSubstructure.contains(b))
newSubstructure.addBond(b);
}
}
ECFPFeature newFeature = new ECFPFeature(this, molecule, atom, newSubstructure, this.iteration,oldFeature.hashCode(), connectivity);
return newFeature;
}
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:24,代码来源:Encoding2DECFP.java
示例11: linksLoadingTest
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
@Test
public void linksLoadingTest () {
ResidueJsonLoader rjl = new ResidueJsonLoader(this.rules, this.monos);
rjl.saveFile(this.families, "tmp.json");
Residue.resetResidues();
FamilyDB loaded = rjl.loadFile("tmp.json");
new File("tmp.json").delete();
Family famTyr = null;
try {
famTyr = loaded.getObject("Tyr");
} catch (NullPointerException e) {
e.printStackTrace();
}
Residue tyrN = null;
for (Residue res : famTyr.getResidues())
if ("Tyr_pepN".equals(res.getName())) {
tyrN = res;
break;
}
Entry<IAtom, Rule> entry = tyrN.getAtomicLinks().entrySet().iterator().next();
IAtom a = entry.getKey();
Assert.assertEquals(a.getSymbol(), "N");
}
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:27,代码来源:ResidueCreatorTests.java
示例12: ECFPFeature
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
public ECFPFeature(EncodingFingerprint encodingFingerprint, IAtomContainer parentMolecule, IAtom coreAtom, IAtomContainer substructure, int iterationNumber, int parent, List<BondOrderIdentifierTupel> connections) {
this.substructure = substructure;
this.coreAtom = coreAtom;
this.iterationNumber = iterationNumber;
this.parent = parent;
this.connections = connections;
this.encodingFingerprint=encodingFingerprint;
this.parentMolecule = parentMolecule;
//needs to be the last function call in the constructor
this.feature=0;
try {
this.feature=computeFeatureHash();
} catch (MoltyperException e) {
//silently do nothing
}
}
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:18,代码来源:ECFPFeature.java
示例13: extractSubstructure
import org.openscience.cdk.interfaces.IAtom; //导入依赖的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
示例14: getAllShortestPath
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
/**
* returns the set of all shortest path between two nodes
*
* @param ac
* @param start
* @param end
* @param distance
* @return
*/
private List<PathFeature> getAllShortestPath(IAtomContainer ac, Atom start, Atom end, int distance) {
final ArrayList<List<IAtom>> pathlist = (ArrayList<List<IAtom>>) PathTools.getPathsOfLength(ac, start, distance);
final ArrayList<PathFeature> features = new ArrayList<PathFeature>();
for (int i = 0; i < pathlist.size(); i++) {
int listSize = pathlist.get(i).size();
IAtom endAtom = pathlist.get(i).get(listSize - 1);
// if this path has the shortest distance possible and it ends with
// the target atom, add the feature
if (((distance + 1) == pathlist.get(i).size()) && endAtom.equals(end)) {
final PathFeature feature = new PathFeature(pathlist.get(i), ac);
features.add(feature);
}
}
return features;
}
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:25,代码来源:Encoding2DAllShortestPath.java
示例15: MappingTest
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
@Test
public void MappingTest () {
List<MappedChain> mbs = Isomorphism.searchFromPreviousMapping(this.mb0, this.ext1, MatchingType.STRONG);
boolean isGood = true;
for (MappedChain mb : mbs) {
List<MappedChain> extendedMbs = Isomorphism.searchFromPreviousMapping(mb, this.ext2, MatchingType.STRONG);
MappedChain newMb = extendedMbs.get(0);
IMolecule mol = mb.getChemObject().getMolecule();
IAtom newA = (mol.getAtom(newMb.getAtomsMapping().get(2)));
if (!(
(newMb.getAtomsMapping().get(0) == mb.getAtomsMapping().get(0)) && // Same first atom
(newMb.getAtomsMapping().get(1) == mb.getAtomsMapping().get(1)) && // Same second atom
(newA.getSymbol().equals("C")) // Extended by C atom
))
isGood = false;
}
Assert.assertTrue(isGood);
}
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:23,代码来源:IsomorphismTests.java
示例16: lipophilicCarbonAnnotation
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
private void lipophilicCarbonAnnotation(HashMap<Integer, Vector<PotentialPharmacophorePoint>> PPPAssignment,
IAtomContainer mol) {
// First create the PPP object
final PotentialPharmacophorePoint ppp = new PotentialPharmacophorePoint("L", "No SMARTS available",
"Carbon atoms only adjacent to carbon atoms");
for (final IAtom a : mol.atoms()) {
if (a.getAtomicNumber() == 6) {
// Check if all neighbors are carbon atoms
if (this.neighborsCarbonAtom(mol, a)) {
// Append entry to the HashMap
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
示例17: negativeCOOHPOOHSOOHDetection
import org.openscience.cdk.interfaces.IAtom; //导入依赖的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
示例18: getDaylightInvariantRing
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
/**
* Daylight Invariant + Ring as Atom Label:
* Symbol.#Heavyneighbours.valence-hydrogens.mass.charge.#hydrogens.InRing
* e.g. 12.2.3.mass.0.1.1
*/
public static String getDaylightInvariantRing(IAtom atom) {
final int numberOfHydrogens = getHydrogenCount(atom);
final int numberOfNeighbors = getFormalneighbourCount(atom);
final int valency = getValency(atom);
final StringBuffer label = new StringBuffer();
label.append(atom.getAtomicNumber());
label.append("." + (numberOfNeighbors - numberOfHydrogens));
label.append("." + (valency - numberOfHydrogens));
label.append("." + (atom.getMassNumber()));
label.append("." + (atom.getFormalCharge()));
label.append("." + (numberOfHydrogens));
if (atom.getFlag(CDKConstants.ISINRING)) {
label.append(".1");
} else {
label.append(".0");
}
return label.toString();
}
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:27,代码来源:ExtendedAtomAndBondTyper.java
示例19: getElementNeighborRingType
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
/**
* returns the element plus neighbor count type plus ring information
*
* @param atom
* @return
*/
public static String getElementNeighborRingType(IAtom atom) {
String type = getAtomSymbol(atom);
Integer formalNeighbourCount = getFormalneighbourCount(atom);
Integer hydrogenCount = getHydrogenCount(atom);
try {
if (atom.getFlag(CDKConstants.ISAROMATIC)) {
type = type + ".a." + (formalNeighbourCount - hydrogenCount);
} else if (atom.getFlag(CDKConstants.ISINRING)) {
type = type + ".r." + (formalNeighbourCount - hydrogenCount);
} else {
type = type + "." + (formalNeighbourCount - hydrogenCount);
}
} catch (final Exception e) {
e.printStackTrace();
}
return type;
}
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:26,代码来源:ExtendedAtomAndBondTyper.java
示例20: fillLinksJSO
import org.openscience.cdk.interfaces.IAtom; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private String fillLinksJSO(JSONArray links, Residue res) {
IMolecule mol = res.getMolecule();
AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol);
String smiles = SmilesConverter.conv.mol2Smiles(mol, false);
List<IAtom> order = SmilesConverter.conv.getOrder();
for (IAtom a : res.getAtomicLinks().keySet()) {
JSONObject jso = new JSONObject();
Rule rule = res.getAtomicLinks().get(a);
jso.put("name", rule.getName());
jso.put("atom", order.indexOf(a));
links.add(jso);
}
AtomContainerManipulator.removeHydrogens(mol);
return smiles;
}
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:19,代码来源:ResidueJsonLoader.java
注:本文中的org.openscience.cdk.interfaces.IAtom类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论