Search in sources :

Example 11 with BondMapping

use of algorithms.isomorphism.chains.Extension.BondMapping in project Smiles2Monomers by yoann-dufresne.

the class ChainLearning method initLearn.

// -------------------------------- Initialization ----------------------------------
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();
}
Also used : Residue(model.Residue) ArrayList(java.util.ArrayList) IBond(org.openscience.cdk.interfaces.IBond) BondMapping(algorithms.isomorphism.chains.Extension.BondMapping)

Aggregations

BondMapping (algorithms.isomorphism.chains.Extension.BondMapping)11 Extension (algorithms.isomorphism.chains.Extension)8 Test (org.junit.Test)8 ArrayList (java.util.ArrayList)3 IBond (org.openscience.cdk.interfaces.IBond)3 Chain (algorithms.isomorphism.chains.Chain)2 MappedChain (algorithms.isomorphism.chains.MappedChain)2 HashMap (java.util.HashMap)2 IMolecule (org.openscience.cdk.interfaces.IMolecule)2 ChemicalObject (model.ChemicalObject)1 Residue (model.Residue)1 IAtom (org.openscience.cdk.interfaces.IAtom)1