public final class AncestralTaxonomyInference {
private static final int MAX_CACHE_SIZE = 100000;
- private static final int MAX_TAXONOMIES_TO_RETURN = 1000;
+ private static final int MAX_TAXONOMIES_TO_RETURN = 10;
private static final HashMap<String, UniProtTaxonomy> _sn_up_cache_map = new HashMap<String, UniProtTaxonomy>();
private static final HashMap<String, UniProtTaxonomy> _lineage_up_cache_map = new HashMap<String, UniProtTaxonomy>();
private static final HashMap<String, UniProtTaxonomy> _code_up_cache_map = new HashMap<String, UniProtTaxonomy>();
}
}
if ( last_common_lineage.isEmpty() ) {
- String msg = "no common lineage for:\n";
- int counter = 0;
- for( final String[] strings : lineages ) {
- msg += counter + ": ";
- ++counter;
- for( final String string : strings ) {
- msg += string + " ";
+ boolean saw_viruses = false;
+ boolean saw_cellular_organism = false;
+ for( final String[] lineage : lineages ) {
+ if ( lineage.length > 0 ) {
+ if ( lineage[ 0 ].equalsIgnoreCase( UniProtTaxonomy.VIRUSES ) ) {
+ saw_viruses = true;
+ }
+ else if ( lineage[ 0 ].equalsIgnoreCase( UniProtTaxonomy.CELLULAR_ORGANISMS ) ) {
+ saw_cellular_organism = true;
+ }
+ if ( saw_cellular_organism && saw_viruses ) {
+ break;
+ }
+ }
+ }
+ if ( saw_cellular_organism && saw_viruses ) {
+ last_common_lineage.add( UniProtTaxonomy.CELLULAR_ORGANISMS );
+ last_common = UniProtTaxonomy.CELLULAR_ORGANISMS;
+ }
+ else {
+ String msg = "no common lineage for:\n";
+ int counter = 0;
+ for( final String[] strings : lineages ) {
+ msg += counter + ": ";
+ ++counter;
+ for( final String string : strings ) {
+ msg += string + " ";
+ }
+ msg += "\n";
}
- msg += "\n";
+ throw new AncestralTaxonomyInferenceException( msg );
}
- throw new AncestralTaxonomyInferenceException( msg );
}
final Taxonomy tax = new Taxonomy();
n.getNodeData().setTaxonomy( tax );
&& ForesterUtil.isEmpty( tax.getScientificName() ) ) {
tax.setScientificName( up_tax.getScientificName() );
}
- if ( ( qt != QUERY_TYPE.CODE ) && !ForesterUtil.isEmpty( up_tax.getCode() )
+ if ( node.isExternal() && ( qt != QUERY_TYPE.CODE ) && !ForesterUtil.isEmpty( up_tax.getCode() )
&& ForesterUtil.isEmpty( tax.getTaxonomyCode() ) ) {
tax.setTaxonomyCode( up_tax.getCode() );
}
private final String _rank;
private final String _id;
public final static String CELLULAR_ORGANISMS = "cellular organisms";
+ public final static String VIRUSES = "Viruses";
public final static UniProtTaxonomy DROSOPHILA_GENUS = new UniProtTaxonomy( new String[] {
CELLULAR_ORGANISMS, EUKARYOTA, "Metazoa", "Arthropoda", "Hexapoda", "Insecta", "Pterygota", "Neoptera",
"Endopterygota", "Diptera", "Brachycera", "Muscomorpha", "Ephydroidea", "Drosophilidae", "Drosophila" },