Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

This procedure is designed to help you create the files that are needed to install your plug-in within IGB. The first section contains the steps needed to modify your local copy of the IGB code in order to generate the needed files. You should have an updated, local copy of the IGB code or check out the most recent version from Sourceforge.

...

Step 5. Update Activator.java: Expand the sample plugin / src folder until you see Activator.java (and SamplePlugin.java).

...

Open Activator.java and update the code with your package declaration as well as occurrences of your plug in class name. The sample code implements an annotation operation, so Activator.java registers service for Alignment, Annotation and ProbeSet means this plugin is designed only for these 3 types of annotations. Actually this SamplePlugin derives from the existing IGB plugin named OverlapAnnotationOperator which you can find it in the plugins folder.

There are also many other different types of operation for annotation and graph created as a plugin or not, such as MergeAnnotationOperator plugin and XorOperator in core folder then com.affymetrix.genometryImpl.operator package.

Your plugin class name is inserted in the file as shown in the following code, as "MyPlugin".

Code Block
borderStylesolid
titlecom.myorg.myplugin.Activator.java
borderStylesolid
@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)
	};
}

Step 6. Update SamplePlugin.java: Open SamplePlugin.java in the same /src directory with Activator.java. Start by updating the class with your plugin name (e.g. MyPlugin), your package declarations and constructor(s). Overriding getDisplay() sets the display name in IGB (e.g. "My Operation"). We recommend overriding getName() with a descriptive name (string).

This sample code inherits AbstractAnnotationOperator and implements Operator interface to work as a new annotation operation. For more options refer to the Extension Points section.

Code Block
borderStylesolid
titlecom.myorg.myplugin.MyPlugin.java
borderStylesolid
public class MyPlugin extends AbstractAnnotationOperator implements Operator {

	// Constructor
	MyPlugin(FileTypeCategory category){
		super(category);
	}

	// Method to determine the internal plugin name
	@Override
	public String getName() {
		return this.category.toString().toLowerCase() +"_my_plugin";
	}


	// Method to determine the display name for the operation
	@Override
	public String getDisplay() {
		return "My Operation";
	}


	// Private method to check if two symmetries are overlapped used by the operate()
	private boolean overlap(BioSeq aseq, SeqSymmetry s0, SeqSymmetry s1) {
		return s0.getSpan(aseq) != null && s1.getSpan(aseq) != null && s0.getSpan(aseq).getMax() > s1.getSpan(aseq).getMin() && s0.getSpan(aseq).getMin() < s1.getSpan(aseq).getMax();
	}


	// Core code for the operation which loops over input symmetries and return the overlapped ones
	@Override
	public SeqSymmetry operate(BioSeq aseq, List<SeqSymmetry> symList) {
		SimpleSymWithProps result = new SimpleSymWithProps();
		result.setProperties(new HashMap<String,Object>());
		TypeContainerAnnot t0 = (TypeContainerAnnot)symList.get(0);
		TypeContainerAnnot t1 = (TypeContainerAnnot)symList.get(1);
		result.setProperty("type", t0.getType() + " " + getName());

		for (int i = 0; i < t0.getChildCount(); i++) {
			SeqSymmetry s0 = t0.getChild(i);
			for (int j = 0; j < t1.getChildCount(); j++) {
				SeqSymmetry s1 = t1.getChild(j);
				if (overlap(aseq, s0, s1)) {
					result.addChild(s0);
					result.addSpan(s0.getSpan(aseq));
					break;
				}
			}
		}
		return result;
	}

You can refer more operations in plugins or com.affymetrix.genometryImpl.operator package in core folder.

Step 7. Update MAINFEST.BASE: Directly under the template /src (close /com) [MyPlugin] folder, update the following highlighted fields in for 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">: 2
Bundle-Name: MyPlugin
Bundle-SymbolicName: 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: [MyPlugin
Bundle-Version: 0.0.9
Bundle-Activator: com.myorg.myplugin.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Description: Plugin to allow the user to create a plugin as template
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>:
Import-Package: com.affymetrix.common;version="\[<span style="color: #000000">&nbsp;</span><span style="color: #000000">(appVersion)</span><span style="color: #000000">,</span> <span style="color: #000000">&nbsp;</span><span style="color: #000000">(appVersion)</span>\]", &nbsp;com[ (appVersion),  (appVersion)]",
 com.affymetrix.genometryImpl, &nbsp;com
 com.affymetrix.genometryImpl.operator, &nbsp;com
 com.affymetrix.genometryImpl.symmetry, &nbsp;com
 com.affymetrix.genometryImpl.parsers, &nbsp;com
 com.affymetrix.igb.osgi.service, &nbsp;org
 org.osgi.framework;version="1.5.0", &nbsp;org
 org.osgi.util.tracker;version="1.4.0"

Panel

Wiki Markup
  • Bundle-Name - change to your plugin name
  • Bundle-SymbolicName - change to your package path
  • Bundle-Version - change to your plugin version
  • Bundle-Activation - change to your Activator path (e.g. com.myorg.myplugin.Activator)
  • Import-Package - include all the classes your are using in your source code

Step 8. Update ant.properties: Also found under the template /src [MyPlugin] folder, update the highlighted fields as follows.

Panel

name=MyPlugin
project=MyPlugin
classpath=${igb_service}/build:${window_service}/build:${common}/build:${igb}/build:${genometry}/build:${genoviz}/build:${osgi.impl}
plugin-jar=true

...

  • name=\[your plugin name\]unmigrated-wiki-markup
  • project=\[your plugin name\]
  • classpath is updated with the necessary paths; refer to the project build.xml for the actual paths listed, i.e. the path for igb_service, windows_service, etc.

Step 9. Update build.properties for the project: Under the IGB project folder(not the build.properties file in your plugin folder), open the build.properties file:

...

  • Next, using a command line prompt, navigate to the plugins IGB_HOME folder and run the following command (Enter your svn password as necessary.):
Panel

ant externalBundles

...

*Step 4. Move the .jar and .xml files to your plugin directory:* There should be 2 generated files in IGB_HOME/plugins/ext, _\[MyPlugin\].jar_ and _repository.xml_. Move these files to your plugin repository folder (local or remote HTTP server). Make sure to cut these files from from the IGB_HOME/plugins/ext folder, or delete after copying.

Step 5 (optional): Revert IGB code: You can now revert all of the code changes you have made, if you wish, or simply change the name of the plugin in all appropriate code locations to create files for another plugin.

...