Sample Use Case 4: Integrating data into Petri nets, exporting to XGMML and ToPNeT


In this final use case we learn the basics of integrating data from different objects into a single Petri net. See also: Petri nets

The full source code of this example is available in the procope.examples package of the src/ folder.

Preparing some datasets

First we need to load the datasets which will then be integrated in the Petri net. As we want to create a really small sample Petri net here, we will only use one complex set and one protein network which are both very restricted in their sizes.

ProteinNetwork bt = NetworkReader.readNetwork(new GZIPInputStream(new
    FileInputStream("data/scores/bootstrap_combined.txt.gz")));
ProteinNetwork btRestricted = bt.getCutOffNetwork(1f);

ComplexSet mips = ComplexSetReader.readComplexes("data/complexes/
mips_complexes.txt");
ComplexSet mipsRestricted = mips.restrictToProteinSpace(btRestricted, false);



Preparing the Petri net

Next we create a Petri net object and add our source data objects to it. We need to tell the PetriNetCreator the file into which the network will be written as Petri nets can get too large to hold them in-memory.

PetriNetCreator petriNet = new PetriNetCreator("petrinet.txt");

petriNet.addInteractionNetwork(btRestricted, "BT_restricted", true);
petriNet.addComplexSet(mipsRestricted, "MIPS_restricted");


Note that we could also add further complex sets and protein networks and also purification datasets here.

Generating the Petri net

After adding all data objects we simply call the createPetriNet method and finally close the writer (which flushes the output stream and closes the output file handle).

PetriNetCreator petriNet = new PetriNetCreator("petrinet.txt");

petriNet.addInteractionNetwork(btRestricted, "BT_restricted", true);
petriNet.addComplexSet(mipsRestricted, "MIPS_restricted");


Converting the Petri net

The Petri net we just generated is represented in a ProCope-internal format. Currently you can export this internal format to two file formats: ToPNet and XGMML:

XGMMLGenerator.convertToXGMML("petrinet.txt", "petrinet.xgmml");
ToPNetGenerator.convertToToPNet("petrinet.txt", "data.places", "data.interactions");






ProCope documentation