From 17dce416188e13160d9bf0840bb370e3adca041e Mon Sep 17 00:00:00 2001 From: cmzmasek Date: Mon, 18 Nov 2013 05:29:54 +0000 Subject: [PATCH] in progress --- .../org/forester/analysis/TaxonomyDataManager.java | 8 ++++ .../src/org/forester/archaeopteryx/TreePanel.java | 1 + .../{archaeopteryx => util}/TaxonomyUtil.java | 48 ++++++++++++++++++-- .../src/org/forester/ws/seqdb/UniProtTaxonomy.java | 11 ++++- 4 files changed, 64 insertions(+), 4 deletions(-) rename forester/java/src/org/forester/{archaeopteryx => util}/TaxonomyUtil.java (94%) diff --git a/forester/java/src/org/forester/analysis/TaxonomyDataManager.java b/forester/java/src/org/forester/analysis/TaxonomyDataManager.java index 31de4f9..d0df4c7 100644 --- a/forester/java/src/org/forester/analysis/TaxonomyDataManager.java +++ b/forester/java/src/org/forester/analysis/TaxonomyDataManager.java @@ -47,8 +47,10 @@ import org.forester.phylogeny.data.Identifier; import org.forester.phylogeny.data.Taxonomy; import org.forester.phylogeny.iterators.PhylogenyNodeIterator; 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 { @@ -195,6 +197,12 @@ public final class TaxonomyDataManager extends RunnableProcess { } private final static List getTaxonomiesFromTaxonomyCode( final String query ) throws IOException { + 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/archaeopteryx/TreePanel.java b/forester/java/src/org/forester/archaeopteryx/TreePanel.java index c548685..9f7dd65 100644 --- a/forester/java/src/org/forester/archaeopteryx/TreePanel.java +++ b/forester/java/src/org/forester/archaeopteryx/TreePanel.java @@ -129,6 +129,7 @@ import org.forester.util.DescriptiveStatistics; import org.forester.util.ForesterConstants; import org.forester.util.ForesterUtil; import org.forester.util.SequenceAccessionTools; +import org.forester.util.TaxonomyUtil; public final class TreePanel extends JPanel implements ActionListener, MouseWheelListener, Printable { diff --git a/forester/java/src/org/forester/archaeopteryx/TaxonomyUtil.java b/forester/java/src/org/forester/util/TaxonomyUtil.java similarity index 94% rename from forester/java/src/org/forester/archaeopteryx/TaxonomyUtil.java rename to forester/java/src/org/forester/util/TaxonomyUtil.java index 9a29863..38c8da2 100644 --- a/forester/java/src/org/forester/archaeopteryx/TaxonomyUtil.java +++ b/forester/java/src/org/forester/util/TaxonomyUtil.java @@ -1,14 +1,23 @@ -package org.forester.archaeopteryx; +package org.forester.util; import java.util.HashMap; import java.util.Map; -final class TaxonomyUtil { +public final class TaxonomyUtil { - static String getTaxGroupByTaxCode( final String code ) { + 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 ); + } + + 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(); static { _default_taxcode_taxgroup_map.put( "HUMAN", "deuterostomia" ); @@ -534,4 +543,37 @@ 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(); + + 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); + + } } diff --git a/forester/java/src/org/forester/ws/seqdb/UniProtTaxonomy.java b/forester/java/src/org/forester/ws/seqdb/UniProtTaxonomy.java index c379607..692f8dd 100644 --- a/forester/java/src/org/forester/ws/seqdb/UniProtTaxonomy.java +++ b/forester/java/src/org/forester/ws/seqdb/UniProtTaxonomy.java @@ -26,7 +26,9 @@ 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; @@ -45,7 +47,9 @@ 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 ) { @@ -158,6 +162,11 @@ 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