*/
package jalview.ext.ensembl;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* Selected species identifiers used by Ensembl
*
chimpanzee(false), cat(false), zebrafish(true), chicken(true),
dmelanogaster(true);
+ static Set<Species> modelOrganisms = new HashSet<>();
+
+ static
+ {
+ for (Species s : values())
+ {
+ if (s.isModelOrganism())
+ {
+ modelOrganisms.add(s);
+ }
+ }
+ }
boolean modelOrganism;
private Species(boolean model)
{
return modelOrganism;
}
+
+ public static Set<Species> getModelOrganisms()
+ {
+ return modelOrganisms;
+ }
}
--- /dev/null
+package jalview.ext.ensembl;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.util.Set;
+
+import org.testng.annotations.Test;
+
+public class SpeciesTest
+{
+ @Test
+ public void testGetModelOrganisms()
+ {
+ Set<Species> models = Species.getModelOrganisms();
+ assertTrue(models.contains(Species.human));
+ assertFalse(models.contains(Species.horse));
+ for (Species s : Species.values())
+ {
+ if (s.isModelOrganism())
+ {
+ assertTrue(models.contains(s));
+ }
+ else
+ {
+ assertFalse(models.contains(s));
+ }
+ }
+ }
+}