use of org.nextprot.api.commons.app.ConsoleProgressBar 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.commons.app.ConsoleProgressBar in project nextprot-api by calipho-sib.
the class DbXrefAnalyserTask method analyseNextprotEntriesDbXrefs.
private void analyseNextprotEntriesDbXrefs() throws IOException {
LOGGER.info("**** Analysing dbxrefs from entry accession...");
ConsoleProgressBar pb;
try (DbXrefUrlVisitor visitor = new DbXrefUrlVisitor(outputDirectory + "/allentries-xrefs-url.tsv", outputDirectory + "/allentries-xrefs-url.log")) {
DbXrefService xrefService = getBean(DbXrefService.class);
Set<String> allEntryAcs = getNextprotEntries();
pb = ConsoleProgressBar.determinated("analysing dbxrefs (from neXtProt entries)", allEntryAcs.size());
pb.start();
for (String entryAc : allEntryAcs) {
try {
visitor.visit(entryAc, xrefService.findDbXrefsByMaster(entryAc));
visitor.flush();
pb.incrementValue();
} catch (EntryNotFoundException e) {
LOGGER.error(e.getMessage() + ": skipping entry " + entryAc);
}
}
visitor.flush();
visitor.close();
}
pb.stop();
}
use of org.nextprot.api.commons.app.ConsoleProgressBar 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.commons.app.ConsoleProgressBar in project nextprot-api by calipho-sib.
the class PeffServiceValidatorTask method readExpectedIsoformPeffHeaders.
private Map<String, Map<String, Object>> readExpectedIsoformPeffHeaders() throws FileNotFoundException {
ConsoleProgressBar pb = ConsoleProgressBar.indeterminated("reading expected peff headers from file");
try {
ExpectedPeffParser parser = new ExpectedPeffParser();
pb.run(Files.lines(Paths.get(expectedPeffFilename)).filter(l -> l.startsWith(">nxp:")), parser);
return parser.isoToPeffHeader;
} catch (IOException e) {
throw new IllegalStateException(e.getMessage() + ": cannot open file nextprot_all_updatedTo1.0h.peff");
}
}
use of org.nextprot.api.commons.app.ConsoleProgressBar in project nextprot-api by calipho-sib.
the class PeffServiceValidatorTask method getIsoformPeffHeadersFromAPI.
private Map<String, Map<String, Object>> getIsoformPeffHeadersFromAPI() throws FileNotFoundException {
Set<String> allEntryAcs = getNextprotEntries();
ConsoleProgressBar pb = ConsoleProgressBar.determinated("querying peff headers from api", allEntryAcs.size());
ObservedPeffCollector collector = new ObservedPeffCollector(getBean(IsoformService.class));
pb.run(allEntryAcs.stream(), collector);
return collector.map;
}
Aggregations