Skip to content

Commit

Permalink
Various Additions included in KEGGtranslator v2 Release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Clemens82 committed Jun 4, 2012
1 parent c6e831b commit 93a2efc
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 8 deletions.
10 changes: 9 additions & 1 deletion src/de/zbit/kegg/gui/TranslatorBioPAXPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* @author Clemens Wrzodek
* @version $Rev$
*/
public class TranslatorBioPAXPanel extends TranslatorGraphLayerPanel<Model>{
public class TranslatorBioPAXPanel extends TranslatorGraphLayerPanel<Model> {

private static final long serialVersionUID = -6585611929238639630L;

Expand Down Expand Up @@ -129,6 +129,14 @@ public boolean isAllowedToSaveAsGraphFormats() {
return false;
}

/* (non-Javadoc)
* @see de.zbit.graph.gui.TranslatorGraphLayerPanel#isDetailPanelAvailable()
*/
@Override
public boolean isDetailPanelAvailable() {
return false;
}

/* (non-Javadoc)
* @see de.zbit.kegg.gui.TranslatorGraphLayerPanel#updateDetailPanel(javax.swing.JScrollPane, y.view.HitInfo)
*/
Expand Down
10 changes: 8 additions & 2 deletions src/de/zbit/kegg/gui/TranslatorGraphPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,13 @@ protected boolean writeRealDocumentToFileUnchecked(File file, String format)
throws Exception {
return ((KEGG2yGraph)getTranslator()).writeToFile(document, file.getPath(), format);
}



/* (non-Javadoc)
* @see de.zbit.graph.gui.TranslatorGraphLayerPanel#isDetailPanelAvailable()
*/
@Override
public boolean isDetailPanelAvailable() {
return false;
}

}
9 changes: 9 additions & 0 deletions src/de/zbit/kegg/gui/TranslatorSBGNPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,13 @@ protected boolean writeRealDocumentToFileUnchecked(File file, String format)
throws Exception {
return ((KEGG2SBGN)getTranslator()).writeToFile(document, file.getPath());
}

/* (non-Javadoc)
* @see de.zbit.graph.gui.TranslatorGraphLayerPanel#isDetailPanelAvailable()
*/
@Override
public boolean isDetailPanelAvailable() {
return false;
}

}
6 changes: 6 additions & 0 deletions src/de/zbit/kegg/io/KEGG2BioPAX.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ public BioPAXElement createXRef(IdentifierDatabases db, String id, int type) {
instantiate = relationshipXref.class;
} else if (type==3) {
instantiate = publicationXref.class;
} else {
// we can NOT instantiate xref.class
instantiate = relationshipXref.class;
}

xr = model.addNew(instantiate, uri);
Expand All @@ -293,6 +296,9 @@ public BioPAXElement createXRef(IdentifierDatabases db, String id, int type) {
instantiate = RelationshipXref.class;
} else if (type==3) {
instantiate = PublicationXref.class;
} else {
// we can NOT instantiate Xref.class
instantiate = RelationshipXref.class;
}

