Search in sources :

Example 6 with TaxonService

use of ubic.gemma.persistence.service.genome.taxon.TaxonService in project Gemma by PavlidisLab.

the class ArrayDesignAnnotationFileCli method processGenesForTaxon.

private void processGenesForTaxon() {
    GeneService geneService = this.getBean(GeneService.class);
    TaxonService taxonService = this.getBean(TaxonService.class);
    Taxon taxon = taxonService.findByCommonName(taxonName);
    if (taxon == null) {
        throw new IllegalArgumentException("Unknown taxon: " + taxonName);
    }
    AbstractCLI.log.info("Processing all genes for " + taxon);
    Collection<Gene> genes = geneService.loadAll(taxon);
    AbstractCLI.log.info("Taxon has " + genes.size() + " 'known' genes");
    int numProcessed = arrayDesignAnnotationService.generateAnnotationFile(new PrintWriter(System.out), genes, type);
    AbstractCLI.log.info("Processed " + numProcessed + " genes that were found");
}
Also used : GeneService(ubic.gemma.core.genome.gene.service.GeneService) TaxonService(ubic.gemma.persistence.service.genome.taxon.TaxonService) Gene(ubic.gemma.model.genome.Gene) Taxon(ubic.gemma.model.genome.Taxon)

Example 7 with TaxonService

use of ubic.gemma.persistence.service.genome.taxon.TaxonService in project Gemma by PavlidisLab.

the class ArrayDesignBlatCli method processOptions.

@Override
protected void processOptions() {
    super.processOptions();
    if (this.hasOption("sensitive")) {
        this.sensitive = true;
    }
    if (this.hasOption('b')) {
        this.blatResultFile = this.getOptionValue('b');
    }
    if (this.hasOption(AbstractCLI.THREADS_OPTION)) {
        this.numThreads = this.getIntegerOptionValue("threads");
    }
    if (this.hasOption('s')) {
        this.blatScoreThreshold = this.getDoubleOptionValue('s');
    }
    TaxonService taxonService = this.getBean(TaxonService.class);
    if (this.hasOption('t')) {
        String taxonName = this.getOptionValue('t');
        this.taxon = taxonService.findByCommonName(taxonName);
        if (taxon == null) {
            throw new IllegalArgumentException("No taxon named " + taxonName);
        }
    }
    arrayDesignSequenceAlignmentService = this.getBean(ArrayDesignSequenceAlignmentService.class);
}
Also used : TaxonService(ubic.gemma.persistence.service.genome.taxon.TaxonService) ArrayDesignSequenceAlignmentService(ubic.gemma.core.loader.expression.arrayDesign.ArrayDesignSequenceAlignmentService)

Example 8 with TaxonService

use of ubic.gemma.persistence.service.genome.taxon.TaxonService in project Gemma by PavlidisLab.

the class ArrayDesignProbeMapperCli method processOptions.

/**
 * See 'configure' for how the other options are handled. (non-Javadoc)
 *
 * @see ArrayDesignSequenceManipulatingCli#processOptions()
 */
@Override
protected void processOptions() {
    super.processOptions();
    arrayDesignProbeMapperService = this.getBean(ArrayDesignProbeMapperService.class);
    TaxonService taxonService = this.getBean(TaxonService.class);
    if (this.hasOption(AbstractCLI.THREADS_OPTION)) {
        this.numThreads = this.getIntegerOptionValue("threads");
    }
    if (this.hasOption("import")) {
        if (!this.hasOption('t')) {
            throw new IllegalArgumentException("You must provide the taxon when using the import option");
        }
        if (!this.hasOption("source")) {
            throw new IllegalArgumentException("You must provide source database name when using the import option");
        }
        String sourceDBName = this.getOptionValue("source");
        ExternalDatabaseService eds = this.getBean(ExternalDatabaseService.class);
        this.sourceDatabase = eds.findByName(sourceDBName);
        this.directAnnotationInputFileName = this.getOptionValue("import");
        if (this.hasOption("ncbi")) {
            this.ncbiIds = true;
        }
    }
    if (this.hasOption('t')) {
        this.taxon = this.setTaxonByName(taxonService);
    }
    if (this.hasOption("nodb")) {
        this.useDB = false;
    }
    if (this.hasOption("probes")) {
        if (this.arrayDesignsToProcess == null || this.arrayDesignsToProcess.size() > 1) {
            throw new IllegalArgumentException("With '-probes' you must provide exactly one platform");
        }
        this.useDB = false;
        probeNames = this.getOptionValue("probes").split(",");
        if (probeNames.length == 0) {
            throw new IllegalArgumentException("You must provide at least one probe name when using '-probes'");
        }
    }
}
Also used : ExternalDatabaseService(ubic.gemma.persistence.service.common.description.ExternalDatabaseService) TaxonService(ubic.gemma.persistence.service.genome.taxon.TaxonService) ArrayDesignProbeMapperService(ubic.gemma.core.loader.expression.arrayDesign.ArrayDesignProbeMapperService)

