Search in sources :

Example 16 with Monomer

use of model.Monomer in project Smiles2Monomers by yoann-dufresne.

the class FamilyDB method addObject.

@Override
public void addObject(String id, Family f) {
    Family prev = null;
    for (Monomer m : f.getMonomers()) if (this.database.containsKey(m.getId())) {
        prev = this.database.get(m.getId());
        break;
    }
    if (prev == null) {
        for (Monomer m : f.getMonomers()) {
            super.addObject(m.getId(), f);
            this.uniqFamilies.add(f);
        }
    } else {
        for (Monomer m : f.getMonomers()) {
            prev.addMonomer(m);
            this.database.put(m.getId(), prev);
        }
        for (Residue res : f.getResidues()) prev.addResidue(res);
        for (Link l : f.getDepandances()) prev.addDependance(l);
    }
}
Also used : Residue(model.Residue) Family(model.Family) Monomer(model.Monomer) Link(model.Family.Link)

Aggregations

Monomer (model.Monomer)16 Residue (model.Residue)6 ArrayList (java.util.ArrayList)5 Family (model.Family)5 HashMap (java.util.HashMap)4 JSONArray (org.json.simple.JSONArray)4 JSONObject (org.json.simple.JSONObject)4 Polymer (model.Polymer)3 InvalidSmilesException (org.openscience.cdk.exception.InvalidSmilesException)3 MonomersDB (db.MonomersDB)2 Rule (model.Rule)2 MonomerGraph (model.graph.MonomerGraph)2 MonomerLinks (model.graph.MonomerGraph.MonomerLinks)2 Before (org.junit.Before)2 IAtom (org.openscience.cdk.interfaces.IAtom)2 IMolecule (org.openscience.cdk.interfaces.IMolecule)2 ResidueCreator (algorithms.ResidueCreator)1 Chain (algorithms.isomorphism.chains.Chain)1 Extension (algorithms.isomorphism.chains.Extension)1 MappedChain (algorithms.isomorphism.chains.MappedChain)1