From fd93d9051360270863585a005a90e1ee307b314b Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Mon, 18 Nov 2013 18:29:52 +0000 Subject: [PATCH] cleanup --- .../org/forester/analysis/TaxonomyDataManager.java | 5 +- .../java/src/org/forester/util/TaxonomyUtil.java | 70 +++++++++----------- .../src/org/forester/ws/seqdb/UniProtTaxonomy.java | 11 +-- 3 files changed, 35 insertions(+), 51 deletions(-) diff --git a/forester/java/src/org/forester/analysis/TaxonomyDataManager.java b/forester/java/src/org/forester/analysis/TaxonomyDataManager.java index d0df4c7..52b5fdf 100644 --- a/forester/java/src/org/forester/analysis/TaxonomyDataManager.java +++ b/forester/java/src/org/forester/analysis/TaxonomyDataManager.java @@ -50,7 +50,6 @@ import org.forester.util.ForesterUtil; import org.forester.util.TaxonomyUtil; import org.forester.ws.seqdb.SequenceDbWsTools; import org.forester.ws.seqdb.UniProtTaxonomy; -import org.forester.archaeopteryx.*; public final class TaxonomyDataManager extends RunnableProcess { @@ -197,12 +196,10 @@ public final class TaxonomyDataManager extends RunnableProcess { } private final static List getTaxonomiesFromTaxonomyCode( final String query ) throws IOException { - if ( query.indexOf( "XX" ) == 3 && TaxonomyUtil.isHasTaxIdFromFakeTaxCode( query ) ) { + if ( ( query.indexOf( "XX" ) == 3 ) && TaxonomyUtil.isHasTaxIdFromFakeTaxCode( query ) ) { final int id = TaxonomyUtil.getTaxIdFromFakeTaxCode( query ); return SequenceDbWsTools.getTaxonomiesFromId( String.valueOf( id ), MAX_TAXONOMIES_TO_RETURN ); - } - return SequenceDbWsTools.getTaxonomiesFromTaxonomyCode( query, MAX_TAXONOMIES_TO_RETURN ); } diff --git a/forester/java/src/org/forester/util/TaxonomyUtil.java b/forester/java/src/org/forester/util/TaxonomyUtil.java index 38c8da2..df45c1d 100644 --- a/forester/java/src/org/forester/util/TaxonomyUtil.java +++ b/forester/java/src/org/forester/util/TaxonomyUtil.java @@ -9,16 +9,15 @@ public final class TaxonomyUtil { public static String getTaxGroupByTaxCode( final String code ) { return _default_taxcode_taxgroup_map.get( code ); } - + public static int getTaxIdFromFakeTaxCode( final String code ) { - return FAKE_CODE_TO_ID_MAP.get( code ); + return FAKE_CODE_TO_ID_MAP.get( code ); } - + public static boolean isHasTaxIdFromFakeTaxCode( final String code ) { return FAKE_CODE_TO_ID_MAP.containsKey( code ); - } - - private final static Map _default_taxcode_taxgroup_map = new HashMap(); + } + private final static Map _default_taxcode_taxgroup_map = new HashMap(); static { _default_taxcode_taxgroup_map.put( "HUMAN", "deuterostomia" ); _default_taxcode_taxgroup_map.put( "HOMSA", "deuterostomia" ); @@ -543,37 +542,34 @@ public final class TaxonomyUtil { _default_taxcode_taxgroup_map.put( "HELPH", "bacteria" ); _default_taxcode_taxgroup_map.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( "AALXX", 398408); - FAKE_CODE_TO_ID_MAP.put( "PFIXX", 83344); - FAKE_CODE_TO_ID_MAP.put( "MPSXX", 692275); - FAKE_CODE_TO_ID_MAP.put( "BCOXX", 430998); - FAKE_CODE_TO_ID_MAP.put( "APPXX", 178873); - FAKE_CODE_TO_ID_MAP.put( "APMXX", 46634); - FAKE_CODE_TO_ID_MAP.put( "APSXX", 1042127); - FAKE_CODE_TO_ID_MAP.put( "CPUXX", 80637); - FAKE_CODE_TO_ID_MAP.put( "JARXX", 202697); - FAKE_CODE_TO_ID_MAP.put( "FPIXX", 40483); - FAKE_CODE_TO_ID_MAP.put( "PPLXX", 104341); - FAKE_CODE_TO_ID_MAP.put( "MVNXX", 1069443); - FAKE_CODE_TO_ID_MAP.put( "CREXX", 61392); - FAKE_CODE_TO_ID_MAP.put( "FALXX", 691883); - FAKE_CODE_TO_ID_MAP.put( "CCLXX", 85681); - FAKE_CODE_TO_ID_MAP.put( "ORCXX", 385169); - FAKE_CODE_TO_ID_MAP.put( "ASCXX", 763042); - FAKE_CODE_TO_ID_MAP.put( "CSUXX", 574566); - FAKE_CODE_TO_ID_MAP.put( "OTRXX", 1172189); - FAKE_CODE_TO_ID_MAP.put( "FCYXX", 186039); - FAKE_CODE_TO_ID_MAP.put( "AKEXX", 702273); - FAKE_CODE_TO_ID_MAP.put( "SAGXX", 876976); - FAKE_CODE_TO_ID_MAP.put( "ALIXX", 87102); - FAKE_CODE_TO_ID_MAP.put( "TTRXX", 529818); - + 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( "AALXX", 398408 ); + FAKE_CODE_TO_ID_MAP.put( "PFIXX", 83344 ); + FAKE_CODE_TO_ID_MAP.put( "MPSXX", 692275 ); + FAKE_CODE_TO_ID_MAP.put( "BCOXX", 430998 ); + FAKE_CODE_TO_ID_MAP.put( "APPXX", 178873 ); + FAKE_CODE_TO_ID_MAP.put( "APMXX", 46634 ); + FAKE_CODE_TO_ID_MAP.put( "APSXX", 1042127 ); + FAKE_CODE_TO_ID_MAP.put( "CPUXX", 80637 ); + FAKE_CODE_TO_ID_MAP.put( "JARXX", 202697 ); + FAKE_CODE_TO_ID_MAP.put( "FPIXX", 40483 ); + FAKE_CODE_TO_ID_MAP.put( "PPLXX", 104341 ); + FAKE_CODE_TO_ID_MAP.put( "MVNXX", 1069443 ); + FAKE_CODE_TO_ID_MAP.put( "CREXX", 61392 ); + FAKE_CODE_TO_ID_MAP.put( "FALXX", 691883 ); + FAKE_CODE_TO_ID_MAP.put( "CCLXX", 85681 ); + FAKE_CODE_TO_ID_MAP.put( "ORCXX", 385169 ); + FAKE_CODE_TO_ID_MAP.put( "ASCXX", 763042 ); + FAKE_CODE_TO_ID_MAP.put( "CSUXX", 574566 ); + FAKE_CODE_TO_ID_MAP.put( "OTRXX", 1172189 ); + FAKE_CODE_TO_ID_MAP.put( "FCYXX", 186039 ); + FAKE_CODE_TO_ID_MAP.put( "AKEXX", 702273 ); + FAKE_CODE_TO_ID_MAP.put( "SAGXX", 876976 ); + FAKE_CODE_TO_ID_MAP.put( "ALIXX", 87102 ); + FAKE_CODE_TO_ID_MAP.put( "TTRXX", 529818 ); } } diff --git a/forester/java/src/org/forester/ws/seqdb/UniProtTaxonomy.java b/forester/java/src/org/forester/ws/seqdb/UniProtTaxonomy.java index 692f8dd..c379607 100644 --- a/forester/java/src/org/forester/ws/seqdb/UniProtTaxonomy.java +++ b/forester/java/src/org/forester/ws/seqdb/UniProtTaxonomy.java @@ -26,9 +26,7 @@ package org.forester.ws.seqdb; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import org.forester.util.ForesterUtil; @@ -47,9 +45,7 @@ public final class UniProtTaxonomy { public final static String CELLULAR_ORGANISMS = "cellular organisms"; public final static String VIRUSES = "Viruses"; public static final String X = "x"; - - - + public UniProtTaxonomy( final String line ) { final String[] items = line.split( "\t" ); if ( items.length < 5 ) { @@ -162,11 +158,6 @@ public final class UniProtTaxonomy { return _synonym; } - - - - - public final static UniProtTaxonomy createSpecialFromScientificName( final String sn ) { final List lineage = new ArrayList(); final String code = ""; -- 1.7.10.2