Example 9 with TaxonService

use of ubic.gemma.persistence.service.genome.taxon.TaxonService in project Gemma by PavlidisLab.

the class MultifunctionalityCli method processOptions.

@Override
protected void processOptions() {
    super.processOptions();
    if (this.hasOption('t')) {
        String taxonName = this.getOptionValue('t');
        TaxonService taxonService = this.getBean(TaxonService.class);
        this.taxon = taxonService.findByCommonName(taxonName);
        if (taxon == null) {
            AbstractCLI.log.error("ERROR: Cannot find taxon " + taxonName);
        }
    }
}
Also used : TaxonService(ubic.gemma.persistence.service.genome.taxon.TaxonService)

Example 10 with TaxonService

use of ubic.gemma.persistence.service.genome.taxon.TaxonService in project Gemma by PavlidisLab.

the class NcbiGeneLoaderCLI method doWork.

@Override
protected Exception doWork(String[] args) {
    Exception err = this.processCommandLine(args);
    if (err != null)
        return err;
    loader = new NcbiGeneLoader();
    TaxonService taxonService = this.getBean(TaxonService.class);
    loader.setTaxonService(taxonService);
    loader.setPersisterHelper(this.getPersisterHelper());
    loader.setSkipDownload(this.skipDownload);
    loader.setStartingNcbiId(startNcbiId);
    Taxon t = null;
    if (StringUtils.isNotBlank(taxonCommonName)) {
        t = taxonService.findByCommonName(this.taxonCommonName);
        if (t == null) {
            throw new IllegalArgumentException("Unrecognized taxon: " + taxonCommonName);
        }
    }
    if (filePath != null) {
        String geneInfoFile = filePath + File.separatorChar + NcbiGeneLoaderCLI.GENE_INFO_FILE;
        String gene2AccFile = filePath + File.separatorChar + NcbiGeneLoaderCLI.GENE2ACCESSION_FILE;
        String geneHistoryFile = filePath + File.separatorChar + NcbiGeneLoaderCLI.GENE_HISTORY_FILE;
        String geneEnsemblFile = filePath + File.separatorChar + NcbiGeneLoaderCLI.GENE2ENSEMBL_FILE;
        if (t != null) {
            loader.load(geneInfoFile, gene2AccFile, geneHistoryFile, geneEnsemblFile, t);
        } else {
            // do filtering of
            loader.load(geneInfoFile, gene2AccFile, geneHistoryFile, geneEnsemblFile, true);
        // taxa
        }
    } else {
        /* defaults to download files remotely. */
        if (t != null) {
            loader.load(t);
        } else {
            loader.load(true);
        }
    }
    return null;
}
Also used : TaxonService(ubic.gemma.persistence.service.genome.taxon.TaxonService) Taxon(ubic.gemma.model.genome.Taxon) NcbiGeneLoader(ubic.gemma.core.loader.genome.gene.ncbi.NcbiGeneLoader)

Aggregations

TaxonService (ubic.gemma.persistence.service.genome.taxon.TaxonService)10 Taxon (ubic.gemma.model.genome.Taxon)6 GeneService (ubic.gemma.core.genome.gene.service.GeneService)3 Gene (ubic.gemma.model.genome.Gene)2 ExternalDatabaseService (ubic.gemma.persistence.service.common.description.ExternalDatabaseService)2 File (java.io.File)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 ArrayDesignReportService (ubic.gemma.core.analysis.report.ArrayDesignReportService)1 ArrayDesignAnnotationService (ubic.gemma.core.analysis.service.ArrayDesignAnnotationService)1 NCBIGene2GOAssociationLoader (ubic.gemma.core.loader.association.NCBIGene2GOAssociationLoader)1 NCBIGene2GOAssociationParser (ubic.gemma.core.loader.association.NCBIGene2GOAssociationParser)1 ArrayDesignProbeMapperService (ubic.gemma.core.loader.expression.arrayDesign.ArrayDesignProbeMapperService)1 ArrayDesignSequenceAlignmentService (ubic.gemma.core.loader.expression.arrayDesign.ArrayDesignSequenceAlignmentService)1 NcbiGeneLoader (ubic.gemma.core.loader.genome.gene.ncbi.NcbiGeneLoader)1 HttpFetcher (ubic.gemma.core.loader.util.fetcher.HttpFetcher)1 LocalFile (ubic.gemma.model.common.description.LocalFile)1 ArrayDesign (ubic.gemma.model.expression.arrayDesign.ArrayDesign)1