use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class ExperimentalDesignImporterTestC method setup.
@Before
public void setup() throws Exception {
/*
* Have to add ssal for this platform.
*/
super.executeSqlScript("/script/sql/add-fish-taxa.sql", false);
Taxon salmon = taxonService.findByCommonName("atlantic salmon");
assertNotNull(salmon);
/*
* Load the array design (platform).
*/
geoService.setGeoDomainObjectGenerator(new GeoDomainObjectGeneratorLocal(this.getTestFileBasePath("designLoadTests")));
geoService.fetchAndLoad("GPL2899", true, true, false);
ArrayDesign ad = arrayDesignService.findByShortName("GPL2899");
assertNotNull(ad);
SimpleExpressionExperimentMetaData metaData = new SimpleExpressionExperimentMetaData();
metaData.setShortName(RandomStringUtils.randomAlphabetic(10));
metaData.setDescription("bar");
metaData.setIsRatio(false);
metaData.setTaxon(salmon);
metaData.setQuantitationTypeName("value");
metaData.setScale(ScaleType.LOG2);
metaData.setType(StandardQuantitationType.AMOUNT);
metaData.getArrayDesigns().add(ad);
try (InputStream data = this.getClass().getResourceAsStream("/data/loader/expression/geo/designLoadTests/expressionDataBrain2003TestFile.txt")) {
ee = simpleExpressionDataLoaderService.create(metaData, data);
}
// ee = this.eeService.thawLite( ee );
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class GeoConverterTest method testMultipleTaxaIdentifiedBYAbbreviationsOnArrayWithOrganismColumn.
/*
* Method to test that an array design can have multiple taxa stored against it and that if abbreviations used as
* probe names mapped to the scientific names correctly if the abbreviation is stored in DB.
*/
@Test
public void testMultipleTaxaIdentifiedBYAbbreviationsOnArrayWithOrganismColumn() throws Exception {
Taxon rainbowTroat = taxonService.findByAbbreviation("omyk");
Taxon whiteFish = taxonService.findByAbbreviation("cclu");
Taxon rainbowSmelt = taxonService.findByAbbreviation("omor");
Taxon atlanticSalm = taxonService.findByAbbreviation("ssal");
assertNotNull(atlanticSalm);
// prototype bean.
gc = this.getBean(GeoConverter.class);
InputStream is = new GZIPInputStream(this.getClass().getResourceAsStream("/data/loader/expression/geo/GPL2899_family.soft.gz"));
GeoFamilyParser parser = new GeoFamilyParser();
// parse only the plaform
parser.setProcessPlatformsOnly(true);
parser.parse(is);
GeoPlatform platform = ((GeoParseResult) parser.getResults().iterator().next()).getPlatformMap().get("GPL2899");
Object result = gc.convert(platform);
ArrayDesign ad = (ArrayDesign) result;
assertNotNull(ad);
Set<Taxon> taxa = new HashSet<>();
BioSequence bs;
for (CompositeSequence cs : ad.getCompositeSequences()) {
bs = cs.getBiologicalCharacteristic();
if (bs != null) {
assertNotNull(bs.getTaxon());
taxa.add(bs.getTaxon());
}
}
assertEquals(4, taxa.size());
// original file has five taxa, test file just kept four.
assertTrue(taxa.contains(atlanticSalm));
assertTrue(taxa.contains(rainbowTroat));
assertTrue(taxa.contains(whiteFish));
assertTrue(taxa.contains(rainbowSmelt));
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class BioMartEnsemblNcbiFetcherTest method testGetBioMartTaxonName.
/*
* Tests that given a scientific named taxon taxon name is formatted correctly for biomart
*/
@Test
public void testGetBioMartTaxonName() {
Taxon taxon = Taxon.Factory.newInstance();
taxon.setScientificName("Homo sapiens");
String biomartFormatedString = biomartEnsemblNcbiFetcher.getBiomartTaxonName(taxon);
assertNotNull(biomartFormatedString);
assertTrue(biomartFormatedString.equals("hsapiens"));
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class StringProteinLinksDetailedParserTest method setUp.
@Before
public void setUp() {
// set up an array of taxon to process
Taxon taxon = Taxon.Factory.newInstance();
taxon.setNcbiId(882);
Taxon taxon2 = Taxon.Factory.newInstance();
taxon2.setNcbiId(10090);
ArrayList<Taxon> taxa = new ArrayList<>();
taxa.add(taxon);
taxa.add(taxon2);
parser = new StringProteinProteinInteractionFileParser();
parser.setTaxa(taxa);
}
use of ubic.gemma.model.genome.Taxon in project Gemma by PavlidisLab.
the class StringProteinLoadCli method getValidTaxon.
/**
* If a taxon is supplied on the command line then process protein interactions for that taxon. If no taxon is
* supplied then create a list of valid taxon to process from those stored in gemma: Criteria are does this taxon
* have usable genes and is it a species.
*
* @return Collection of Taxa to process
*/
private Collection<Taxon> getValidTaxon() {
Taxon taxon;
TaxonService taxonService = this.getBean(TaxonService.class);
Collection<Taxon> taxa = new ArrayList<>();
if (taxonName != null && StringUtils.isNotBlank(taxonName)) {
taxon = taxonService.findByCommonName(taxonName);
if (taxon == null || !(taxon.getIsSpecies()) || !(taxon.getIsGenesUsable())) {
throw new IllegalArgumentException("The taxon common name supplied: " + taxonName + " Either does not match anything in GEMMA, or is not a species or does have usable genes");
}
taxa.add(taxon);
} else {
for (Taxon taxonGemma : taxonService.loadAll()) {
// only those taxon that are species and have usable genes should be processed
if (taxonGemma != null && taxonGemma.getIsSpecies() && taxonGemma.getIsGenesUsable() && (taxonGemma.getCommonName() != null) && !(taxonGemma.getCommonName().isEmpty())) {
taxa.add(taxonGemma);
}
}
if (taxa.isEmpty()) {
throw new RuntimeException("There are no valid taxa in GEMMA to process. Valid taxon are those that are species and have usable genes.");
}
AbstractCLI.log.info("Processing " + taxa.size() + "taxa ");
}
return taxa;
}
Aggregations