User defined classes

You can integrate your own implementations of clustering algorithms and score calculation methods into the graphical user interface and command line tools of ProCope.

Basic principles

In order to integrate your own methods into the user interfaces of ProCope, you have to write Java classes which implement the interfaces procope.methods.clustering.Clusterer or procope.methods.scores.ScoresCalculator respectively. Then you create XML files which tell ProCope where to find these classes and what parameters they take.

All ProCope user interface tools will automatically detect the corresponding XML files (see below) and let the user select the respective methods.

Writing your own clusterers

The clustering classes you want to integrate into the user interfaces must implement procope.methods.clustering.Clusterer. ProCope calls your class' constructor with the arguments you define in $USERHOME/.procope/clusterers.xml.

A very simple clustering class can be found in the source codes: procope.examples.DummyClusterer. This clusterer does not actually do a real clustering process, it ignores the network and only returns a single complex containing the two proteins it was given in the constructor. Here is the clusterers.xml containing this clusterer (only one <clusterer> entry here):

<clusterers>
  <clusterer name="DummyClust" class="procope.tools.userclasses.DummyClusterer">
    <parameter name="param1" type="int" defval="10"/>
    <parameter name="param2" type="int" defval="20"/>
  </clusterer>
</clusterers>

Each clusterer must have a name and a full classname (class) identifier which tells ProCope where to the class. See also: Parameters

Writing your own scores calculators

Scores calculators have to implement the interface procope.methods.scores.ScoresCalculator. Analogically to the clusteres (see above), ProCope will automatically call the constructor of your class with arguments you define in $USERHOME/.procope/scorecalc.xml.

A scores calculator for testing purposes can be found in the source codes: procope.examples.DummyScores. It takes no parameters and scores equal proteins with the score 1 and unequal proteins with 0. Here is the scorecalc.xml containing this clusterer (only one <scorescalculator> entry here):

<scorescalculators>
  <scorescalculator name="DummyCalc" class="procope.examples.DummyScores">
  </scorescalculator>
</scorescalculators>

Each scores calculator must have a name and a full classname (class) identifier which tells ProCope where to the class. See also: Parameters

Constructor

The constructor of each scores calculator must have the PurificationData object as its first argument, followed by the arguments defined in the XML file.

Some scores calculator (e.g. the Hart scores) accept multiple purification datasets as their input. You can indicate this by adding the attribute multipuri="1" to your <scorescalculator> XML entry. The first argument of the constructor must then be of type PurificationData[].

Exceptions / Invalid arguments

When the user enteres invalid parameters or anything else goes wrong, throw a ProCopeException in your class constructor. The error message will directly be passed to ther user.

Parameters

Each method can get an arbitrary number of parameters (or none). A parameter must have a name, a type (one of: int, float, string) and optionally a default value (defval).

ProCope will take care of asking the user for values of these parameters.

Note: Make sure not to define invalid default values for numeric arguments or the program will crash







ProCope documentation