Step 1. Download and unzip: Download the attached template file SamplePlugin.zip.
Step 2. Add the template folder: Add the folder to the IGB source plugins folder, as seen in the following image.
Step 3. Change the plugin name: Change the name from SamplePlug to your name (e.g. MyPlugin)
Step 4. Change the package: Change the package from com.affymetrix.igb.sampleplugin to your package name (e.g. com.myorg.myplugin). If you IDE does not support 'create folder' directly you can do this from your Finder (MacOS) or Windows Explorer, the directory is IGB_HOME/plugins/MyPlug/src
Step 5. Adjust the template code: Expand the sample plugin /src until you see the Activator.java and SamplePlugin.java.
Both files will need to be updated.
Update Activator.java with your package declaration as well as class name. The sample code implements an annotation operation, so the Activator.java registers service for Alignment, Annotation and ProbeSet. The new class name is "MyPlugin" in the following code.
@Override protected ServiceRegistration<?>\[\] registerService(IGBService igbService) throws Exception { return new ServiceRegistration\[\] { bundleContext.registerService(Operator.class, new MyPlugin(FileTypeCategory.Alignment), null), bundleContext.registerService(Operator.class, new MyPlugin(FileTypeCategory.Annotation), null), bundleContext.registerService(Operator.class, new MyPlugin(FileTypeCategory.ProbeSet), null) }; }
For more options refer to the Extension Points section
This sample code inherits AbstractAnnotationOperator and implements Operator interface to work as a new annotation operation. Update SamplePlugin.java with your plugin name (e.g. MyPlugin), your package declarations, your class name and constructor(s). Overriding getDisplay() sets the display name in IGB (e.g. "My Operation").
public class MyPlugin extends AbstractAnnotationOperator implements Operator { MyPlugin(FileTypeCategory category){ super(category); } @Override public String getName() { return this.category.toString().toLowerCase() +"_my_plugin"; } @Override public String getDisplay() { return "My Operation"; } private boolean overlap(BioSeq aseq, SeqSymmetry s0, SeqSymmetry s1) { } @Override public SeqSymmetry operate(BioSeq aseq, List<SeqSymmetry> symList) { } }
4. Update MAINFEST.BASE
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
<span style="color: #ff0000">Bundle-Name</span><span style="color: #000000">: MyPlugin</span>
<span style="color: #ff0000">Bundle-SymbolicName</span><span style="color: #000000">: com.myorg.myplugin.MyPlugin</span>
<span style="color: #ff0000">Bundle-Version</span><span style="color: #000000">: 0.0.9</span>
<span style="color: #ff0000">Bundle-Activator</span><span style="color: #000000">:</span> <span style="color: #000000">com.myorg.myplugin</span><span style="color: #000000">.Activator</span>
<span style="color: #000000">Bundle-ActivationPolicy: lazy</span>
<span style="color: #000000">Bundle-RequiredExecutionEnvironment: JavaSE-1.6</span>
<span style="color: #000000">Bundle-Description: Plugin to allow the user to create a plugin as template</span>
Bundle-DocURL: http://wiki.transvar.org<span style="color: #ff0000"><a href="http://wiki.transvar.org">http://wiki.transvar.org
</a></span>
<span style="color: #ff0000">Import-Package</span>: com.affymetrix.common;version="[ (appVersion), (appVersion)]",
com.affymetrix.genometryImpl,
com.affymetrix.genometryImpl.operator,
com.affymetrix.genometryImpl.symmetry,
com.affymetrix.genometryImpl.parsers,
com.affymetrix.igb.osgi.service,
org.osgi.framework;version="1.5.0",
org.osgi.util.tracker;version="1.4.0"
Bundle-Name - change to your plugin name i.e. MyPlugin
Bundle-SymbolicName - change to your package path i.e. com.myorg.myplugin.MyPlugin
Bundle-Version - change to your plugin version
Bundle-Activation - change to your Activator path i.e. com.myorg.myplugin.Activator
Import-Package - include all the classes your are using in your source code
5. Update ant.properties
name=MyPlugin
project=MyPlugin
classpath=${igb_service}/build:${window_service}/build:${common}/build:${igb}/build:${genometry}/build:${genoviz}/build:${osgi.impl}
plugin-jar=true
Change the 'name' and 'project' to your plugin name i.e. MyPlugin
Update the 'classpath' with necessary path, refer to project build.xml for the location annotations.
6. Update build.properties for the project (not the one in plugin folder)
On the line 'not.include.bundles=', delete all the existing values and add your plugin name:
not.include.bundles=MyPlugin
Clean and Build IGB
Delete files in IGB_HOME/plugins/ext
In command line, go to IGB_HOME, run command
ant externalBundles
Enter your svn password as necessary
Move the generated files in IGB_HOME/plugins/ext (MyPlugin.jar and repository.xml) to the folder (local or remote HTTP server) where you want your plugin site on
Make sure you are cut from IGB_HOME/plugins/ext (or delete it after copying)
Run IGB -> "Plug-ins' tab
Click 'Repositories...' button to open the Plugin configuration panel
Enter the name you want to name, this can be any name you like since it will only show in the plugin site list
Enter the URL for your remote server such as http://www.mysite.com/my_plugin_folder
OR
Click '...' button to select the folder in local machine
Click 'Add Repository' button and now you should see your plugin site is added into the site list, also your plugin MyPlugin is showing in the Plug-ins tab in IGB after close the configuration panel
Install the plugin by checking 'Installed'
Now let's take a look what the sample plugin looks like.
Load 2 annotations then select them by clicking with Shift, right click and we can see 'My Operation' is there:
Click 'My Operation' will generate a new track based on what the sample plugin does on these 2 annotations: