Search in sources :

Example 1 with MappedChain

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

the class IsomorphismTests method notMatchingAromaticTest.

@Test
public void notMatchingAromaticTest() {
    Polymer pep = new Polymer(0, "", "SC1CCCCC1", null);
    List<MappedChain> mbs = Isomorphism.searchAChain(this.bloc, pep, MatchingType.STRONG);
    Assert.assertFalse(mbs.size() > 0);
}
Also used : MappedChain(algorithms.isomorphism.chains.MappedChain) Polymer(model.Polymer) Test(org.junit.Test)

Example 2 with MappedChain

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

the class IsomorphismTests method initMappingTest.

@Test
public void initMappingTest() {
    List<MappedChain> mbs = Isomorphism.searchFromPreviousMapping(this.mb0, this.ext1, MatchingType.STRONG);
    if (mbs.size() != 2)
        fail("2 matches needed");
    boolean isGood = true;
    for (MappedChain mb : mbs) {
        IMolecule mol = mb.getChemObject().getMolecule();
        IAtom a1 = (mol.getAtom(mb.getAtomsMapping().get(0)));
        IAtom a2 = (mol.getAtom(mb.getAtomsMapping().get(1)));
        if (!((a1.getSymbol().equals("C") && a2.getSymbol().equals("S")) || (a1.getSymbol().equals("S") && a2.getSymbol().equals("C"))))
            isGood = false;
    }
    Assert.assertTrue(isGood);
}
Also used : MappedChain(algorithms.isomorphism.chains.MappedChain) IMolecule(org.openscience.cdk.interfaces.IMolecule) IAtom(org.openscience.cdk.interfaces.IAtom) Test(org.junit.Test)

Example 3 with MappedChain

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

the class IsomorphismTests method lightMatchingAromaticTest.

@Test
public void lightMatchingAromaticTest() {
    Polymer pep = new Polymer(0, "", "SC1CCCCC1", null);
    List<MappedChain> mbs = Isomorphism.searchAChain(this.bloc, pep, MatchingType.LIGHT);
    Assert.assertTrue(mbs.size() > 0);
}
Also used : MappedChain(algorithms.isomorphism.chains.MappedChain) Polymer(model.Polymer) Test(org.junit.Test)

Example 4 with MappedChain

use of algorithms.isomorphism.chains.MappedChain 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 MappedChain

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

the class IsomorphismTests method matchingAromaticTest.

@Test
public void matchingAromaticTest() {
    Polymer pep = new Polymer(0, "", "Sc1ccccc1", null);
    List<MappedChain> mbs = Isomorphism.searchAChain(this.bloc, pep, MatchingType.STRONG);
    Assert.assertTrue(mbs.size() > 0);
}
Also used : MappedChain(algorithms.isomorphism.chains.MappedChain) Polymer(model.Polymer) Test(org.junit.Test)

Aggregations

MappedChain (algorithms.isomorphism.chains.MappedChain)11 Test (org.junit.Test)5 IAtom (org.openscience.cdk.interfaces.IAtom)5 Chain (algorithms.isomorphism.chains.Chain)4 ArrayList (java.util.ArrayList)4 Polymer (model.Polymer)4 IMolecule (org.openscience.cdk.interfaces.IMolecule)4 HashMap (java.util.HashMap)3 IBond (org.openscience.cdk.interfaces.IBond)3 BondMapping (algorithms.isomorphism.chains.Extension.BondMapping)2 Residue (model.Residue)2 ChainAdd (algorithms.isomorphism.chains.ChainAdd)1 Extension (algorithms.isomorphism.chains.Extension)1 FamilyChainsDB (algorithms.isomorphism.chains.FamilyChainsDB)1 Coverage (algorithms.utils.Coverage)1 Match (algorithms.utils.Match)1 ChemicalObject (model.ChemicalObject)1 Monomer (model.Monomer)1 Rule (model.Rule)1 Before (org.junit.Before)1