Search in sources :

Example 1 with Chain

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

the class BlocsTests method setUp.

@Before
public void setUp() throws Exception {
    this.sc = SmilesConverter.conv;
    // String smiles = "C(C(=O)O)C(=O)N";
    IAtom a1;
    IAtom a2;
    a1 = new Atom("C");
    a1.setFlag(CDKConstants.ISAROMATIC, true);
    a2 = new Atom("N");
    a2.setFlag(CDKConstants.ISAROMATIC, true);
    // NC
    this.ext1 = new Extension(new Bond(a1, a2, Order.SINGLE));
    a2 = new Atom("O");
    // NC=O
    this.ext2 = new Extension(new Bond(a1, a2, Order.DOUBLE));
    a2 = new Atom("C");
    a2.setFlag(CDKConstants.ISAROMATIC, true);
    // NC(C)=O
    this.ext3 = new Extension(new Bond(a1, a2, Order.SINGLE));
    a1 = new Atom("C");
    a1.setFlag(CDKConstants.ISAROMATIC, true);
    // NC(CC)=O
    this.ext4 = new Extension(new Bond(a1, a2, Order.SINGLE));
    a2 = new Atom("C");
    a2.setFlag(CDKConstants.ISAROMATIC, true);
    // NC(CCC)=O
    this.ext5 = new Extension(new Bond(a1, a2, Order.SINGLE));
    a1 = new Atom("C");
    a1.setFlag(CDKConstants.ISAROMATIC, true);
    a2 = new Atom("N");
    a2.setFlag(CDKConstants.ISAROMATIC, true);
    // N1C(CCC1)=O
    this.ext6 = new Extension(new Bond(a1, a2, Order.SINGLE));
    // NC
    this.blc1 = new Chain(null, ext1, -1, -1);
    // NC=O
    this.blc2 = new Chain(blc1, ext2, -1, 0);
    // NC(C)=O
    this.blc3 = new Chain(blc2, ext3, 0, -1);
    // NC(CC)=O
    this.blc4 = new Chain(blc3, ext4, 3, -1);
    // NC(CCC)=O
    this.blc5 = new Chain(blc4, ext5, 4, -1);
    // N1C(CC1)=O
    this.blc6 = new Chain(blc5, ext6, 5, 1);
}
Also used : Extension(algorithms.isomorphism.chains.Extension) Chain(algorithms.isomorphism.chains.Chain) Bond(org.openscience.cdk.Bond) IAtom(org.openscience.cdk.interfaces.IAtom) Atom(org.openscience.cdk.silent.Atom) IAtom(org.openscience.cdk.interfaces.IAtom) Before(org.junit.Before)

Example 2 with Chain

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

the class ChainLearningTests method generateGreedyTest.

/**/
@Test
public void generateGreedyTest() {
    // Computing
    ChainLearning learning = new ChainLearning(this.learningBase);
    learning.setMarkovianSize(3);
    learning.learn(this.families);
    ChainsIndex chains = learning.getFinalChains();
    // Verification
    for (String idx : chains.keySet()) {
        Chain chain = chains.get(idx);
        if (!this.greedyPatterns.containsKey(idx) || !this.greedyPatterns.get(idx).equals(chain.getSerial()))
            fail(idx + " not found");
    /**/
    }
    Assert.assertTrue(chains.size() == 3);
}
Also used : Chain(algorithms.isomorphism.chains.Chain) ChainLearning(algorithms.isomorphism.chains.ChainLearning) ChainsIndex(algorithms.isomorphism.chains.ChainLearning.ChainsIndex) Test(org.junit.Test)

Example 3 with Chain

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

the class ChainLearningTests method generateMarkov6Test.

/**/
@Test
public void generateMarkov6Test() {
    // Computing
    ChainLearning learning = new ChainLearning(this.learningBase);
    learning.setMarkovianSize(6);
    learning.learn(this.families);
    ChainsIndex chains = learning.getFinalChains();
    // Verification
    for (String pattern : chains.keySet()) {
        Chain chain = chains.get(pattern);
        if (!this.markovPatterns.containsKey(pattern) || !this.markovPatterns.get(pattern).equals(chain.getSerial()))
            fail(pattern + " not found");
    /**/
    }
    Assert.assertTrue(chains.size() == 3);
}
Also used : Chain(algorithms.isomorphism.chains.Chain) ChainLearning(algorithms.isomorphism.chains.ChainLearning) ChainsIndex(algorithms.isomorphism.chains.ChainLearning.ChainsIndex) Test(org.junit.Test)

Example 4 with Chain

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

the class IsomorphismTests method setUp.

@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");
}
Also used : Extension(algorithms.isomorphism.chains.Extension) MappedChain(algorithms.isomorphism.chains.MappedChain) Chain(algorithms.isomorphism.chains.Chain) MappedChain(algorithms.isomorphism.chains.MappedChain) HashMap(java.util.HashMap) IBond(org.openscience.cdk.interfaces.IBond) ArrayList(java.util.ArrayList) Polymer(model.Polymer) Monomer(model.Monomer) Bond(org.openscience.cdk.Bond) IBond(org.openscience.cdk.interfaces.IBond) IAtom(org.openscience.cdk.interfaces.IAtom) Atom(org.openscience.cdk.silent.Atom) IAtom(org.openscience.cdk.interfaces.IAtom) Before(org.junit.Before)

Example 5 with Chain

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

the class MappedBlocsTest method setUp.

@Before
public void setUp() throws Exception {
    this.prevBloc = new Chain("C,0,S,0,0,-1,-1;C,0,C,0,1,0,-1;C,0,N,1,0,2,-1");
    this.prevBloc.getSerial();
    this.res = Residue.constructResidue("MonoTest", "[H]NC([H])(C=O)C([H])([H])S");
    this.mb = Isomorphism.searchAChain(this.prevBloc, res, MatchingType.STRONG).get(0);
}
Also used : MappedChain(algorithms.isomorphism.chains.MappedChain) Chain(algorithms.isomorphism.chains.Chain) Before(org.junit.Before)

Aggregations

Chain (algorithms.isomorphism.chains.Chain)11 MappedChain (algorithms.isomorphism.chains.MappedChain)5 Test (org.junit.Test)4 ChainLearning (algorithms.isomorphism.chains.ChainLearning)3 ChainsIndex (algorithms.isomorphism.chains.ChainLearning.ChainsIndex)3 Extension (algorithms.isomorphism.chains.Extension)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Before (org.junit.Before)3 IAtom (org.openscience.cdk.interfaces.IAtom)3 IBond (org.openscience.cdk.interfaces.IBond)3 ChainAdd (algorithms.isomorphism.chains.ChainAdd)2 BondMapping (algorithms.isomorphism.chains.Extension.BondMapping)2 FamilyChainsDB (algorithms.isomorphism.chains.FamilyChainsDB)2 Residue (model.Residue)2 Bond (org.openscience.cdk.Bond)2 IMolecule (org.openscience.cdk.interfaces.IMolecule)2 Atom (org.openscience.cdk.silent.Atom)2 BondAdd (algorithms.isomorphism.chains.BondAdd)1 FrequencesIndex (algorithms.isomorphism.chains.ChainLearning.FrequencesIndex)1