use of org.nextprot.api.core.service.TerminologyService in project nextprot-api by calipho-sib.
the class GenerateSolrTerminologyIndex method start.
@Override
public void start(String[] args) {
TerminologyService terminologyService = getBean(TerminologyService.class);
int termcnt = 0;
String solrServer = System.getProperty("solr.server");
NPreconditions.checkNotNull(solrServer, "Please set solr.server variable. For example: java -Dsolr.server=\"http://localhost:8983/solr/npcvs1\"");
logger.info("Solr server: " + solrServer);
// eg: java -Dsolr.ontology="UniprotFamilyCv" (don't forget CamelCasing)
String ontologyToReindex = System.getProperty("solr.ontology");
SolrIndexer<CvTerm> indexer = new CvTermSolrIndexer(solrServer);
List<CvTerm> allterms;
if (ontologyToReindex == null) {
// No arg: index all ontologies
System.err.println("indexing: all ontologies");
logger.info("indexing all terminologies");
indexer.clearDatabase("");
allterms = terminologyService.findAllCVTerms();
} else {
// Index ontology given as VM argument
System.err.println("indexing: " + ontologyToReindex);
logger.info("indexing terminology: " + ontologyToReindex);
indexer.clearDatabase("filters:" + ontologyToReindex);
allterms = terminologyService.findCvTermsByOntology(ontologyToReindex);
}
for (CvTerm term : allterms) {
indexer.add(term);
termcnt++;
if ((termcnt % 3000) == 0)
logger.info(termcnt + "/" + allterms.size() + " cv terms done");
}
indexer.addRemaing();
logger.info("comitting");
indexer.commit();
logger.info(termcnt + " terms indexed...END");
}
use of org.nextprot.api.core.service.TerminologyService in project nextprot-api by calipho-sib.
the class DbXrefAnalyserTask method analyseCvTermsDbXrefs.
private void analyseCvTermsDbXrefs() throws IOException {
LOGGER.info("**** Analysing dbxrefs from terminology...");
DbXrefUrlVisitor visitor = new DbXrefUrlVisitor(outputDirectory + "/allterminologies-xrefs-url.tsv", outputDirectory + "/allterminologies-xrefs-url.log");
TerminologyService terminologyService = getBean(TerminologyService.class);
List<CvTerm> allCvTerms = terminologyService.findAllCVTerms();
ConsoleProgressBar pb = ConsoleProgressBar.determinated("analysing dbxrefs (from neXtProt cv terms)", allCvTerms.size());
pb.start();
for (CvTerm terminology : allCvTerms) {
visitor.visit(terminology.getAccession(), terminology.getXrefs());
visitor.flush();
pb.incrementValue();
}
visitor.flush();
visitor.close();
pb.stop();
}
use of org.nextprot.api.core.service.TerminologyService in project nextprot-api by calipho-sib.
the class IsoformPEFFHeaderBuilderTest method newIsoformPEFFHeaderBuilder.
private IsoformPEFFHeaderBuilder newIsoformPEFFHeaderBuilder(String isoName) {
String entryAccession = isoformService.findEntryAccessionFromIsoformAccession(isoName);
Isoform isoform = isoformService.findIsoform(isoName);
List<Annotation> isoformAnnotations = annotationService.findAnnotations(entryAccession).stream().filter(annotation -> annotation.isSpecificForIsoform(isoName)).collect(Collectors.toList());
Overview overview = overviewService.findOverviewByEntry(entryAccession);
return new IsoformPEFFHeaderBuilder(isoform, isoformAnnotations, overview, terminologyService::findPsiModAccession, terminologyService::findPsiModName);
}
Aggregations