• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IBond类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



IBond类属于org.openscience.cdk.interfaces包,在下文中一共展示了IBond类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:22,代码来源:DefaultBitArrayFragment.java


示例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;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:19,代码来源:DefaultBitArrayFragment.java


示例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);
		}
	}
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:19,代码来源:BitArrayPrecursor.java


示例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;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:25,代码来源:InChIDeuteriumGeneration.java


示例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;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:24,代码来源:Encoding2DECFP.java


示例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;
}
 
开发者ID:fortiema,项目名称:jCompoundMapper,代码行数:17,代码来源:ECFPFeature.java


示例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;
}
 
开发者ID:cdk,项目名称:depict,代码行数:18,代码来源:DepictController.java


示例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);
	}
}
 
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:32,代码来源:SmilesGenerator.java


示例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);
	}
 
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:19,代码来源:SmilesGenerator.java


示例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");
	}
}
 
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:33,代码来源:SmilesGenerator.java


示例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();
}
 
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:24,代码来源:ChainLearning.java


示例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);
}
 
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:18,代码来源:ChainLearning.java


示例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;
}
 
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:27,代码来源:ChainLearning.java


示例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;
}
 
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:19,代码来源:Extension.java


示例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");
}
 
开发者ID:yoann-dufresne,项目名称:Smiles2Monomers,代码行数:22,代码来源:IsomorphismTests.java


示例16: process

import org.openscience.cdk.interfaces.IBond; //导入依赖的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


示例17: highlightSmartsPattern

import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
private static void highlightSmartsPattern(IAtomContainer container, Color highlightColor, String smarts) {
    if (smarts == null)
        return;
    try {
        Pattern ptrn = SmartsPattern.create(smarts,
                                            SilentChemObjectBuilder.getInstance());
        Mappings mappings = ptrn.matchAll(container);

        int[] p = mappings.first();
        for (int x : p) {
            container.getAtom(x).setProperty(HIGHLIGHT_COLOR,
                                             highlightColor);
        }
        for (IBond bond : container.bonds()) {
            if (bond.getAtom(0).getProperty(HIGHLIGHT_COLOR) != null && bond.getAtom(1).getProperty(HIGHLIGHT_COLOR) != null)
                bond.setProperty(HIGHLIGHT_COLOR,
                                 highlightColor);
        }
    } catch (IOException e) {
        System.err.println(e.getMessage());
    }
}
 
开发者ID:johnmay,项目名称:efficient-bits,代码行数:23,代码来源:Main.java


示例18: setScale

import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
private void setScale(IAtomContainerSet set) {
    List<Double> lengths = new ArrayList<Double>();
    for (IAtomContainer container : set.atomContainers()) {
        for (IBond bond : container.bonds()) {
            lengths.add(GeometryUtil.getLength2D(bond));
        }
    }

    if (lengths.size() == 0) {
        setScaleForBondLength(0.826);
    }
    else {
        // median
        setScaleForBondLength(lengths.get(lengths.size() / 2));
    }
}
 
开发者ID:johnmay,项目名称:efficient-bits,代码行数:17,代码来源:DepictionGenerator.java


示例19: MolStruct

import org.openscience.cdk.interfaces.IBond; //导入依赖的package包/类
public MolStruct( IAtomContainer base )
{	
	super( new AtomContainer(AtomContainerManipulator.removeHydrogens(base)) );
	mol_ids = new HashSet<PubchemID>();
	
	Iterator<IAtom> atoms = this.atoms().iterator();
	while( atoms.hasNext() ){
		IAtom atom = atoms.next();
		atom.setAtomTypeName("S");
		atom.setSymbol("C");
	}
	Iterator<IBond> bonds = this.bonds().iterator();
	while( bonds.hasNext() ){
		IBond bond = bonds.next();
		bond.setOrder(IBond.Order.SINGLE);
	}
	
	makeGraph(this);

	setFingerprint();
	
	PubchemID pubID = MolUtils.getPubID(base);
	this.mol_ids.add( pubID);
	this.setProperty("PUBCHEM_COMPOUND_CID", pubID.toString());
}
 
开发者ID:ndaniels,项目名称:Ammolite,代码行数:26,代码来源:MolStruct.java


示例20: makeGraph

import org.openscience.cdk.interfaces.IBond; //导入依赖的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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StrongUuidGenerator类代码示例发布时间:2022-05-22
下一篇:
Java RpcAuthInfo类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap