mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-05 22:04:27 +08:00
* support read-only access to cstates from python * expose GetBrackets * expose getAttachPoints too remove vestigial SubstanceGroupCState_VECT * backup * backup * basics working * backup * add label_mol_abbreviations * fix a bug in the chirality handling * add linkers, needs more testing * add another peptide test * sanitize results by default * just need rings * getting started with the C++ form of abbreviations * a bit of error handling * add findApplicableMatches * actually apply the abbreviations * make the getDefault functions more efficient * add labeling (creating s groups) * docs * basic python wrappers (maybe this is enough?) * add _displayLabel and _displayLabelW support to MolDraw2D update the docs for that * use displayLabel props * add more default abbrevs * change default linker defns add parseLinkers convenience function * make sure attachment point atoms aren't aromatic * change the color of dummies to be darker gray * remove python implementation * support abbreviations in the java wrappers * add abbreviations to the csharp wrappers * add abbreviations to the js wrappers * add molParity to the list of atom props not written to CXSMILES * support condensing SUP substance groups * add that to the python wrappers * Update testAbbreviations.py * clear ring info if we added it * document that the molecules with abbreviations removed have not been sanitized
73 lines
2.2 KiB
Java
73 lines
2.2 KiB
Java
/*
|
|
*
|
|
* Copyright (c) 2019 Greg Landrum and T5 Informatics GmbH
|
|
* All rights reserved.
|
|
*
|
|
* This file is part of the RDKit.
|
|
* The contents are covered by the terms of the BSD license
|
|
* which is included in the file license.txt, found at the root
|
|
* of the RDKit source tree.
|
|
*/
|
|
package org.RDKit;
|
|
|
|
import static org.junit.Assert.*;
|
|
import org.junit.*;
|
|
|
|
public class AbbreviationsTests extends GraphMolTest {
|
|
|
|
@Before public void setUp() {
|
|
}
|
|
|
|
@Test
|
|
public void test1Basics() {
|
|
AbbreviationDefinition_Vect abbrevs = RDKFuncs.getDefaultAbbreviations();
|
|
RWMol mol = RWMol.MolFromSmiles("C1CCC1C(F)(F)F");
|
|
assertEquals(mol.getNumAtoms(),8);
|
|
|
|
RDKFuncs.condenseMolAbbreviations(mol,abbrevs);
|
|
// no changes here due to the threshold
|
|
assertEquals(mol.getNumAtoms(),8);
|
|
|
|
RDKFuncs.condenseMolAbbreviations(mol,abbrevs, 1.0);
|
|
assertEquals(mol.getNumAtoms(),5);
|
|
assertEquals(RDKFuncs.MolToCXSmiles(mol),"*C1CCC1 |$CF3;;;;$|");
|
|
}
|
|
|
|
@Test
|
|
public void test2LinkerBasics() {
|
|
AbbreviationDefinition_Vect abbrevs = RDKFuncs.getDefaultLinkers();
|
|
RWMol mol = RWMol.MolFromSmiles("COCCOCCOCCOCCCl");
|
|
assertEquals(mol.getNumAtoms(),14);
|
|
|
|
RDKFuncs.condenseMolAbbreviations(mol,abbrevs);
|
|
// no changes here due to the threshold
|
|
assertEquals(mol.getNumAtoms(),14);
|
|
|
|
RDKFuncs.condenseMolAbbreviations(mol,abbrevs, 1.0);
|
|
assertEquals(mol.getNumAtoms(),3);
|
|
assertEquals(RDKFuncs.MolToCXSmiles(mol),"C*Cl |$;PEG4;$|");
|
|
|
|
}
|
|
|
|
@Test
|
|
public void test3Matching() {
|
|
AbbreviationDefinition_Vect abbrevs = RDKFuncs.getDefaultAbbreviations();
|
|
RWMol mol = RWMol.MolFromSmiles("C1CCC1C(F)(F)F");
|
|
assertEquals(mol.getNumAtoms(),8);
|
|
|
|
AbbreviationMatch_Vect matches = RDKFuncs.findApplicableAbbreviationMatches(mol,abbrevs,1.0);
|
|
assertEquals(matches.size(),1);
|
|
assertEquals(matches.get(0).getAbbrev().getLabel(),"CF3");
|
|
|
|
RDKFuncs.applyMatches(mol,matches);
|
|
assertEquals(mol.getNumAtoms(),5);
|
|
assertEquals(RDKFuncs.MolToCXSmiles(mol),"*C1CCC1 |$CF3;;;;$|");
|
|
|
|
}
|
|
|
|
public static void main(String args[]) {
|
|
org.junit.runner.JUnitCore.main("org.RDKit.AbbreviationsTests");
|
|
}
|
|
|
|
}
|