use of org.nextprot.api.core.domain.CvTerm in project nextprot-api by calipho-sib.
the class OntologyDAGAnalyserTask method readWriteCache.
private void readWriteCache(boolean readCacheForSure) {
Set<String> allCvTerms = new HashSet<>();
ConsoleProgressBar pb = ConsoleProgressBar.determinated(((readCacheForSure) ? "read" : "read/write") + " terminology-by-ontology cache", terminologyCvs.length);
pb.start();
Instant t = Instant.now();
for (TerminologyCv ontology : terminologyCvs) {
allCvTerms.addAll(terminologyService.findCvTermsByOntology(ontology.name()).stream().map(CvTerm::getAccession).collect(Collectors.toSet()));
pb.incrementValue();
}
pb.stop();
System.out.println("\ttiming 'terminology-by-ontology': " + ChronoUnit.SECONDS.between(t, Instant.now()) + " s");
pb = ConsoleProgressBar.determinated(((readCacheForSure) ? "read" : "read/write") + " 'ontology-dag' cache", terminologyCvs.length);
pb.start();
t = Instant.now();
for (TerminologyCv ontology : terminologyCvs) {
cvTermGraphService.findCvTermGraph(ontology);
pb.incrementValue();
}
pb.stop();
System.out.println("\ttiming 'ontology-dag': " + ChronoUnit.SECONDS.between(t, Instant.now()) + " s");
pb = ConsoleProgressBar.determinated(((readCacheForSure) ? "read" : "read/write") + " 'terminology-by-accession' cache", allCvTerms.size());
pb.start();
t = Instant.now();
for (String cvTerm : allCvTerms) {
terminologyService.findCvTermByAccession(cvTerm);
pb.incrementValue();
}
pb.stop();
System.out.println("\ttiming 'terminology-by-accession': " + ChronoUnit.SECONDS.between(t, Instant.now()) + " s");
}
use of org.nextprot.api.core.domain.CvTerm 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.domain.CvTerm in project nextprot-api by calipho-sib.
the class TerminologyDaoImpl method findTerminologyByOntology.
public List<CvTerm> findTerminologyByOntology(String ontology) {
SqlParameterSource params = new MapSqlParameterSource("ontology", ontology);
List<CvTerm> terms = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("terminology-by-ontology"), params, new DbTermRowMapper());
return terms;
}
use of org.nextprot.api.core.domain.CvTerm in project nextprot-api by calipho-sib.
the class TerminologyDaoImpl method findTerminologyByAccessions.
@Override
public List<CvTerm> findTerminologyByAccessions(Set<String> accessions) {
SqlParameterSource params = new MapSqlParameterSource("accessions", accessions);
List<CvTerm> terms = new NamedParameterJdbcTemplate(dsLocator.getDataSource()).query(sqlDictionary.getSQLQuery("terminology-by-acs"), params, new DbTermRowMapper());
return terms;
}
use of org.nextprot.api.core.domain.CvTerm in project nextprot-api by calipho-sib.
the class ConsistencyServiceImpl method findMissingCvTerms.
@Override
public List<String> findMissingCvTerms() {
List<String> missingCvTerms = new ArrayList<>();
List<String> terms = statementDao.findAllDistinctValuesforField(StatementField.ANNOT_CV_TERM_ACCESSION);
for (String t : terms) {
if (t != null) {
CvTerm term = terminologyService.findCvTermByAccession(t);
if (term == null) {
missingCvTerms.add(t);
}
}
}
return missingCvTerms;
}
Aggregations