use of org.vcell.pathway.Catalysis in project vcell by virtualcell.
the class PathwayProducerBiopax3 method addContentCatalysis.
// cofactor PhysicalEntity multiple
// catalysisDirection String single
private Element addContentCatalysis(BioPaxObject bpObject, Element element) {
element = addContentControl(bpObject, element);
Catalysis ob = (Catalysis) bpObject;
Element tmpElement = null;
if (ob.getCofactors() != null && ob.getCofactors().size() > 0) {
List<PhysicalEntity> list = ob.getCofactors();
for (PhysicalEntity item : list) {
tmpElement = new Element("cofactor", bp);
addIDToProperty(tmpElement, item);
mustPrintObject(item);
element.addContent(tmpElement);
}
}
if (ob.getCatalysisDirection() != null && ob.getCatalysisDirection().length() > 0) {
tmpElement = new Element("catalysisDirection", bp);
tmpElement.setAttribute("datatype", schemaString, rdf);
tmpElement.setText(ob.getCatalysisDirection());
element.addContent(tmpElement);
}
return element;
}
use of org.vcell.pathway.Catalysis in project vcell by virtualcell.
the class PathwayReader method addObjectCatalysis.
private Catalysis addObjectCatalysis(Element element) {
Catalysis catalysis = new Catalysis();
addAttributes(catalysis, element);
for (Object child : element.getChildren()) {
if (child instanceof Element) {
if (!addContentCatalysis(catalysis, element, (Element) child)) {
showUnexpected((Element) child, catalysis);
}
}
}
pathwayModel.add(catalysis);
return catalysis;
}
use of org.vcell.pathway.Catalysis 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.Catalysis in project vcell by virtualcell.
the class PathwayReaderBiopax3 method addObjectCatalysis.
/*
- <bp:Catalysis rdf:ID="_5_aminolevulinate_synthase_activity_of_ALAS_homodimer__mitochondrial_matrix_">
<bp:controller rdf:resource="#ALAS_homodimer__mitochondrial_matrix_" />
...
</bp:Catalysis>
- <bp:Complex rdf:ID="ALAS_homodimer__mitochondrial_matrix_">
...
</bp:Complex>
*/
private Catalysis addObjectCatalysis(Element element) {
Catalysis catalysis = new Catalysis();
addAttributes(catalysis, element);
for (Object child : element.getChildren()) {
if (child instanceof Element) {
if (!addContentCatalysis(catalysis, element, (Element) child)) {
showUnexpected((Element) child);
}
}
}
pathwayModel.add(catalysis);
return catalysis;
}
Aggregations