package jalview.ext.ensembl; import static org.testng.Assert.assertEquals; import jalview.bin.Cache; import jalview.ext.ensembl.EnsemblSpecies.EnsemblTaxon; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import org.testng.annotations.Test; import junit.extensions.PA; public class EnsemblSpeciesTest { @Test(groups = "Network") public void testGetSpecies_ensembl() { Cache.log = Logger.getRootLogger(); EnsemblSpecies species = EnsemblSpecies.getSpecies(true); System.out.println("Ensembllookup map size = " + ((Map) PA.getValue(species, "lookup")).size()); List matches = species.getNameMatches("homo sapiens"); assertEquals(matches.size(), 1); EnsemblTaxon match = matches.get(0); assertEquals(match.ncbiId, "9606"); matches = species.getNameMatches("mus "); assertEquals(matches.size(), 6); match = matches.get(0); assertEquals(match.ncbiId, "10089"); assertEquals(match.name, "mus_caroli"); match = matches.get(1); assertEquals(match.ncbiId, "10090"); assertEquals(match.commonName, "house mouse"); match = matches.get(2); assertEquals(match.ncbiId, "10091"); assertEquals(match.displayName, "Mouse CAST/EiJ"); assertEquals(match.commonName, "south eastern house mouse"); } @Test(groups = "Network") public void testGetSpecies_ensemblGenomes() { Cache.log = Logger.getRootLogger(); EnsemblSpecies species = EnsemblSpecies.getSpecies(false); System.out.println("EnsemblGenomes lookup map size = " + ((Map) PA.getValue(species, "lookup")).size()); List matches = species.getNameMatches("streptomyces al"); assertEquals(matches.size(), 12); assertEquals(matches.get(0).ncbiId, "132473"); assertEquals(matches.get(0).name, "streptomyces_alboniger"); assertEquals(matches.get(1).ncbiId, "68570"); assertEquals(matches.get(1).displayName, "Streptomyces albulus"); assertEquals(matches.get(2).ncbiId, "68570"); assertEquals(matches.get(2).name, "streptomyces_albulus_gca_001646665"); } }