Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
f12af5c
:sparkles: introduce the molecule type for re when it's used as an in…
cqgong Apr 5, 2024
93a926d
:truck: Move reactome-pwp repos to reactome organisation
EliotRagueneau Nov 5, 2024
23c3467
Merge remote-tracking branch 'origin/dev' into dev
EliotRagueneau Nov 5, 2024
0f875fc
:loud_sound: Make logs use maven properties properly
EliotRagueneau Nov 6, 2024
ea366f7
:sparkles: Support bounded physical entity subunits
EliotRagueneau Dec 12, 2024
fa72c48
:recycle: Support additional views where relationships have explicit …
EliotRagueneau Dec 20, 2024
7703a31
:white_check_mark: Update some tests
EliotRagueneau Dec 20, 2024
84d9f87
:bug: Ignore new fake fields from ReactomeSchema
EliotRagueneau Jan 6, 2025
d4bc5e3
:bug: Fix Class cast issue with getComposedOf
EliotRagueneau Jan 16, 2025
ff1c5e6
:card_file_box: Include refs in enhanced cypher query
cqgong Jan 20, 2025
551c88f
Merge branch 'feature/add-molecule-type' into feature/new-pwb-changes
cqgong Jan 20, 2025
f815654
:card_file_box: Include authors from publication
cqgong Jan 20, 2025
fe64f74
Merge branch 'feature/enhanced-query-with-refs' into feature/new-pwb-…
cqgong Jan 20, 2025
cee8703
Ref. tests
alexgrent Jan 27, 2025
aba7513
:wheelchair: Access person info for instanceEdit
cqgong Jan 30, 2025
9572242
Test Ref test DB
alexgrent Jan 31, 2025
2f27db7
Merge remote-tracking branch 'origin/feature/nested-components' into …
EliotRagueneau Jan 31, 2025
65bba7e
Merge branch 'refs/heads/feature/nested-components' into feature/new-…
EliotRagueneau Jan 31, 2025
135f2b5
:sparkles: Add diseasePathways
EliotRagueneau Jan 31, 2025
db119dd
Advanced linkage service mock ref
alexgrent Feb 3, 2025
9214fc0
:sparkles: Support enhancedQuery for drugs end chemicals
EliotRagueneau Feb 6, 2025
6e5f01b
Test Refactoring
alexgrent Feb 10, 2025
8e676f5
Test Ref CompartmentTest
alexgrent Feb 10, 2025
a608cd2
Test Ref Database object
alexgrent Feb 10, 2025
ecb2930
Test Ref Database with ID
alexgrent Feb 10, 2025
c8ec339
Test Ref DeletedInstanceServiceTest
alexgrent Feb 10, 2025
5069811
Test Ref Delted service test
alexgrent Feb 10, 2025
9e0f8a0
TR Diagram service Test
alexgrent Feb 11, 2025
8e7a754
TR DOI test
alexgrent Feb 11, 2025
c99d424
TR Events service Test, change Basetests top level pathway
alexgrent Feb 12, 2025
1ef6346
TR inffered to
alexgrent Feb 12, 2025
b31bad6
TR Mapping Service
alexgrent Feb 13, 2025
64a5750
:sparkles: Custom interaction query for new UI
cqgong Feb 13, 2025
9746a06
:loud_sound: Configue logs to use @logging.level@ and say where they …
EliotRagueneau Feb 14, 2025
13d7f66
:adhesive_bandage: Add missing URL to custom interaction
cqgong Feb 14, 2025
c6b6120
:mute: Remove neo4j warning
EliotRagueneau Feb 15, 2025
5d38c18
Merge remote-tracking branch 'origin/feature/new-pwb-changes' into fe…
EliotRagueneau Feb 15, 2025
e74e5f4
:mute: Remove neo4j warning
EliotRagueneau Feb 15, 2025
da229d7
:rotating_light: Avoid error on getDeleted
EliotRagueneau Feb 15, 2025
fdf62db
TR InteractionTest
alexgrent Feb 17, 2025
3829429
TR Mapping service test
alexgrent Feb 18, 2025
64f4c40
TR OrthologyServiceTest
alexgrent Feb 18, 2025
12de08d
Base test adapation
alexgrent Feb 18, 2025
77746d9
TR ParticipantServiceTest
alexgrent Feb 18, 2025
68810e5
TR PathwaysService
alexgrent Feb 19, 2025
3a626a5
TR PathwaysService, PersonServiceTest
alexgrent Feb 19, 2025
76c0415
base test adaption
alexgrent Feb 19, 2025
e60fb67
physical test service ref
alexgrent Feb 19, 2025
caa1e7a
test ref, schem, publication, reference entity
alexgrent Feb 20, 2025
4222424
test ref SchemaDatasetTest
alexgrent Feb 24, 2025
8cfdc88
test ref SortingAspectsTest
alexgrent Feb 24, 2025
cfa78cb
test ref species service
alexgrent Feb 24, 2025
df55a49
test ref update tracker
alexgrent Feb 24, 2025
aa5f991
test ref bug Physical Entity
alexgrent Feb 25, 2025
af8b22c
test StabilityAndConsistencyTest
alexgrent Feb 25, 2025
cd08eb9
bug MappingService
alexgrent Feb 25, 2025
cb4a920
bug InteractionTest
alexgrent Feb 25, 2025
cde77c9
bug SpeciesServiceTest
alexgrent Feb 25, 2025
70a654b
Merge remote-tracking branch 'origin/feature/new-pwb-changes' into 16…
alexgrent Feb 26, 2025
94e1944
bug db version
alexgrent Feb 26, 2025
7732ca8
GKinstance test
alexgrent Feb 26, 2025
c5bec12
test ref
alexgrent Feb 26, 2025
139ae25
test ref BUG fix
alexgrent Feb 27, 2025
3305d00
test hysical entity bug fix
alexgrent Feb 27, 2025
e6a1e4d
test add ewas data
alexgrent Feb 27, 2025
92d81b3
test ref
alexgrent Feb 28, 2025
2c2b849
test ref
alexgrent Mar 3, 2025
ce3b3d1
Ref Tests
alexgrent Mar 4, 2025
80d8ece
Location pathway browser
alexgrent Mar 4, 2025
21341b2
bug test
alexgrent Mar 4, 2025
c970a2b
bug test
alexgrent Mar 4, 2025
756d447
Relationship refactoring
alexgrent Mar 10, 2025
2baf75e
base test
alexgrent Mar 12, 2025
f2ec762
add modifcation Enum
alexgrent Mar 12, 2025
9948241
enum reacitonType
alexgrent Mar 12, 2025
3fde312
base test
alexgrent Mar 16, 2025
6f4e2a0
hierachy test
alexgrent Mar 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
<artifactId>graph-core</artifactId>

