use of org.vcell.pathway.Pathway in project vcell by virtualcell.
the class PathwayReaderBiopax3 method addContentControl.
private boolean addContentControl(Control control, Element element, Element childElement) {
if (addContentInteraction(control, element, childElement)) {
return true;
}
/**
* InteractionImpl controlledInteraction
* Pathway controlledPathway
* String controlType
* ArrayList<Pathway> pathwayControllers
* ArrayList<PhysicalEntity> physicalControllers
*/
if (childElement.getName().equals("controller")) {
// if (resourceAttribute != null){
if (childElement.getChildren().size() == 0) {
// if there are no children it must be a resource inside another object
// we don't know yet whether it's Interaction or Pathway, we make a proxy for each
// at the time when we solve the references we'll find out which is fake
PhysicalEntityProxy proxyE = new PhysicalEntityProxy();
addAttributes(proxyE, childElement);
pathwayModel.add(proxyE);
control.addPhysicalController(proxyE);
PathwayProxy proxyP = new PathwayProxy();
addAttributes(proxyP, childElement);
pathwayModel.add(proxyP);
control.getPathwayControllers().add(proxyP);
return true;
} else {
for (Object child : element.getChildren()) {
if (child instanceof Element) {
if (((Element) child).getName().equals("Pathway")) {
Pathway thingie = addObjectPathway((Element) child);
control.getPathwayControllers().add(thingie);
return true;
} else if (((Element) child).getName().equals("Complex")) {
Complex thingie = addObjectComplex((Element) child);
control.getPhysicalControllers().add(thingie);
return true;
} else if (((Element) child).getName().equals("Dna")) {
Dna thingie = addObjectDna((Element) child);
control.getPhysicalControllers().add(thingie);
return true;
} else if (((Element) child).getName().equals("DnaRegion")) {
DnaRegion thingie = addObjectDnaRegion((Element) child);
control.getPhysicalControllers().add(thingie);
return true;
} else if (((Element) child).getName().equals("Rna")) {
Rna thingie = addObjectRna((Element) child);
control.getPhysicalControllers().add(thingie);
return true;
} else if (((Element) child).getName().equals("RnaRegion")) {
RnaRegion thingie = addObjectRnaRegion((Element) child);
control.getPhysicalControllers().add(thingie);
return true;
} else if (((Element) child).getName().equals("Protein")) {
Protein thingie = addObjectProtein((Element) child);
control.getPhysicalControllers().add(thingie);
return true;
} else if (((Element) child).getName().equals("SmallMolecule")) {
SmallMolecule thingie = addObjectSmallMolecule((Element) child);
control.getPhysicalControllers().add(thingie);
return true;
} else {
return false;
}
}
}
}
return false;
} else if (childElement.getName().equals("controlled")) {
if (childElement.getChildren().size() == 0) {
InteractionProxy proxyI = new InteractionProxy();
addAttributes(proxyI, childElement);
pathwayModel.add(proxyI);
control.setControlledInteraction(proxyI);
PathwayProxy proxyP = new PathwayProxy();
addAttributes(proxyP, childElement);
pathwayModel.add(proxyP);
control.setControlledPathway(proxyP);
return true;
} else {
for (Object child : childElement.getChildren()) {
if (child instanceof Element) {
if (((Element) child).getName().equals("Pathway")) {
Pathway thingie = addObjectPathway((Element) child);
control.setControlledPathway(thingie);
return true;
} else {
Interaction thingie = (Interaction) addObjectBioPaxObjectSubclass((Element) child);
if (thingie == null) {
return false;
} else {
control.setControlledInteraction(thingie);
return true;
}
}
// if(((Element)child).getName().equals("Pathway")) {
// Pathway thingie = addObjectPathway((Element)child);
// control.setControlledPathway(thingie);
// return true;
// } else if(((Element)child).getName().equals("Interaction")) {
// Interaction thingie = addObjectInteraction((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("Control")) {
// Control thingie = addObjectControl((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("Modulation")) {
// Modulation thingie = addObjectModulation((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("Catalysis")) {
// Catalysis thingie = addObjectCatalysis((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("TemplateReactionRegulation")) {
// TemplateReactionRegulation thingie = addObjectTemplateReactionRegulation((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("Conversion")) {
// Conversion thingie = addObjectConversion((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("BiochemicalReaction")) {
// BiochemicalReaction thingie = addObjectBiochemicalReaction((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("TransportWithBiochemicalReaction")) {
// TransportWithBiochemicalReaction thingie = addObjectTransportWithBiochemicalReaction((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("ComplexAssembly")) {
// ComplexAssembly thingie = addObjectComplexAssembly((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("Degradation")) {
// Degradation thingie = addObjectDegradation((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("Transport")) {
// Transport thingie = addObjectTransport((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("GeneticInteraction")) {
// GeneticInteraction thingie = addObjectGeneticInteraction((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("MolecularInteraction")) {
// MolecularInteraction thingie = addObjectMolecularInteraction((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else if(((Element)child).getName().equals("TemplateReaction")) {
// TemplateReaction thingie = addObjectTemplateReaction((Element)child);
// control.setControlledInteraction(thingie);
// return true;
// } else {
// return false;
// }
}
}
}
return false;
} else if (childElement.getName().equals("controlType")) {
control.setControlType(childElement.getTextTrim());
return true;
} else {
return false;
}
}
use of org.vcell.pathway.Pathway in project vcell by virtualcell.
the class PathwayProducerBiopax3 method addContentPathwayStep.
// stepProcess Interaction multiple
// stepProcess Pathway multiple
// nextStep PathwayStep multiple
// evidence Evidence multiple
private Element addContentPathwayStep(BioPaxObject bpObject, Element element) {
element = addContentUtilityClass(bpObject, element);
PathwayStep ob = (PathwayStep) bpObject;
Element tmpElement = null;
if (ob.getStepProcessInteraction() != null && ob.getStepProcessInteraction().size() > 0) {
List<Interaction> list = ob.getStepProcessInteraction();
for (Interaction item : list) {
tmpElement = new Element("stepProcess", bp);
addIDToProperty(tmpElement, item);
mustPrintObject(item);
element.addContent(tmpElement);
}
}
if (ob.getStepProcessPathway() != null && ob.getStepProcessPathway().size() > 0) {
List<Pathway> list = ob.getStepProcessPathway();
for (Pathway item : list) {
tmpElement = new Element("stepProcess", bp);
addIDToProperty(tmpElement, item);
mustPrintObject(item);
element.addContent(tmpElement);
}
}
if (ob.getNextStep() != null && ob.getNextStep().size() > 0) {
List<PathwayStep> list = ob.getNextStep();
for (PathwayStep item : list) {
tmpElement = new Element("nextStep", bp);
addIDToProperty(tmpElement, item);
mustPrintObject(item);
element.addContent(tmpElement);
}
}
if (ob.getEvidence() != null && ob.getEvidence().size() > 0) {
List<Evidence> list = ob.getEvidence();
for (Evidence item : list) {
tmpElement = new Element("evidence", bp);
addIDToProperty(tmpElement, item);
mustPrintObject(item);
element.addContent(tmpElement);
}
}
return element;
}
use of org.vcell.pathway.Pathway in project vcell by virtualcell.
the class BioModelEditorConversionTableModel method refreshData.
private void refreshData() {
if (bioModel == null || bioModel.getPathwayModel() == null || bioPaxObjects == null) {
setData(null);
return;
}
// function I :: get selected objects only
// create ConversionTableRow objects
allPathwayObjectList = new ArrayList<ConversionTableRow>();
convertedBPObjects = new HashSet<BioPaxObject>();
printObjects(bioPaxObjects);
BioModel.printBpModelObjects(bioModel.getPathwayModel().getBiopaxObjects());
// BioModel.printBpRelationshipObjects(bioModel.getRelationshipModel().getBioPaxObjects()); // derived; the bpObjects that are part of a relationship
BioModel.printRelationships(bioModel.getRelationshipModel().getRelationshipObjects());
System.out.println("----------------------------------------------------------------------");
for (BioPaxObject bpo : bioPaxObjects) {
if (bpo instanceof Conversion) {
if (bioModel.getRelationshipModel().getRelationshipObjects(bpo).size() == 0) {
Conversion conversion = (Conversion) bpo;
ArrayList<String> nameList = conversion.getName();
String interactionId = conversion.getID();
String interactionLabel = nameList.isEmpty() ? conversion.getIDShort() : nameList.get(0);
ConversionTableRow newConversionTableRow = createTableRow(conversion, interactionId, interactionLabel, "Conversion", 1.0, null);
allPathwayObjectList.add(newConversionTableRow);
convertedBPObjects.add(bpo);
ArrayList<Stoichiometry> stoichiometryList = conversion.getParticipantStoichiometry();
// stoichiometryMap problem:
// how to deal with the case that the same object occurs on both left and right sides
HashMap<PhysicalEntity, Double> stoichiometryMap = createStoichiometryMap(stoichiometryList);
// reactant
for (BioPaxObject bpObject1 : conversion.getLeft()) {
Double stoich = 1.0;
if (stoichiometryMap.get((PhysicalEntity) bpObject1) != null) {
stoich = stoichiometryMap.get((PhysicalEntity) bpObject1);
}
ConversionTableRow conversionTableRow;
if (bioModel.getRelationshipModel().getRelationshipObjects(bpObject1).isEmpty()) {
if (conversion instanceof Transport)
conversionTableRow = createTableRowForTransportParticipant(bpObject1, interactionId, interactionLabel, "Reactant", stoich, null);
else
conversionTableRow = createTableRow(bpObject1, interactionId, interactionLabel, "Reactant", stoich, null);
} else {
if (conversion instanceof Transport)
conversionTableRow = createTableRowForTransportParticipant(bpObject1, interactionId, interactionLabel, "Reactant", stoich, bioModel.getRelationshipModel().getRelationshipObjects(bpObject1));
else
conversionTableRow = createTableRow(bpObject1, interactionId, interactionLabel, "Reactant", stoich, bioModel.getRelationshipModel().getRelationshipObjects(bpObject1));
}
allPathwayObjectList.add(conversionTableRow);
convertedBPObjects.add(bpObject1);
}
// product
for (BioPaxObject bpObject1 : conversion.getRight()) {
Double stoich = 1.0;
if (stoichiometryMap.get((PhysicalEntity) bpObject1) != null) {
stoich = stoichiometryMap.get((PhysicalEntity) bpObject1);
}
ConversionTableRow conversionTableRow;
if (bioModel.getRelationshipModel().getRelationshipObjects(bpObject1).isEmpty()) {
if (conversion instanceof Transport)
conversionTableRow = createTableRowForTransportParticipant(bpObject1, interactionId, interactionLabel, "Product", stoich, null);
else
conversionTableRow = createTableRow(bpObject1, interactionId, interactionLabel, "Product", stoich, null);
} else {
if (conversion instanceof Transport)
conversionTableRow = createTableRowForTransportParticipant(bpObject1, interactionId, interactionLabel, "Product", stoich, bioModel.getRelationshipModel().getRelationshipObjects(bpObject1));
else
conversionTableRow = createTableRow(bpObject1, interactionId, interactionLabel, "Product", stoich, bioModel.getRelationshipModel().getRelationshipObjects(bpObject1));
}
allPathwayObjectList.add(conversionTableRow);
convertedBPObjects.add(bpObject1);
}
// control
for (BioPaxObject bpObject : bioModel.getPathwayModel().getBiopaxObjects()) {
if (bpObject instanceof Control) {
Control control = (Control) bpObject;
if (control instanceof Catalysis) {
// catalysis
if (BioPAXUtil.getControlledNonControlInteraction(control) == conversion) {
for (PhysicalEntity pe : ((Catalysis) control).getPhysicalControllers()) {
ConversionTableRow conversionTableRow;
if (bioModel.getRelationshipModel().getRelationshipObjects(pe).isEmpty()) {
conversionTableRow = createTableRow(pe, interactionId, interactionLabel, "Catalyst", 1.0, null);
} else {
conversionTableRow = createTableRow(pe, interactionId, interactionLabel, "Catalyst", 1.0, bioModel.getRelationshipModel().getRelationshipObjects(pe));
}
allPathwayObjectList.add(conversionTableRow);
convertedBPObjects.add(pe);
}
}
} else {
// other control types
if (BioPAXUtil.getControlledNonControlInteraction(control) == conversion) {
for (PhysicalEntity pe : control.getPhysicalControllers()) {
ConversionTableRow conversionTableRow;
if (bioModel.getRelationshipModel().getRelationshipObjects(pe).isEmpty()) {
conversionTableRow = createTableRow(pe, interactionId, interactionLabel, "Control", 1.0, null);
} else {
conversionTableRow = createTableRow(pe, interactionId, interactionLabel, "Control", 1.0, bioModel.getRelationshipModel().getRelationshipObjects(pe));
}
allPathwayObjectList.add(conversionTableRow);
convertedBPObjects.add(pe);
}
}
}
}
}
}
} else if (bpo instanceof Catalysis) {
for (PhysicalEntity pe : ((Catalysis) bpo).getPhysicalControllers()) {
if (!convertedBPObjects.contains(pe)) {
ConversionTableRow conversionTableRow;
if (bioModel.getRelationshipModel().getRelationshipObjects(bpo).isEmpty()) {
conversionTableRow = createTableRow(pe, "", "", "Catalyst", 1.0, null);
} else {
conversionTableRow = createTableRow(pe, "", "", "Catalyst", 1.0, bioModel.getRelationshipModel().getRelationshipObjects(bpo));
}
allPathwayObjectList.add(conversionTableRow);
convertedBPObjects.add(pe);
}
}
for (Pathway pathway : ((Catalysis) bpo).getPathwayControllers()) {
// TODO
}
} else if (bpo instanceof Control) {
for (PhysicalEntity pe : ((Catalysis) bpo).getPhysicalControllers()) {
if (!convertedBPObjects.contains(pe)) {
ConversionTableRow conversionTableRow;
if (bioModel.getRelationshipModel().getRelationshipObjects(bpo).isEmpty()) {
conversionTableRow = createTableRow(pe, "", "", "Control", 1.0, null);
} else {
conversionTableRow = createTableRow(pe, "", "", "Control", 1.0, bioModel.getRelationshipModel().getRelationshipObjects(bpo));
}
allPathwayObjectList.add(conversionTableRow);
convertedBPObjects.add(pe);
}
}
for (Pathway pathway : ((Catalysis) bpo).getPathwayControllers()) {
// TODO
}
}
}
// 2nd pass - entities selected as themselves
for (BioPaxObject bpo : bioPaxObjects) {
if (bpo instanceof PhysicalEntity) {
if (bioModel.getRelationshipModel().getRelationshipObjects(bpo).size() == 0) {
PhysicalEntity physicalEntityObject = (PhysicalEntity) bpo;
// we add standalone selected entities, only if they were not already added as part of any reaction
if (!convertedBPObjects.contains(physicalEntityObject)) {
ConversionTableRow conversionTableRow = createTableRow(physicalEntityObject, "", "", "", 1.0, null);
allPathwayObjectList.add(conversionTableRow);
convertedBPObjects.add(physicalEntityObject);
}
}
}
}
// apply text search function for particular columns
ArrayList<ConversionTableRow> pathwayObjectList = new ArrayList<ConversionTableRow>();
if (searchText == null || searchText.length() == 0) {
pathwayObjectList.addAll(allPathwayObjectList);
} else {
String lowerCaseSearchText = searchText.toLowerCase();
for (ConversionTableRow rs : allPathwayObjectList) {
BioPaxObject bpObject = rs.getBioPaxObject();
if (rs.interactionLabel().toLowerCase().contains(lowerCaseSearchText) || rs.participantType().toLowerCase().contains(lowerCaseSearchText) || getLabel(bpObject).toLowerCase().contains(lowerCaseSearchText) || getType(bpObject).toLowerCase().contains(lowerCaseSearchText)) {
pathwayObjectList.add(rs);
}
}
}
setData(pathwayObjectList);
GuiUtils.flexResizeTableColumns(ownerTable);
}
use of org.vcell.pathway.Pathway in project vcell by virtualcell.
the class PathwayReaderBiopax3 method addContentPathway.
private boolean addContentPathway(Pathway pathway, Element element, Element childElement) {
if (addContentEntity(pathway, element, childElement)) {
return true;
}
/**
* BioSource organism
* ArrayList<Interaction> pathwayComponentInteraction
* ArrayList<Pathway> pathwayComponentPathway
* ArrayList<PathwayStep> pathwayOrder
*/
if (childElement.getName().equals("organism")) {
pathway.setOrganism(addObjectBioSource(childElement));
return true;
} else if (childElement.getName().equals("pathwayOrder")) {
pathway.getPathwayOrder().add(addObjectPathwayStep(childElement));
return true;
} else if (childElement.getName().equals("pathwayComponent")) {
if (childElement.getChildren().size() == 0) {
// if there are no children it must be a resource inside another object
// we don't know yet whether it's Interaction or Pathway, we make a proxy for each
// at the time when we solve the references we'll find out which is fake
InteractionProxy proxyI = new InteractionProxy();
addAttributes(proxyI, childElement);
pathwayModel.add(proxyI);
pathway.getPathwayComponentInteraction().add(proxyI);
PathwayProxy proxyP = new PathwayProxy();
addAttributes(proxyP, childElement);
pathwayModel.add(proxyP);
pathway.getPathwayComponentPathway().add(proxyP);
return true;
} else {
// it's the real object declaration - could be an interaction or a pathway
for (Object child : childElement.getChildren()) {
if (child instanceof Element) {
if (((Element) child).getName().equals("Pathway")) {
Pathway thingie = addObjectPathway((Element) child);
pathway.getPathwayComponentPathway().add(thingie);
return true;
} else {
Interaction thingie = (Interaction) addObjectBioPaxObjectSubclass((Element) child);
if (thingie == null) {
return false;
} else {
pathway.getPathwayComponentInteraction().add(thingie);
return true;
}
}
}
}
}
return false;
} else {
return false;
}
}
use of org.vcell.pathway.Pathway in project vcell by virtualcell.
the class PathwayReaderBiopax3 method addObjectPathway.
// proxy thing done elsewhere
private Pathway addObjectPathway(Element element) {
Pathway pathway = new Pathway();
addAttributes(pathway, element);
for (Object child : element.getChildren()) {
if (child instanceof Element) {
Element childElement = (Element) child;
if (!addContentPathway(pathway, element, childElement)) {
showUnexpected(childElement);
}
}
}
pathwayModel.add(pathway);
return pathway;
}
Aggregations