X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fschemes%2FResiduePropertiesTest.java;fp=test%2Fjalview%2Fschemes%2FResiduePropertiesTest.java;h=41d74489c7abac509453d9617f40fc2725116b78;hb=251bd6bbc7324e2235bb663b1b255317817957b1;hp=b68ca6898ddc84879f7f20cd8c6c5f4c05589139;hpb=2165f54af3cc0f7bb08deec4574d4873053c4743;p=jalview.git diff --git a/test/jalview/schemes/ResiduePropertiesTest.java b/test/jalview/schemes/ResiduePropertiesTest.java index b68ca68..41d7448 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", "MILVFYWHKCGAC-*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()); + } + } + } + } }