<packaging>jar</packaging>
<version>2.0.9</version>
<name>Graph Core Next Generation</name>
<version>2.0.10-SNAPSHOT</version>
<name>Graph Core</name>

<description>
The Reactome Graph Project aims to model the Reactome knowledgebase into a interconnected graph. For more
Expand Down Expand Up @@ -111,6 +111,12 @@
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.voodoodyne.jackson.jsog</groupId>
<artifactId>jackson-jsog</artifactId>
<version>1.1.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -119,7 +125,7 @@
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<filtering>true</filtering>
</resource>
</resources>

Expand Down Expand Up @@ -249,6 +255,20 @@
<artifactId>maven-source-plugin</artifactId>
<version>${maven.source.version}</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven.source.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
20 changes: 10 additions & 10 deletions src/main/java/org/reactome/server/graph/aop/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<img src=https://cloud.githubusercontent.com/assets/6883670/22938783/bbef4474-f2d4-11e6-92a5-07c1a6964491.png width=220 height=100 />

Aspect-Oriented Programming with Spring
Aspect Oriented Programming with Spring
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was better before

===

:warning: Changes in this package have to be taken carefully, considering it is going to reflect in the whole application

### What is Aspect-Oriented Programming - AOP?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was better before

Spring AOP framework is used to modularize cross-cutting concerns in aspects. Simply, it’s just an interceptor to intercept some processes, for example, when a method is executed, Spring AOP can hijack the executing method, and add extra functionality before or after the method execution. The most used feature is logging.
Spring AOP framework is used to modularize cross-cutting concerns in aspects. Simply, t’s just an interceptor to intercept some processes, for example, when a method is execute, Spring AOP can hijack the executing method, and add extra functionality before or after the method execution. The most used feature is logging.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was better before

However, in Reactome, we are taking benefit of this concept in order to implement our own Lazy-Loading mechanism. This functionality is also available in ORM frameworks, such as, Hibernate and to achieve this they are implementing AOP concepts. Sorting and Logging aspect are present as well.

Complete information on Spring AOP you'll find [here](https://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html).
Complete information of Spring AOP you'll find [here](https://docs.spring.io/spring/docs/current/spring-framework-reference/html/aop.html).

### What are the `@PointCut` in Reactome for LazyLoading?
### What are the `@PointCut` in Reactome for LazyLoading ?

