X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fschemes%2FResiduePropertiesTest.java;h=be6a10c9b53f3ad8f9a3d1112ec9ed1eb876d39e;hb=3b68920e3494f2dd066844893e5fb0a9472ab8f7;hp=b68ca6898ddc84879f7f20cd8c6c5f4c05589139;hpb=37de9310bec3501cbc6381e0c3dcb282fcaad812;p=jalview.git diff --git a/test/jalview/schemes/ResiduePropertiesTest.java b/test/jalview/schemes/ResiduePropertiesTest.java index b68ca68..be6a10c 100644 --- a/test/jalview/schemes/ResiduePropertiesTest.java +++ b/test/jalview/schemes/ResiduePropertiesTest.java @@ -25,6 +25,7 @@ import static org.testng.AssertJUnit.assertNull; import java.util.Collections; import java.util.List; +import java.util.Map; import org.testng.annotations.Test; @@ -1556,4 +1557,62 @@ public class ResiduePropertiesTest assertEquals('Q', ResidueProperties.getSingleCharacterCode("Gln")); assertEquals('Q', ResidueProperties.getSingleCharacterCode("gln")); } + + @Test(groups = { "Functional" }) + public void testPhysicoChemicalProperties() + { + checkProperty("aromatic", "FYWH-*"); + checkProperty("aliphatic", "IVL-*"); + checkProperty("tiny", "GAS-*"); + checkProperty("small", "VCTGACSDNP-*"); + checkProperty("charged", "HKRDE-*"); + checkProperty("negative", "DE-*"); + checkProperty("polar", "YWHRKTSNDEQ-*X"); + checkProperty("positive", "HKR-*"); + checkProperty("proline", "P-*"); + checkProperty("hydrophobic", "MILVFYWHKTGAC-*X"); + } + + /** + * Verify that the residues in the list have the named property, and other + * residues do not + * + * @param property + * @param residues + */ + void checkProperty(String property, String residues) + { + Map props = ResidueProperties.propHash.get(property); + + /* + * assert residues have the property (value 1 in lookup) + */ + for (char res : residues.toCharArray()) + { + assertEquals(res + " should be " + property, 1, + props.get(String.valueOf(res)).intValue()); + } + + /* + * assert other residues do not (value 0 in lookup) + */ + for (String res : ResidueProperties.aa) + { + if (!residues.contains(res)) + { + Integer propValue = props.get(String.valueOf(res)); + + if (propValue != null) + { + /* + * conservation calculation assigns unexpected symbols + * the same value as '-'; here we just check those which + * explicitly do not have the property + */ + assertEquals(res + " should not be " + property, 0, + propValue.intValue()); + } + } + } + } }