本文整理汇总了Java中org.openscience.cdk.interfaces.IBond类的典型用法代码示例。如果您正苦于以下问题:Java IBond类的具体用法?Java IBond怎么用?Java IBond使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IBond类属于org.openscience.cdk.interfaces包,在下文中一共展示了IBond类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getStructureAsAromaticIAtomContainer
import org.openscience.cdk.interfaces.IBond; //导入依赖的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;
}
示例2: getStructureAsIAtomContainer
import org.openscience.cdk.interfaces.IBond; //导入依赖的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;
}
示例3: initialiseRingBondsBitArray
import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
/**
* initialise indeces belonging to a ring in the precursor molecule
*/
protected void initialiseRingBondsBitArray() throws Exception {
this.aromaticBonds = new BitArray(this.getNonHydrogenBondCount());
AllRingsFinder allRingsFinder = new AllRingsFinder();
IRingSet ringSet = allRingsFinder.findAllRings(this.precursorMolecule);
this.initialiseRingBondToBelongingRingBondIndecesBitArrays(ringSet);
if (ringSet.getAtomContainerCount() != 0) {
Aromaticity arom = new Aromaticity(ElectronDonation.cdk(), Cycles.cdkAromaticSet());
java.util.Set<IBond> aromaticBonds = arom.findBonds(this.precursorMolecule);
java.util.Iterator<IBond> it = aromaticBonds.iterator();
while(it.hasNext()) {
IBond currentBond = it.next();
this.aromaticBonds.set(this.precursorMolecule.getBondNumber(currentBond), true);
}
}
}
示例4: getAromaticAtoms
import org.openscience.cdk.interfaces.IBond; //导入依赖的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;
}
示例5: computeIterationForAtom
import org.openscience.cdk.interfaces.IBond; //导入依赖的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;
}
示例6: detectDanglingBonds
import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
private ArrayList<DanglingBond> detectDanglingBonds(){
ArrayList<DanglingBond> danglingBonds = new ArrayList<DanglingBond>();
try{
for(IBond bond: substructure.bonds()){
if(!substructure.contains(bond.getAtom(0))){
danglingBonds.add(new DanglingBond(bond, bond.getAtom(0)));
continue;
}if(!substructure.contains(bond.getAtom(1)))
danglingBonds.add(new DanglingBond(bond, bond.getAtom(1)));
}
}catch(FingerPrinterException e){
e.printStackTrace();
return null;
}
return danglingBonds;
}
示例7: shouldAddH
import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
private boolean shouldAddH(IAtomContainer mol, IAtom atom, Iterable<IBond> bonds) {
int count = 0;
for (IBond bond : bonds) {
if (bond.isInRing()) {
++count;
} else {
IAtom nbr = bond.getOther(atom);
for (IStereoElement se : mol.stereoElements()) {
if (se.getConfigClass() == IStereoElement.TH &&
se.getFocus().equals(nbr)) {
count++;
}
}
}
}
return count == 3;
}
示例8: isValidDoubleBondConfiguration
import org.openscience.cdk.interfaces.IBond; //导入依赖的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);
}
}
示例9: hasWedges
import org.openscience.cdk.interfaces.IBond; //导入依赖的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);
}
示例10: parseBond
import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
/**
* Append the symbol for the bond order between <code>a1</code> and <code>a2</code>
* to the <code>line</code>.
*
*@param line the StringBuffer that the bond symbol is appended to.
*@param a1 Atom participating in the bond.
*@param a2 Atom participating in the bond.
*@param atomContainer the AtomContainer that the SMILES string is generated
* for.
*@param useAromaticity true=aromaticity or sp2 will trigger lower case letters, wrong=only sp2
*/
private void parseBond(StringBuffer line, IAtom a1, IAtom a2, IAtomContainer atomContainer, boolean useAromaticity)
{
//logger.debug("in parseBond()");
if (useAromaticity && a1.getFlag(CDKConstants.ISAROMATIC) && a2.getFlag(CDKConstants.ISAROMATIC))
{
return;
}
if (atomContainer.getBond(a1, a2) == null)
{
return;
}
IBond.Order type = atomContainer.getBond(a1, a2).getOrder();
if (type == IBond.Order.SINGLE) {
} else if (type == IBond.Order.DOUBLE) {
line.append("=");
} else if (type == IBond.Order.TRIPLE) {
line.append("#");
} else {
// //logger.debug("Unknown bond type");
}
}
示例11: initLearn
import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
private void initLearn (List<Residue> roots, ResidueMappings mappings) {
for (Residue res : roots) {
List<MappedChain> resMappings = new ArrayList<>();
for (IBond bond : res.getMolecule().bonds()) {
Extension ext = new Extension(bond);
Chain bloc = new Chain(ext);
String smiles = bloc.getMySmiles();
this.chains.put(smiles, bloc);
this.frequence.put(smiles, 0);
// Creation of residue matchings (sequences of size 1)
for (BondMapping bm : ext.match(bond, MatchingType.EXACT)) {
MappedChain resMap = this.createMappingFromMatch(res, bond, bloc, bm);
resMappings.add(resMap);
}
}
mappings.put(res, resMappings);
}
this.frequencesInit();
}
示例12: createMappingFromMatch
import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
private MappedChain createMappingFromMatch(ChemicalObject co, IBond bond, Chain bloc, BondMapping bm) {
List<Integer> atoms = new ArrayList<>();
atoms.add(co.getMolecule().getAtomNumber(bm.a0));
atoms.add(co.getMolecule().getAtomNumber(bm.a1));
List<Integer> bonds = new ArrayList<>();
bonds.add(co.getMolecule().getBondNumber(bond));
List<MatchingType> types = new ArrayList<>();
types.add(MatchingType.EXACT);
Map<Integer, Integer> hydrogens = new HashMap<>();
hydrogens.put(co.getMolecule().getAtomNumber(bm.a0), bm.h0);
hydrogens.put(co.getMolecule().getAtomNumber(bm.a1), bm.h1);
return new MappedChain(co, bloc, atoms, bonds, types, hydrogens);
}
示例13: createBlocsFromPrevious
import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
private List<MappedChain> createBlocsFromPrevious (List<MappedChain> prevMbs) {
List<MappedChain> nextMbs = new ArrayList<>();
for (MappedChain mb : prevMbs) {
ChemicalObject co = mb.getChemObject();
IMolecule mol = co.getMolecule();
List<Integer> neighbors = mb.getNeighborsBonds(mol);
// Create a new bloc for each neighbor
for (int idx : neighbors) {
// Create bloc
IBond nb = mol.getBond(idx);
Extension ext = new Extension(nb);
//Extension.setAromacityTest(false);
List<MappedChain> newMbs = Isomorphism.searchFromPreviousMapping (mb, ext, MatchingType.EXACT);
//Extension.setAromacityTest(true);
nextMbs.addAll(newMbs);
}
}
return nextMbs;
}
示例14: lightToStrongMatching
import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
private boolean lightToStrongMatching (IAtom a1, IAtom a2, int ha1, int ha2,
IAtom b1, IAtom b2, int hb1, int hb2,
IBond l1, IBond l2) {
// Aromatic matching
if (a1.getFlag(CDKConstants.ISAROMATIC) != b1.getFlag(CDKConstants.ISAROMATIC) ||
a2.getFlag(CDKConstants.ISAROMATIC) != b2.getFlag(CDKConstants.ISAROMATIC))
return false;/**/
// Bond type
if (l1.getOrder() != l2.getOrder())
return false;
// Hydrogens
if (ha1 > hb1 || ha2 > hb2)
return false;
return true;
}
示例15: setUp
import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
// Database
Monomer[] monos = new Monomer[1];
Polymer pepTest = new Polymer(0, "malformin A1", "O=C1NC2C(=O)NC(C(=O)NC(C(=O)NC(C(=O)NC1CSSC2)C(C)CC)CC(C)C)C(C)C", monos);
// Extensions
IAtom a = new Atom("C");
IBond b1 = new Bond(new Atom("S"), a, Order.SINGLE);
this.ext1 = new Extension(b1);
a = new Atom("C");
IAtom a2 = new Atom("C");
IBond b2 = new Bond(a, a2, Order.SINGLE);
this.ext2 = new Extension(b2);
// Mapped blocs
this.mb0 = new MappedChain(pepTest, null, new ArrayList<Integer>(), new ArrayList<Integer>(), new ArrayList<MatchingType>(), new HashMap<Integer, Integer>());
// For blocs Tests
this.bloc = new Chain("S,0,c,0,0,-1,-1;c,0,c,0,0,-1,1");
}