|
| 1 | +package org.biojava.nbio.structure.io.mmcif; |
| 2 | + |
| 3 | +import static org.junit.Assert.assertArrayEquals; |
| 4 | + |
| 5 | +import java.io.IOException; |
| 6 | + |
| 7 | +import org.biojava.nbio.structure.Chain; |
| 8 | +import org.biojava.nbio.structure.Compound; |
| 9 | +import org.biojava.nbio.structure.Structure; |
| 10 | +import org.biojava.nbio.structure.StructureException; |
| 11 | +import org.biojava.nbio.structure.StructureIO; |
| 12 | +import org.biojava.nbio.structure.align.util.AtomCache; |
| 13 | +import org.biojava.nbio.structure.io.FileParsingParameters; |
| 14 | +import org.junit.Test; |
| 15 | +/** |
| 16 | + * Test to ensure the entity name and type |
| 17 | + * @author Anthony Bradley |
| 18 | + * |
| 19 | + */ |
| 20 | +public class TestEntityNameAndType { |
| 21 | + |
| 22 | + @Test |
| 23 | + /** |
| 24 | + * |
| 25 | + */ |
| 26 | + public void testEntityId() throws IOException, StructureException { |
| 27 | + |
| 28 | + // Set up the atom cache to parse on Internal chain id |
| 29 | + AtomCache cache = new AtomCache(); |
| 30 | + cache.setUseMmCif(true); |
| 31 | + FileParsingParameters params = cache.getFileParsingParams(); |
| 32 | + params.setUseInternalChainId(true); |
| 33 | + DownloadChemCompProvider cc = new DownloadChemCompProvider(); |
| 34 | + ChemCompGroupFactory.setChemCompProvider(cc); |
| 35 | + cc.checkDoFirstInstall(); |
| 36 | + cache.setFileParsingParams(params); |
| 37 | + StructureIO.setAtomCache(cache); |
| 38 | + // This is hte information we want to test against |
| 39 | + String[] typeInformation = new String[] {"polymer", "non-polymer", "non-polymer", "non-polymer", "non-polymer", "water"}; |
| 40 | + String[] descriptionInformation = new String[] {"BROMODOMAIN ADJACENT TO ZINC FINGER DOMAIN PROTEIN 2B","4-FLUOROBENZAMIDOXIME", "4-FLUOROBENZAMIDOXIME", "METHANOL", "METHANOL", "water"}; |
| 41 | + |
| 42 | + |
| 43 | + /// TODO GET ALL THE ENTITY INFORMATION REQUIRED FOR 4CUP |
| 44 | + // Get this structure |
| 45 | + Structure bioJavaStruct = StructureIO.getStructure("4cup"); |
| 46 | + String[] testTypeInfo = new String[6]; |
| 47 | + String[] testDescInfo = new String[6]; |
| 48 | + // Now loop through the structure |
| 49 | + int chainCounter = 0; |
| 50 | + for (Chain c: bioJavaStruct.getChains()) { |
| 51 | + // Now get the entity information we want to test |
| 52 | + Compound thisCmpd = c.getCompound(); |
| 53 | +// testTypeInfo[chainCounter] = thisCmpd.get |
| 54 | + testDescInfo[chainCounter] = thisCmpd.getMolName(); |
| 55 | + chainCounter++; |
| 56 | + } |
| 57 | + // Now check they're both the same |
| 58 | + assertArrayEquals(testDescInfo, descriptionInformation); |
| 59 | +// assertArrayEquals(testTypeInfo, typeInformation); |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + } |
| 64 | +} |
0 commit comments