xr = model.addNew(instantiate, uri);
Expand Down
2 changes: 1 addition & 1 deletion src/de/zbit/kegg/io/KEGG2BioPAX_level2.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected BioPAXElement createPathwayInstance(Pathway p) {
// Parse Kegg Pathway information
boolean isKEGGPathway = DatabaseIdentifiers.checkID(DatabaseIdentifiers.IdentifierDatabases.KEGG_Pathway, p.getNameForMIRIAM());
if (isKEGGPathway) {
xref xr = (xref)createXRef(IdentifierDatabases.KEGG_Pathway, p.getNameForMIRIAM());
xref xr = (xref)createXRef(IdentifierDatabases.KEGG_Pathway, p.getNameForMIRIAM(), 1);
if (xr!=null) {
pathway.addXREF(xr);
}
Expand Down
13 changes: 11 additions & 2 deletions src/de/zbit/kegg/io/KEGG2BioPAX_level3.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import org.biopax.paxtools.model.level3.SmallMolecule;
import org.biopax.paxtools.model.level3.SmallMoleculeReference;
import org.biopax.paxtools.model.level3.Stoichiometry;
import org.biopax.paxtools.model.level3.UnificationXref;
import org.biopax.paxtools.model.level3.XReferrable;
import org.biopax.paxtools.model.level3.Xref;

Expand Down Expand Up @@ -307,7 +306,7 @@ protected BioPAXElement createPathwayInstance(Pathway p) {
// Parse Kegg Pathway information
boolean isKEGGPathway = DatabaseIdentifiers.checkID(DatabaseIdentifiers.IdentifierDatabases.KEGG_Pathway, p.getNameForMIRIAM());
if (isKEGGPathway) {
Xref xr = (Xref)createXRef(IdentifierDatabases.KEGG_Pathway, p.getNameForMIRIAM());
Xref xr = (Xref)createXRef(IdentifierDatabases.KEGG_Pathway, p.getNameForMIRIAM(), 1);
if (xr!=null) {
pathway.addXref(xr);
}
Expand Down Expand Up @@ -474,6 +473,16 @@ public BioPAXElement addKGMLRelation(Relation r, Pathway p) {
return null;
}

// // Relations should prefarably translated, using the EntityReferences
// if (qOne instanceof SimplePhysicalEntity &&
// ((SimplePhysicalEntity)qOne).getEntityReference()!=null ) {
// qOne = ((SimplePhysicalEntity)qOne).getEntityReference();
// }
// if (qTwo instanceof SimplePhysicalEntity &&
// ((SimplePhysicalEntity)qTwo).getEntityReference()!=null ) {
// qTwo = ((SimplePhysicalEntity)qTwo).getEntityReference();
// }

// Most relations have a left and right side => conversion as default
Class<? extends BioPAXElement> instantiate = Conversion.class;

Expand Down
17 changes: 16 additions & 1 deletion src/de/zbit/kegg/io/KEGG2SBMLqual.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.sbml.jsbml.ext.groups.Group;
import org.sbml.jsbml.ext.qual.Input;
import org.sbml.jsbml.ext.qual.InputTransitionEffect;
import org.sbml.jsbml.ext.qual.Output;
import org.sbml.jsbml.ext.qual.OutputTransitionEffect;
import org.sbml.jsbml.ext.qual.QualConstant;
import org.sbml.jsbml.ext.qual.QualitativeModel;
Expand Down Expand Up @@ -93,6 +94,13 @@ public class KEGG2SBMLqual extends KEGG2jSBML {
*/
private boolean considerReactions = false;

/**
* All transitions that are added to the model.
* Identified as "inputQualitativeSpecies ouptutQualitativeSpecies [SBOterm]",
* used to check for duplicates.
*/
private Set<String> containedTransitions = new HashSet<String>();


/**
* @param document
Expand Down Expand Up @@ -242,7 +250,7 @@ public Transition addKGMLRelation(Relation r, Pathway p, QualitativeModel qualMo
in.setMetaId("meta_" + in.getId());

// Output
t.createOutput(NameToSId("out"), qTwo.getId(), OutputTransitionEffect.assignmentLevel); //TODO: is this correct?
Output out = t.createOutput(NameToSId("out"), qTwo.getId(), OutputTransitionEffect.assignmentLevel); //TODO: is this correct?

//XXX: "function term" is intentionally not set in KEGG2X (info not provided).

Expand Down Expand Up @@ -327,6 +335,13 @@ public Transition addKGMLRelation(Relation r, Pathway p, QualitativeModel qualMo
t.addCVTerm(cv);
}

// Don't att same relations twice
String transitionIdentifier = in.getQualitativeSpecies() + " " + out.getQualitativeSpecies() + " " + (t.isSetSBOTerm() ? t.getSBOTermID():"");
if (!containedTransitions.add(transitionIdentifier)) {
qualModel.getListOfTransitions().remove(t);
t=null;
}

return t;
}

Expand Down
3 changes: 2 additions & 1 deletion src/de/zbit/kegg/io/KEGG2jSBML.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ public void setUseGroupsExtension(boolean b) {

/** Load the default preferences from the SBPreferences object. */
private void loadPreferences() {
addCellDesignerAnnots = KEGGtranslatorOptions.CELLDESIGNER_ANNOTATIONS.getValue(prefs);
// CellDeisnger annotations are not supported anymore!
//addCellDesignerAnnots = KEGGtranslatorOptions.CELLDESIGNER_ANNOTATIONS.getValue(prefs);
addLayoutExtension = KEGGtranslatorOptions.ADD_LAYOUT_EXTENSION.getValue(prefs);
useGroupsExtension = KEGGtranslatorOptions.USE_GROUPS_EXTENSION.getValue(prefs);
}
Expand Down

0 comments on commit 93a2efc

Please sign in to comment.