Skip to content

Commit

Permalink
Merge pull request #46 from EBI-IntAct/store-interactor-xrefs-in-solr
Browse files Browse the repository at this point in the history
Store interactor xrefs in solr
  • Loading branch information
jmedinaebi authored Sep 26, 2024
2 parents f1615df + 181ee86 commit cd95a06
Show file tree
Hide file tree
Showing 34 changed files with 134 additions and 34 deletions.
2 changes: 1 addition & 1 deletion complex-go-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<artifactId>complex-go-export</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion complex-pdb-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<artifactId>complex-pdb-export</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion complex-tab-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>


Expand Down
2 changes: 1 addition & 1 deletion complex-uniprot-dr-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<artifactId>complex-uniprot-dr-export</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cttv-exporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion imex-id-update/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<groupId>uk.ac.ebi.intact.dataexchange.imex</groupId>
Expand Down
2 changes: 1 addition & 1 deletion intact-cvutils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion intact-db-importer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<artifactId>intact-db-importer</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion intact-enricher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>intact-dataexchange-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion intact-mi-cluster-score/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>intact-dataexchange-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<artifactId>intact-mi-cluster-score</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion intact-mutation-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion intact-orthology-import/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<artifactId>intact-orthology-import</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion intact-pdbe-import/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion intact-tasks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion intact-uniprot-export/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<packaging>pom</packaging>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>

<name>IntAct Data Exchange</name>
<description>Data Exchange Master POM</description>
Expand Down
2 changes: 1 addition & 1 deletion psimi/intact-psimi-exporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<artifactId>intact-psimi-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<artifactId>intact-psimi-exporter</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion psimi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange</groupId>
<artifactId>intact-dataexchange-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/intact-calimocho-converters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>psimitab-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<artifactId>intact-calimocho-converters</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/intact-jami-mitab/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<artifactId>psimitab-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<artifactId>intact-jami-mitab</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/intact-psimitab-converters/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>psimitab-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/intact-solr-home/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>psimitab-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/intact-solr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>psimitab-master</artifactId>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package uk.ac.ebi.intact.dataexchange.psimi.solr.complex;

import java.util.List;

