Tabnine Logo
OntologyTerm
Code IndexAdd Tabnine to your IDE (free)

How to use
OntologyTerm
in
uk.ac.ebi.intact.bridges.ontologies.term

Best Java code snippets using uk.ac.ebi.intact.bridges.ontologies.term.OntologyTerm (Showing top 19 results out of 315)

origin: uk.ac.ebi.intact.bridges/intact-ontologies

protected Multimap<Integer, OntologyTerm> getChildren(OntologyTerm term, int currentDepth, int maxDepth) {
  if (currentDepth > maxDepth) {
    return HashMultimap.create();
  }
  Multimap<Integer,OntologyTerm> terms = HashMultimap.create();
  terms.put(currentDepth, term);
  for (OntologyTerm child : term.getChildren()) {
    terms.putAll(getChildren(child, currentDepth+1, maxDepth));
  }
  return terms;
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

protected Set<OntologyTerm> getAllParentsToRoot(OntologyTerm ontologyTerm, boolean includeSynonyms) {
  Set<OntologyTerm> parents = new HashSet<OntologyTerm>();
  for (OntologyTerm parent : ontologyTerm.getParents()) {
    parents.add(parent);
    if (includeSynonyms) {
      Set<OntologyTerm> synonyms = parent.getSynonyms();
      parents.addAll(synonyms);
    }
    parents.addAll(getAllParentsToRoot(parent, includeSynonyms));
  }
  return parents;
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

protected void enrichOrganism(String fieldName, String facetField, SolrInputDocument solrDocument, OntologyTerm ontologyTerm) {
  // name
  solrDocument.addField ( fieldName, ontologyTerm.getName( ) ) ;
  // synonyms
  for ( OntologyTerm synonym : ontologyTerm.getSynonyms ( ) ) {
    solrDocument.addField ( fieldName, synonym.getName() ) ;
  }
  // taxid
  solrDocument.addField ( fieldName, ontologyTerm.getId() ) ;
  // facet field
  if (facetField != null){
    solrDocument.addField(facetField, ontologyTerm.getName());
  }
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

private Field convertTermToField(String type, OntologyTerm term) {
  return new Field( type, term.getId(), term.getName() );
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

solrDocument.addField ( xrefFieldExact, ontologyTerm_aux.getName ( ) ) ;
solrDocument.addField ( xrefFieldName, ontologyTerm_aux.getName ( ) ) ;
for ( OntologyTerm synonym : ontologyTerm_aux.getSynonyms ( ) ) {
  solrDocument.addField ( xrefFieldExact, synonym.getName ( ) ) ;
  solrDocument.addField ( xrefFieldName, synonym.getName ( ) ) ;
for ( OntologyTerm parent : ontologyTerm_aux.getAllParentsToRoot ( true ) ) {
  solrDocument.addField ( xrefFieldName, parent.getId() ) ;
  solrDocument.addField ( xrefFieldName, parent.getName ( ) ) ;
  for ( OntologyTerm synonym : parent.getSynonyms ( ) ) {
    solrDocument.addField ( xrefFieldName, synonym.getName ( ) ) ;
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

public void enrichOrganism(Interaction interaction, SolrInputDocument solrDocument) throws SolrServerException {
  // retrieve the ontology term for this interaction (using BioSource)
  final OntologyTerm ontologyTerm = findOrganism(interaction) ;
  // add name, all synonyms and tax id to complex_organism
  if ( ontologyTerm != null ) {
    // enrich exact organism
    enrichOrganism(ComplexFieldNames.COMPLEX_ORGANISM_EXACT, null, solrDocument, ontologyTerm);
    // enrich organism for query
    enrichOrganism(ComplexFieldNames.COMPLEX_ORGANISM, ComplexFieldNames.COMPLEX_ORGANISM_F, solrDocument, ontologyTerm);
    // sort field
    solrDocument.addField(ComplexFieldNames.COMPLEX_ORGANISM_SORT, ontologyTerm.getId());
    // stored field to retrieve from the index
    solrDocument.addField(ComplexFieldNames.ORGANISM_NAME, ontologyTerm.getName()+"; "+ontologyTerm.getId());
    // add parents to complex_organism_ontology
    for ( OntologyTerm parent : ontologyTerm.getAllParentsToRoot ( true ) ) {
      enrichOrganism(ComplexFieldNames.COMPLEX_ORGANISM, null, solrDocument, parent);
    }
  }
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

  private Collection<Field> convertTermToFieldIncludingSynonyms(String type, OntologyTerm term) {
    Collection<Field> fields = new ArrayList<Field>();

    fields.add(convertTermToField(type, term));
    
    for (OntologyTerm synonymField : term.getSynonyms()) {
      fields.add(convertTermToField(type, synonymField));
    }

    return fields;
  }
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

public void enrich(Field field) throws SolrServerException {
  String db = field.get(CalimochoKeys.DB);
  if (fieldEnricher.isExpandableOntology(db)) {
    String id = field.get(CalimochoKeys.VALUE);
    OntologyTerm ontologyTerm = fieldEnricher.findOntologyTerm(id, null);
    field.set(CalimochoKeys.TEXT, ontologyTerm.getName());
  }
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

/**
 * @param field         the field for which we want to get the parents
 * @param includeItself if true, the passed field will be part of the collection (its description updated from the index)
 * @return list of cv terms with parents and itself
 */
public Collection<Field> getAllParents(psidev.psi.mi.tab.model.builder.Field field, boolean includeItself, boolean includeSynonyms) throws SolrServerException {
  if (ontologySearcher == null) {
    return Collections.EMPTY_LIST;
  }
  List<psidev.psi.mi.tab.model.builder.Field> allParents = null;
  final String type = field.getType();
  String identifier = field.getValue();
  if (cvCache.containsKey(identifier)) {
    return cvCache.get(identifier);
  }
  // fetch parents and fill the field list
  final OntologyTerm ontologyTerm = findOntologyTerm(field);
  final Set<OntologyTerm> parents = ontologyTerm.getAllParentsToRoot(includeSynonyms);
  allParents = convertTermsToFieldsIncludingSynonyms(type, parents);
  if (includeItself) {
    Collection<Field> itselfAndSynonyms = convertTermToFieldIncludingSynonyms(type, ontologyTerm);
    allParents.addAll(itselfAndSynonyms);
  }
  cvCache.put(identifier, allParents);
  return (allParents != null ? allParents : Collections.EMPTY_LIST);
}

origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

private List<Field> convertTermsToFieldsIncludingSynonyms(String type, Set<OntologyTerm> terms) {
  List<Field> fields = new ArrayList<Field>();
  if (terms != null) {
    for ( OntologyTerm term : terms ) {
      if (!getOntologyTermsToIgnore().contains(term.getId())){
        Collection<Field> fieldsWithSynonyms = convertTermToFieldIncludingSynonyms(type, term);
        fields.addAll( fieldsWithSynonyms );
      }
    }
  }
  return fields;
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

private Field convertTermToField(String type, OntologyTerm term) {
  Field field = new DefaultField( );
  field.set(CalimochoKeys.DB, type);
  field.set(CalimochoKeys.VALUE, term.getId());
  field.set(CalimochoKeys.TEXT, term.getName());
  return field;
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

  private Collection<Field> convertTermToFieldIncludingSynonyms(String type, OntologyTerm term) {
    Collection<Field> fields = new ArrayList<Field>();

    fields.add(convertTermToField(type, term));
    
    for (OntologyTerm synonymField : term.getSynonyms()) {
      fields.add(convertTermToField(type, synonymField));
    }

    return fields;
  }
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

public void enrich(CrossReference xref) throws SolrServerException {
  if (fieldEnricher.isExpandableOntology(xref.getDatabase())) {
    String id = xref.getIdentifier();
    OntologyTerm ontologyTerm = fieldEnricher.findOntologyTerm(id, null);
    xref.setText(ontologyTerm.getName());
  }
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

/**
 * @param field         the field for which we want to get the parents
 * @param includeItself if true, the passed field will be part of the collection (its description updated from the index)
 * @return list of cv terms with parents and itself
 */
public Collection<Field> getAllParents(Field field, boolean includeItself, boolean includeSynonyms) throws SolrServerException {
  if (ontologySearcher == null) {
    return Collections.EMPTY_LIST;
  }
  List<Field> allParents = null;
  final String type = field.get(CalimochoKeys.DB);
  String identifier = field.get(CalimochoKeys.VALUE);
  if (getOntologyTermsToIgnore().contains(identifier)){
    return Collections.EMPTY_LIST;
  }
  if (getCvCache().containsKey(identifier)) {
    return getCvCache().get(identifier);
  }
  // fetch parents and fill the field list
  final OntologyTerm ontologyTerm = findOntologyTerm(field);
  final Set<OntologyTerm> parents = ontologyTerm.getAllParentsToRoot(includeSynonyms);
  allParents = convertTermsToFieldsIncludingSynonyms(type, parents);
  if (includeItself) {
    Collection<Field> itselfAndSynonyms = convertTermToFieldIncludingSynonyms(type, ontologyTerm);
    allParents.addAll(itselfAndSynonyms);
  }
  getCvCache().put(identifier, allParents);
  return (allParents != null ? allParents : Collections.EMPTY_LIST);
}

origin: uk.ac.ebi.intact.bridges/intact-ontologies

protected Set<OntologyTerm> getAllParentsToRoot(OntologyTerm ontologyTerm, boolean includeSynonyms) {
  Set<OntologyTerm> parents = new HashSet<OntologyTerm>();
  for (OntologyTerm parent : ontologyTerm.getParents()) {
    parents.add(parent);
    if (includeSynonyms) {
      Set<OntologyTerm> synonyms = parent.getSynonyms();
      parents.addAll(synonyms);
    }
    
    parents.addAll(getAllParentsToRoot(parent, includeSynonyms));
  }
  return parents;
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

protected Multimap<Integer, OntologyTerm> getChildren(OntologyTerm term, int currentDepth, int maxDepth) {
  if (currentDepth > maxDepth) {
    return HashMultimap.create();
  }
  Multimap<Integer,OntologyTerm> terms = HashMultimap.create();
  terms.put(currentDepth, term);
  for (OntologyTerm child : term.getChildren()) {
    terms.putAll(getChildren(child, currentDepth+1, maxDepth));
  }
  return terms;
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

public void enrich(CrossReference xref) throws SolrServerException {
  if (fieldEnricher.isExpandableOntology(xref.getDatabase())) {
    String id = xref.getIdentifier();
    OntologyTerm ontologyTerm = fieldEnricher.findOntologyTerm(id, null);
    xref.setText(ontologyTerm.getName());
  }
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr

protected Set<OntologyTerm> getAllParentsToRoot(OntologyTerm ontologyTerm, boolean includeSynonyms) {
  Set<OntologyTerm> parents = new HashSet<OntologyTerm>();
  for (OntologyTerm parent : ontologyTerm.getParents()) {
    parents.add(parent);
    if (includeSynonyms) {
      Set<OntologyTerm> synonyms = parent.getSynonyms();
      parents.addAll(synonyms);
    }
    parents.addAll(getAllParentsToRoot(parent, includeSynonyms));
  }
  return parents;
}
origin: uk.ac.ebi.intact.dataexchange.psimi/intact-solr-core

protected Multimap<Integer, OntologyTerm> getChildren(OntologyTerm term, int currentDepth, int maxDepth) {
  if (currentDepth > maxDepth) {
    return HashMultimap.create();
  }
  Multimap<Integer,OntologyTerm> terms = HashMultimap.create();
  terms.put(currentDepth, term);
  for (OntologyTerm child : term.getChildren()) {
    terms.putAll(getChildren(child, currentDepth+1, maxDepth));
  }
  return terms;
}
uk.ac.ebi.intact.bridges.ontologies.termOntologyTerm

Javadoc

Represents a term in an ontology.

Most used methods

  • getChildren
    Children of the term.
  • getParents
    Parents of the term.
  • getSynonyms
    Gets the synonyms for this ontology term.
  • getAllParentsToRoot
    Gets a set that contains all the parent terms until the root is reached. The root is included.
  • getId
    Id of the term.
  • getName
    Name of the term.

Popular in Java

  • Running tasks concurrently on multiple threads
  • startActivity (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • getSharedPreferences (Context)
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • BigInteger (java.math)
    An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Collectors (java.util.stream)
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now