-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db1c1d1
commit 87a74f5
Showing
1 changed file
with
35 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,48 @@ | ||
#! /usr/bin/env python3 | ||
|
||
''' | ||
PALADIN plugin template. | ||
""" | ||
PALADIN plugin template. | ||
All output (both stdout and stderr) must be routed through | ||
the "plugins.core.sendOutput" method. Initialization and main program body should be stored | ||
within the initialization and main callbacks, respectively (see below). | ||
the "core.main.sendOutput" method. Initialization and main program body should be stored | ||
within the initialization and main callbacks, respectively (see below). | ||
plugins.core.PaladinEntry.getEntries can be used for getting UniProt report data | ||
plugins.core.SamEntry.getEntries can be used for getting SAM data | ||
core.main.PaladinEntry.getEntries can be used for getting UniProt report data | ||
core.main.SamEntry.getEntries can be used for getting SAM data | ||
See core.py for other API methods. When calling methods from other plugins, be sure to list | ||
them as dependencies in the plugin definition. Do not list core as a dependency. | ||
''' | ||
""" | ||
|
||
import argparse | ||
import shlex | ||
import plugins.core | ||
import core.main | ||
|
||
|
||
# Plugin connection definition | ||
def pluginConnect(passDefinition): | ||
passDefinition.name = "pluginName" # Plugin name shown in plugin list (should match filename so user knows what to type eg @@pluginName) | ||
passDefinition.description = "Plugin Description" # Plugin description shown in plugin list | ||
passDefinition.versionMajor = 1 # Plugin version shown in plugin list | ||
passDefinition.versionMinor = 0 | ||
passDefinition.versionRevision = 0 | ||
passDefinition.dependencies=['aggregation'] # If plugin depends on other plugins, specify their plugin name here | ||
|
||
#passDefinition.callbackInit = templateInit # Reference plugin initialization method here (run once at startup). Not required. | ||
passDefinition.callbackMain = templateMain # Reference plugin main method here. Will receive plugin arguments. Required. | ||
|
||
# Plugin main | ||
def templateMain(passArguments): | ||
# Parse arguments | ||
argParser = argparse.ArgumentParser(description='PALADIN Pipeline Plugins: Your plugin', prog='your plugin') | ||
argParser.add_argument('-a', metavar='ARG1', type=str, help='Arg 1') | ||
argParser.add_argument('-b', metavar='ARG2', type=int, required=True, help='Arg 2') | ||
arguments = argParser.parse_known_args(shlex.split(passArguments)) | ||
|
||
plugins.core.sendOutput('Unimplemented', 'stderr') | ||
def plugin_connect(definition): | ||
definition.name = "pluginName" # Plugin name shown in plugin list (should match filename so user knows what to type eg @@pluginName) | ||
definition.description = "Plugin Description" # Plugin description shown in plugin list | ||
definition.version_major = 1 # Plugin version shown in plugin list | ||
definition.version_minor = 0 | ||
definition.version_revision = 0 | ||
definition.dependencies = ['aggregation'] # If plugin depends on other plugins, specify their plugin name here | ||
|
||
definition.callback_args = template_args # Reference plugin argument parsing method here. Will receive plugin arguments string. Requird. | ||
# definition.callback_init = template_init # Reference plugin initialization method here (run once at startup). Not required. | ||
definition.callback_main = template_main # Reference plugin main method here. Will receive plugin arguments. Required. | ||
|
||
|
||
# Plugin arg parsing | ||
def template_args(subargs): | ||
# Parse arguments | ||
arg_parser = argparse.ArgumentParser(description='PALADIN Pipeline Plugins: Your plugin', prog='your plugin') | ||
arg_parser.add_argument('-a', metavar='ARG1', type=str, help='Arg 1') | ||
arg_parser.add_argument('-b', metavar='ARG2', type=int, required=True, help='Arg 2') | ||
|
||
return arg_parser.parse_known_args(shlex.split(subargs)) | ||
|
||
|
||
# Plugin main | ||
def template_main(args): | ||
core.main.sendOutput('Unimplemented', 'stderr') |