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");
}
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);
}
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'");
}
}
}
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);
}
}
}
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;
}
Aggregations