X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Futil%2FTaxonomyUtil.java;h=6fc79de4ce9e5d4bf6cdd2a17ffe43278efe4a4d;hb=c0439ed8b088887ffea2faf11bc7897333287cb3;hp=c884d1142384fe4b473cac4a74fe25b95282450d;hpb=10c22d9c8353c3e11736cf136ab26b771848f834;p=jalview.git diff --git a/forester/java/src/org/forester/util/TaxonomyUtil.java b/forester/java/src/org/forester/util/TaxonomyUtil.java index c884d11..6fc79de 100644 --- a/forester/java/src/org/forester/util/TaxonomyUtil.java +++ b/forester/java/src/org/forester/util/TaxonomyUtil.java @@ -1,8 +1,12 @@ package org.forester.util; +import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; +import java.util.List; import java.util.Map; +import java.util.Set; public final class TaxonomyUtil { @@ -24,7 +28,7 @@ public final class TaxonomyUtil { } _default_taxcode_taxgroup_map.put( code, group ); } - private final static Map _default_taxcode_taxgroup_map = new HashMap(); + private final static Map _default_taxcode_taxgroup_map = new HashMap(); static { put( "BUFBU", "deuterostomia" ); put( "NOTVI", "deuterostomia" ); @@ -169,6 +173,12 @@ public final class TaxonomyUtil { put( "SCHMA", "protostomia" ); put( "CLOSI", "protostomia" ); put( "SCHMD", "protostomia" ); + put( "ANOGL", "protostomia" ); + put( "BLAGE", "protostomia" ); + put( "ZOONE", "protostomia" ); + put( "SCHAM", "protostomia" ); + put( "GRYPE", "protostomia" ); + put( "ONCFA", "protostomia" ); put( "ACRDI", "cnidaria" ); put( "NEMVE", "cnidaria" ); put( "HYDVU", "cnidaria" ); @@ -176,7 +186,8 @@ public final class TaxonomyUtil { put( "MNELE", "ctenophora" ); put( "AMPQE", "porifera" ); put( "MONBE", "choanoflagellida" ); - put( "SALS5", "choanoflagellida" ); + put( "SALS5", "choanoflagellida" ); //TODO remove me + put( "SALR5", "choanoflagellida" ); put( "AMOPA", "ichthyophonida & filasterea" ); put( "SARXX", "ichthyophonida & filasterea" ); put( "CAPO3", "ichthyophonida & filasterea" ); @@ -364,6 +375,7 @@ public final class TaxonomyUtil { put( "ALIXX", "stramenopiles" ); put( "BLAHO", "stramenopiles" ); put( "BIGNA", "rhizaria" ); + put( "RETFI", "rhizaria" ); put( "TRYB2", "excavata" ); put( "TRYCR", "excavata" ); put( "LEIMA", "excavata" ); @@ -566,11 +578,12 @@ public final class TaxonomyUtil { put( "HELPH", "bacteria" ); put( "AQUAE", "bacteria" ); } - private final static Map FAKE_CODE_TO_ID_MAP = new HashMap(); + private final static Map FAKE_CODE_TO_ID_MAP = new HashMap(); static { FAKE_CODE_TO_ID_MAP.put( "CTEXX", 283909 ); FAKE_CODE_TO_ID_MAP.put( "HMAXX", 6085 ); FAKE_CODE_TO_ID_MAP.put( "SARXX", 72019 ); + FAKE_CODE_TO_ID_MAP.put( "SPHAR", 72019 ); //TODO is same as Sphingomonas aromaticivorans FAKE_CODE_TO_ID_MAP.put( "AALXX", 398408 ); FAKE_CODE_TO_ID_MAP.put( "PFIXX", 83344 ); FAKE_CODE_TO_ID_MAP.put( "MPSXX", 692275 ); @@ -596,4 +609,77 @@ public final class TaxonomyUtil { FAKE_CODE_TO_ID_MAP.put( "ALIXX", 87102 ); FAKE_CODE_TO_ID_MAP.put( "TTRXX", 529818 ); } + public final static List TAXONOMY_RANKS_LIST = new ArrayList(); + public final static Set TAXONOMY_RANKS_SET = new HashSet(); + public static final String OTHER = "other"; + public static final String UNKNOWN = "unknown";; + final public static HashMap RANK_TO_INT = new HashMap(); + static { + TAXONOMY_RANKS_LIST.add( "domain" ); + TAXONOMY_RANKS_LIST.add( "superkingdom" ); + TAXONOMY_RANKS_LIST.add( "kingdom" ); + TAXONOMY_RANKS_LIST.add( "subkingdom" ); + TAXONOMY_RANKS_LIST.add( "branch" ); + TAXONOMY_RANKS_LIST.add( "infrakingdom" ); + TAXONOMY_RANKS_LIST.add( "superphylum" ); + TAXONOMY_RANKS_LIST.add( "phylum" ); + TAXONOMY_RANKS_LIST.add( "subphylum" ); + TAXONOMY_RANKS_LIST.add( "infraphylum" ); + TAXONOMY_RANKS_LIST.add( "microphylum" ); + TAXONOMY_RANKS_LIST.add( "superdivision" ); + TAXONOMY_RANKS_LIST.add( "division" ); + TAXONOMY_RANKS_LIST.add( "subdivision" ); + TAXONOMY_RANKS_LIST.add( "infradivision" ); + TAXONOMY_RANKS_LIST.add( "superclass" ); + TAXONOMY_RANKS_LIST.add( "class" ); + TAXONOMY_RANKS_LIST.add( "subclass" ); + TAXONOMY_RANKS_LIST.add( "infraclass" ); + TAXONOMY_RANKS_LIST.add( "superlegion" ); + TAXONOMY_RANKS_LIST.add( "legion" ); + TAXONOMY_RANKS_LIST.add( "sublegion" ); + TAXONOMY_RANKS_LIST.add( "infralegion" ); + TAXONOMY_RANKS_LIST.add( "supercohort" ); + TAXONOMY_RANKS_LIST.add( "cohort" ); + TAXONOMY_RANKS_LIST.add( "subcohort" ); + TAXONOMY_RANKS_LIST.add( "infracohort" ); + TAXONOMY_RANKS_LIST.add( "superorder" ); + TAXONOMY_RANKS_LIST.add( "order" ); + TAXONOMY_RANKS_LIST.add( "suborder" ); + TAXONOMY_RANKS_LIST.add( "infraorder" ); + TAXONOMY_RANKS_LIST.add( "superfamily" ); + TAXONOMY_RANKS_LIST.add( "family" ); + TAXONOMY_RANKS_LIST.add( "subfamily" ); + TAXONOMY_RANKS_LIST.add( "supertribe" ); + TAXONOMY_RANKS_LIST.add( "tribe" ); + TAXONOMY_RANKS_LIST.add( "subtribe" ); + TAXONOMY_RANKS_LIST.add( "infratribe" ); + TAXONOMY_RANKS_LIST.add( "genus" ); + TAXONOMY_RANKS_LIST.add( "subgenus" ); + TAXONOMY_RANKS_LIST.add( "superspecies" ); + TAXONOMY_RANKS_LIST.add( "species" ); + TAXONOMY_RANKS_LIST.add( "subspecies" ); + TAXONOMY_RANKS_LIST.add( "variety" ); + TAXONOMY_RANKS_LIST.add( "varietas" ); + TAXONOMY_RANKS_LIST.add( "subvariety" ); + TAXONOMY_RANKS_LIST.add( "form" ); + TAXONOMY_RANKS_LIST.add( "subform" ); + TAXONOMY_RANKS_LIST.add( "cultivar" ); + TAXONOMY_RANKS_LIST.add( "strain" ); + TAXONOMY_RANKS_LIST.add( "section" ); + TAXONOMY_RANKS_LIST.add( "subsection" ); + TAXONOMY_RANKS_LIST.add( UNKNOWN ); + TAXONOMY_RANKS_LIST.add( OTHER ); + } + final public static String RANKS[] = new String[ TAXONOMY_RANKS_LIST.size() - 2 ]; + static { + // same thing as set: + for( final String rank : TAXONOMY_RANKS_LIST ) { + TAXONOMY_RANKS_SET.add( rank ); + } + final int l = RANKS.length; + for( int i = 0; i < l; ++i ) { + RANKS[ i ] = TAXONOMY_RANKS_LIST.get( i ); + RANK_TO_INT.put( RANKS[ i ], i ); + } + } }