Search in sources :

Example 6 with ResidueJsonLoader

use of io.loaders.json.ResidueJsonLoader in project Smiles2Monomers by yoann-dufresne.

the class ResidueCreatorTests method linksLoadingTest.

@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");
}
Also used : Residue(model.Residue) Family(model.Family) FamilyDB(db.FamilyDB) Rule(model.Rule) ResidueJsonLoader(io.loaders.json.ResidueJsonLoader) File(java.io.File) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Example 7 with ResidueJsonLoader

use of io.loaders.json.ResidueJsonLoader in project Smiles2Monomers by yoann-dufresne.

the class LoadersTests method setUp.

@Before
public void setUp() throws Exception {
    this.jsonMonos = new MonomersJsonLoader().loadFile("data_tests/monos.json");
    this.jsonRules = RulesJsonLoader.loader.loadFile("data_tests/rules.json");
    ResidueJsonLoader rjl = new ResidueJsonLoader(jsonRules, this.jsonMonos);
    this.jsonFamilies = rjl.loadFile("data_tests/res.json");
}
Also used : MonomersJsonLoader(io.loaders.json.MonomersJsonLoader) ResidueJsonLoader(io.loaders.json.ResidueJsonLoader) Before(org.junit.Before)

Aggregations

ResidueJsonLoader (io.loaders.json.ResidueJsonLoader)7 MonomersJsonLoader (io.loaders.json.MonomersJsonLoader)6 FamilyDB (db.FamilyDB)5 MonomersDB (db.MonomersDB)5 RulesDB (db.RulesDB)5 File (java.io.File)5 PolymersDB (db.PolymersDB)4 PolymersJsonLoader (io.loaders.json.PolymersJsonLoader)4 MonomersSerialization (io.loaders.serialization.MonomersSerialization)3 Residue (model.Residue)3 Coverage (algorithms.utils.Coverage)2 Coverages2HTML (io.html.Coverages2HTML)2 ImagesGeneration (io.imgs.ImagesGeneration)2 ColorsMap (io.imgs.PictureCoverageGenerator.ColorsMap)2 CoveragesJsonLoader (io.loaders.json.CoveragesJsonLoader)2 FamilyChainIO (io.loaders.json.FamilyChainIO)2 OutputZiper (io.zip.OutputZiper)2 Family (model.Family)2 Before (org.junit.Before)2 MonomericSpliting (algorithms.MonomericSpliting)1