Skip to content

Commit

Permalink
Merge pull request #161 from SynBioDex/InteractionNodes
Browse files Browse the repository at this point in the history
Interaction nodes
  • Loading branch information
cjmyers authored May 3, 2021
2 parents aab7a74 + 9c2d3ab commit b00240b
Show file tree
Hide file tree
Showing 23 changed files with 1,497 additions and 295 deletions.
63 changes: 44 additions & 19 deletions SBOLCanvasBackend/src/data/InteractionInfo.java
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
package data;

import utils.Converter;
import java.util.Hashtable;

public class InteractionInfo extends Info {

private String displayID;
private String interactionType;
private String fromParticipationType;
private String toParticipationType;
private String fromURI;
private String toURI;

public String getFromURI() {
return fromURI;
}

public void setFromURI(String fromURI) {
this.fromURI = fromURI;
}

public String getToURI() {
return toURI;
}
private Hashtable<String, String> sourceRefinement;
private Hashtable<String, String> targetRefinement;
private Hashtable<String, String> fromURI;
private Hashtable<String, String> toURI;

public void setToURI(String toURI) {
this.toURI = toURI;
public InteractionInfo() {
sourceRefinement = new Hashtable<String, String>();
targetRefinement = new Hashtable<String, String>();
fromURI = new Hashtable<String, String>();
toURI = new Hashtable<String, String>();
}

public String getDisplayID() {
return displayID;
}
Expand Down Expand Up @@ -59,7 +52,39 @@ public void setToParticipationType(String toParticipationType) {
this.toParticipationType = toParticipationType;
}

public Hashtable<String, String> getSourceRefinement() {
return sourceRefinement;
}

public void setSourceRefinement(Hashtable<String, String> sourceRefinement) {
this.sourceRefinement = sourceRefinement;
}

public Hashtable<String, String> getTargetRefinement() {
return targetRefinement;
}

public void setTargetRefinement(Hashtable<String, String> targetRefinement) {
this.targetRefinement = targetRefinement;
}

public Hashtable<String, String> getFromURI() {
return fromURI;
}

public void setFromURI(Hashtable<String, String> fromURI) {
this.fromURI = fromURI;
}

public Hashtable<String, String> getToURI() {
return toURI;
}

public void setToURI(Hashtable<String, String> toURI) {
this.toURI = toURI;
}

public String getFullURI() {
return Converter.URI_PREFIX+'/'+this.displayID;
return this.uriPrefix + '/' + this.displayID;
}
}
9 changes: 9 additions & 0 deletions SBOLCanvasBackend/src/servlets/Data.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
body = gson.toJson(SBOLData.getRefinement(parent));
} else if (request.getPathInfo().equals("/interactions")) {
body = gson.toJson(SBOLData.getInteractions());
}else if (request.getPathInfo().equals("/interactionRoles")) {
body = gson.toJson(SBOLData.getInteractionRoles());
}else if (request.getPathInfo().equals("/interactionRoleRefine")) {
String parent = request.getParameter("parent");
if(parent == null) {
response.setStatus(HttpStatus.SC_BAD_REQUEST);
return;
}
body = gson.toJson(SBOLData.getInteractionRoleRefinement(parent));
}

// write it to the response body
Expand Down
11 changes: 11 additions & 0 deletions SBOLCanvasBackend/src/utils/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import data.CombinatorialInfo;
import data.Info;
import data.InteractionInfo;

public class Converter {

Expand All @@ -24,6 +25,7 @@ public class Converter {
// data constants
public static final int INFO_DICT_INDEX = 0;
public static final int COMBINATORIAL_DICT_INDEX = 1;
public static final int INTERACTION_DICT_INDEX = 2;

// style constants
protected static final String STYLE_CIRCUIT_CONTAINER = "circuitContainer";
Expand All @@ -37,6 +39,7 @@ public class Converter {
protected static final String STYLE_INTERACTION = "interactionGlyph";
protected static final String STYLE_MODULE_VIEW = "moduleViewCell";
protected static final String STYLE_COMPONENT_VIEW = "componentViewCell";
protected static final String STYLE_INTERACTION_NODE = "interactionNodeGlyph";

static {
// Necessary for encoding/decoding GlyphInfo and InteractionInfo
Expand All @@ -45,6 +48,7 @@ public class Converter {

protected Hashtable<String, Info> infoDict;
protected Hashtable<String, CombinatorialInfo> combinatorialDict;
protected Hashtable<String, InteractionInfo> interactionDict;
protected LayoutHelper layoutHelper;

/**
Expand Down Expand Up @@ -107,6 +111,13 @@ public boolean filter(Object arg0) {
}
};

static Filter interactionNodeFilter = new Filter() {
@Override
public boolean filter(Object arg0) {
return arg0 instanceof mxCell && ((mxCell) arg0).getStyle().contains(STYLE_INTERACTION_NODE);
}
};

protected static URI getParticipantType(boolean source, Set<URI> interactionTypes) {
if (interactionTypes.contains(SystemsBiologyOntology.BIOCHEMICAL_REACTION)) {
return source ? SystemsBiologyOntology.REACTANT : SystemsBiologyOntology.PRODUCT;
Expand Down
Loading

0 comments on commit b00240b

Please sign in to comment.