public class ComplexInteractor {

/*************************/
Expand All @@ -15,14 +17,16 @@ public ComplexInteractor(String identifier,
String description,
String stochiometry,
String interactorType,
String organismName) {
String organismName,
List<ComplexInteractorXref> xrefs) {
this.identifier = identifier;
this.identifierLink = identifierLink;
this.name = name;
this.description = description;
this.stochiometry = stochiometry;
this.interactorType = interactorType;
this.organismName = organismName;
this.xrefs = xrefs;
}

/*********************************/
Expand Down Expand Up @@ -85,6 +89,14 @@ public void setOrganismName(String organismName) {
this.organismName = organismName;
}

public List<ComplexInteractorXref> getXrefs() {
return xrefs;
}

public void setXrefs(List<ComplexInteractorXref> xrefs) {
this.xrefs = xrefs;
}

/********************************/
/* Private attributes */
/********************************/
Expand All @@ -96,4 +108,5 @@ public void setOrganismName(String organismName) {
private String stochiometry = null;
private String interactorType;
private String organismName;
private List<ComplexInteractorXref> xrefs;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package uk.ac.ebi.intact.dataexchange.psimi.solr.complex;

public class ComplexInteractorXref {

/*************************/
/* Constructors */
/*************************/

public ComplexInteractorXref() {
}

public ComplexInteractorXref(String identifier,
String identifierLink,
String database,
String qualifier) {
this.identifier = identifier;
this.identifierLink = identifierLink;
this.database = database;
this.qualifier = qualifier;
}

/*********************************/
/* Getters and Setters */
/*********************************/

public String getIdentifier() {
return identifier;
}

public void setIdentifier(String identifier) {
this.identifier = identifier;
}

public String getIdentifierLink() {
return identifierLink;
}

public void setIdentifierLink(String identifierLink) {
this.identifierLink = identifierLink;
}

public String getDatabase() {
return database;
}

public void setDatabase(String database) {
this.database = database;
}

public String getQualifier() {
return qualifier;
}

public void setQualifier(String qualifier) {
this.qualifier = qualifier;
}

/********************************/
/* Private attributes */
/********************************/

private String identifier = null;
private String identifierLink = null;
private String database = null;
private String qualifier = null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import uk.ac.ebi.intact.bridges.ontologies.term.OntologyTerm;
import uk.ac.ebi.intact.dataexchange.psimi.solr.complex.ComplexFieldNames;
import uk.ac.ebi.intact.dataexchange.psimi.solr.complex.ComplexInteractor;
import uk.ac.ebi.intact.dataexchange.psimi.solr.complex.ComplexInteractorXref;
import uk.ac.ebi.intact.dataexchange.psimi.solr.ontology.OntologySearcher;
import uk.ac.ebi.intact.dataexchange.psimi.solr.util.ComplexUtils;
import uk.ac.ebi.intact.model.*;
Expand All @@ -20,6 +21,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;

/**
* Complex Field Enricher is such as Ontoly Field Enricher
Expand All @@ -38,8 +40,12 @@ public class ComplexSolrEnricher extends AbstractOntologyEnricher{
private PsimiTabReader reader;
private final ObjectMapper mapper;

private final static String EXP_EVIDENCE="exp-evidence";
private final static String INTACT_SECONDARY="intact-secondary";
private static final String EXP_EVIDENCE="exp-evidence";
private static final String INTACT_SECONDARY="intact-secondary";

// Currently, we are only storing interactors xrefs from the following databases:
// - panther (MI:0702)
private static final Set<String> INTERACTOR_XREF_DATABASE_MIS_TO_STORE = Set.of("MI:0702");

/*************************/
/* Constructor */
Expand Down Expand Up @@ -202,14 +208,25 @@ public void enrichSerialisedParticipant(Component participant, SolrInputDocument
Interactor interactor = participant.getInteractor();
String identifier = ComplexUtils.getParticipantIdentifier(participant);

List<ComplexInteractorXref> xrefs = interactor.getXrefs().stream()
.filter(xref -> xref.getCvDatabase() != null)
.filter(xref -> INTERACTOR_XREF_DATABASE_MIS_TO_STORE.contains(xref.getCvDatabase().getIdentifier()))
.map(xref -> new ComplexInteractorXref(
xref.getPrimaryId(),
ComplexUtils.getIdentifierLink(xref, xref.getPrimaryId()),
xref.getCvDatabase() != null ? xref.getCvDatabase().getShortLabel() : null,
xref.getCvXrefQualifier() != null ? xref.getCvXrefQualifier().getShortLabel() : null))
.collect(Collectors.toList());

ComplexInteractor complexInteractor = new ComplexInteractor(
identifier,
ComplexUtils.getParticipantIdentifierLink(participant, identifier),
ComplexUtils.getParticipantName(participant),
interactor.getFullName(),
ComplexUtils.getParticipantStoichiometry(participant),
interactor.getCvInteractorType().getFullName(),
findInteractorOrganismName(interactor));
findInteractorOrganismName(interactor),
xrefs);
String serialisedInteractor = mapper.writeValueAsString(complexInteractor);
solrDocument.addField(ComplexFieldNames.SERIALISED_INTERACTION, serialisedInteractor);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ public static String getParticipantIdentifier(Component participant) {

public static String getParticipantIdentifierLink(Component participant, String identifier) {
InteractorXref xref = getParticipantIdentifierXref(participant);
return getIdentifierLink(xref, identifier);
}

public static String getIdentifierLink(InteractorXref xref, String identifier) {
if (xref != null && xref.getParent() != null) {
Annotation annot = AnnotatedObjectUtils.findAnnotationByTopicMiOrLabel(xref.getCvDatabase(), SEARCH_MI);
if (annot == null) {
Expand Down
2 changes: 1 addition & 1 deletion psimi/psimitab/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>uk.ac.ebi.intact.dataexchange.psimi</groupId>
<artifactId>intact-psimi-master</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Loading

0 comments on commit cd95a06

Please sign in to comment.