```java
execution(public java.util.Collection<org.reactome.server.graph.domain.model.DatabaseObject+>+ org.reactome.server.graph.domain.model.*.get*(..))
Expand All @@ -24,7 +24,7 @@ execution(public org.reactome.server.graph.domain.model.DatabaseObject+ org.reac
```
Intercepting ALL the getters in our Domain Model whose return type is `DatabaseObject` or `instance of`

### How does it work?
### How does it work ?

Mainly, we are loading DEPTH{2} data from the graph without any relationship previously loaded, only identifiers. Once intercepted, the code checks whether the AOP is enabled and whether the object has been loaded previously. Substantially using Java Reflection, the code is capable to identify all the information regarding the method that has been intercepted, for instance, return type (`Collection` or `DatabaseObject`) and `@Relationship` which contains important information for querying against the Graph. Up to this point, the data have been retrieve and the code invokes the setter and proceed.

Expand Down Expand Up @@ -95,19 +95,19 @@ public LazyFetchAspect lazyFetchAspect() {
</plugin>
```

#### What is the flag `enableAOP`?
#### What is the flag `enableAOP` ?

The AOP is enabled by default, but in certain projects like [Content Service](https://github.com/reactome/content-service.git) where we respond a serialised JSON, the `@PointCut` will be invoked everywhere, every time, endless times. Thus, given the `Content Service` requirements, it makes sense that we disable this feature. However, we kept it enabled in the [Data Content](https://github.com/reactome/data-content).
The AOP is enabled by default, but in certain projects like [Content Service](https://github.com/reactome/content-service.git) where we respond a serialised JSON, the `@PointCut` will be invoked every where, every time, endless times. Thus, given the requirements of the `Content Service` it makes sense that we disable this feature. However, in the [Data Content](https://github.com/reactome/data-content) we kept it enabled.


=

### SortingAspect?
### SortingAspect ?

Intercepting ALL the getters in our Domain Model whose return type is `Collection<? extends DatabaseObject>` and sorting the list based on the `displayName`.

=

### LoggingAspect?
### LoggingAspect ?

Logging everything at the service level. The package `service` is being intercepted to measure the execution time.
Logging everything at the service level. The package `service` is being intercepted in order to measure the execution time.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.reactome.server.graph.domain.annotations;

public class StoichiometryView {

public interface Flatten { }

public interface Nested { }

public interface NestedAggregated extends Nested { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Relationship;


@SuppressWarnings("unused")
@Node
public abstract class AbstractModifiedResidue extends DatabaseObject {

@Relationship(type = "referenceSequence")
@Relationship(type = Relationships.REFERENCE_SEQUENCE)
private ReferenceSequence referenceSequence;

public AbstractModifiedResidue() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public String getExplanation() {

}

@Relationship(type = "templateEvent")
@Relationship(type = Relationships.TEMPLATE_EVENT)
private Event templateEvent;

public BlackBoxEvent() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Book extends Publication {
@ReactomeProperty
private Integer year;

@Relationship(type = "publisher")
@Relationship(type = Relationships.PUBLISHER)
private Affiliation publisher;

public Book() {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,55 @@
package org.reactome.server.graph.domain.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonView;
import org.reactome.server.graph.domain.annotations.ReactomeSchemaIgnore;
import org.reactome.server.graph.domain.annotations.StoichiometryView;
import org.reactome.server.graph.domain.relationship.Has;
import org.reactome.server.graph.domain.relationship.HasCandidate;
import org.reactome.server.graph.domain.relationship.CompositionAggregator;
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Relationship;

import java.util.*;
import java.util.stream.Stream;

/**
* A set of entities that are interchangeable in function, with two subclasses, members that are hypothetical and members that have been demonstrated. Hypothetical members are identified as values of the hasCandidate slot. Members that have been demonstrated are identified in the hasMember slot. At least one hasCandidate value is required; hasMember values are optional.
*/
@SuppressWarnings("unused")
@Node
public class CandidateSet extends EntitySet {
public class CandidateSet extends EntitySet implements CompositionAggregator {

@Relationship(type = "hasCandidate")
@Relationship(type = Relationships.HAS_CANDIDATE)
private SortedSet<HasCandidate> hasCandidate;

public CandidateSet() {}
@Override
public Stream<? extends Collection<? extends Has<? extends DatabaseObject>>> defineCompositionRelations() {
return Stream.concat(super.defineCompositionRelations(), Stream.of(hasCandidate));
}

public CandidateSet() {
}

@ReactomeSchemaIgnore
@JsonView(StoichiometryView.Nested.class)
public SortedSet<HasCandidate> getCandidates() {
return hasCandidate;
}

@JsonView(StoichiometryView.Nested.class)
public void setCandidates(SortedSet<HasCandidate> hasCandidate) {
this.hasCandidate = hasCandidate;
}

@JsonView(StoichiometryView.Flatten.class)
public List<PhysicalEntity> getHasCandidate() {
List<PhysicalEntity> rtn = null;
if (hasCandidate != null) {
rtn = new ArrayList<>();
//stoichiometry does NOT need to be taken into account here
for (HasCandidate candidate : hasCandidate) {
rtn.add(candidate.getPhysicalEntity());
}
}
return rtn;
return Has.Util.expandStoichiometry(this.hasCandidate);
}

@JsonView(StoichiometryView.Flatten.class)
public void setHasCandidate(List<PhysicalEntity> hasCandidate) {
if (hasCandidate == null) return;
Map<Long, HasCandidate> components = new LinkedHashMap<>();
int order = 0;
for (PhysicalEntity physicalEntity : hasCandidate) {
//stoichiometry does NOT need to be taken into account here
HasCandidate aux = new HasCandidate();
// aux.setEntitySet(this);
aux.setPhysicalEntity(physicalEntity);
aux.setOrder(order++);
components.put(physicalEntity.getDbId(), aux);
}
this.hasCandidate = new TreeSet<>(components.values());
this.hasCandidate = Has.Util.aggregateStoichiometry(hasCandidate, HasCandidate::new);
}

@ReactomeSchemaIgnore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@
@Node
public class CatalystActivity extends DatabaseObject {

@Relationship(type = "activeUnit")
@Relationship(type = Relationships.ACTIVE_UNIT)
private Set<PhysicalEntity> activeUnit;

@Relationship(type = "activity")
@Relationship(type = Relationships.ACTIVITY)
private GO_MolecularFunction activity;

/**
* catalyzedEvent is not a field of the previous RestfulApi and will be ignored until needed
*/
@JsonIgnore
@ReactomeTransient
@Relationship(type = "catalystActivity", direction = Relationship.Direction.INCOMING)
@Relationship(type = Relationships.CATALYST_ACTIVITY, direction = Relationship.Direction.INCOMING)
private List<ReactionLikeEvent> catalyzedEvent;

@Relationship(type = "physicalEntity")
@Relationship(type = Relationships.PHYSICAL_ENTITY)
private PhysicalEntity physicalEntity;

@Relationship(type = "literatureReference")
@Relationship(type = Relationships.LITERATURE_REFERENCE)
private List<Publication> literatureReference;

public CatalystActivity() {}
Expand Down
29 changes: 21 additions & 8 deletions src/main/java/org/reactome/server/graph/domain/model/Cell.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,47 @@
package org.reactome.server.graph.domain.model;

import com.fasterxml.jackson.annotation.JsonGetter;
import org.reactome.server.graph.domain.relationship.CompositionAggregator;
import org.reactome.server.graph.domain.relationship.Has;
import org.springframework.data.neo4j.core.schema.Node;
import org.springframework.data.neo4j.core.schema.Relationship;

import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;

@Node
public class Cell extends PhysicalEntity {
@Relationship(type = "RNAMarker")
public class Cell extends PhysicalEntity implements CompositionAggregator {
@Relationship(type = Relationships.RNA_MARKER)
private List<EntityWithAccessionedSequence> RNAMarker;

@Relationship(type = "markerReference")
@Relationship(type = Relationships.MARKER_REFERENCE)
private List<MarkerReference> markerReference;

@Relationship(type = "organ")
@Relationship(type = Relationships.ORGAN)
private Anatomy organ;

@Relationship(type = "proteinMarker")
@Relationship(type = Relationships.PROTEIN_MARKER)
private List<EntityWithAccessionedSequence> proteinMarker;

@Relationship(type = "species")
@Relationship(type = Relationships.SPECIES)
private List<Taxon> species;

@Relationship(type = "tissue")
@Relationship(type = Relationships.TISSUE)
private Anatomy tissue;

@Relationship(type = "tissueLayer")
@Relationship(type = Relationships.TISSUE_LAYER)
private Anatomy tissueLayer;

@Override
public Stream<? extends Collection<? extends Has<? extends DatabaseObject>>> defineCompositionRelations() {
return Stream.of(
Has.Util.wrapUniqueElements(RNAMarker, "rnaMarker"),
Has.Util.wrapUniqueElements(proteinMarker, "proteinMarker")
);
}

public Cell() {

}
Expand Down
Loading