Search in sources :

Example 1 with TaxonFetcher

use of ubic.gemma.core.loader.genome.taxon.TaxonFetcher in project Gemma by PavlidisLab.

the class TaxonLoaderCli method doWork.

@Override
protected Exception doWork(String[] args) {
    try {
        Exception err = processCommandLine(args);
        if (err != null)
            return err;
        TaxonFetcher tf = new TaxonFetcher();
        Collection<LocalFile> files = tf.fetch();
        LocalFile names = null;
        for (LocalFile file : files) {
            if (file.getLocalURL().toString().endsWith("names.dmp")) {
                names = file;
            }
        }
        if (names == null) {
            throw new IllegalStateException("No names.dmp file");
        }
        TaxonLoader tl = new TaxonLoader();
        tl.setPersisterHelper(this.getBean(PersisterHelper.class));
        int numLoaded = tl.load(names.asFile());
        log.info("Loaded " + numLoaded + " taxa");
    } catch (Exception e) {
        log.error(e);
        return e;
    }
    return null;
}
Also used : TaxonLoader(ubic.gemma.core.loader.genome.taxon.TaxonLoader) LocalFile(ubic.gemma.model.common.description.LocalFile) TaxonFetcher(ubic.gemma.core.loader.genome.taxon.TaxonFetcher) PersisterHelper(ubic.gemma.persistence.persister.PersisterHelper)

Aggregations

TaxonFetcher (ubic.gemma.core.loader.genome.taxon.TaxonFetcher)1 TaxonLoader (ubic.gemma.core.loader.genome.taxon.TaxonLoader)1 LocalFile (ubic.gemma.model.common.description.LocalFile)1 PersisterHelper (ubic.gemma.persistence.persister.PersisterHelper)1