use of ubic.basecode.ontology.model.OntologyTermSimple in project Gemma by PavlidisLab.
the class OntologyServiceImpl method initializeCategoryTerms.
private synchronized void initializeCategoryTerms() {
URL termUrl = OntologyServiceImpl.class.getResource("/ubic/gemma/core/ontology/EFO.factor.categories.txt");
OntologyServiceImpl.categoryTerms = new ConcurrentHashSet<>();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(termUrl.openStream()))) {
String line;
boolean warned = false;
while ((line = reader.readLine()) != null) {
if (line.startsWith("#") || StringUtils.isEmpty(line))
continue;
String[] f = StringUtils.split(line, '\t');
if (f.length < 2) {
continue;
}
OntologyTerm t = this.getTerm(f[0]);
if (t == null) {
// available. Inference will not be available.
if (!warned) {
OntologyServiceImpl.log.info("Ontology needed is not loaded? Using light-weight placeholder for " + f[0] + " (further warnings hidden)");
warned = true;
}
t = new OntologyTermSimple(f[0], f[1]);
}
OntologyServiceImpl.categoryTerms.add(t);
}
} catch (IOException ioe) {
OntologyServiceImpl.log.error("Error reading from term list '" + termUrl + "'; returning general term list", ioe);
OntologyServiceImpl.categoryTerms = null;
}
OntologyServiceImpl.categoryTerms = Collections.unmodifiableCollection(OntologyServiceImpl.categoryTerms);
}
Aggregations