Last active
August 29, 2015 14:25
-
-
Save mpkocher/92e165dd04e0445c3341 to your computer and use it in GitHub Desktop.
Example of Using pbcommand with ipdSummary.py
This file contains hidden or 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
from pbcommand.models import get_default_contract_parser, TaskTypes, ResourceTypes, FileTypes | |
from pbcommand.validators import validate_file | |
def get_pbparser(): | |
driver_exe = "my-exe" | |
p = get_default_contract_parser("pbexample.tasks.my_tool", "My Tool Desc", "0.1.0", driver_exe, TaskTypes.LOCAL, 1, ()) | |
return p | |
def add_common(p): | |
p.add_input_file_type(FileTypes.DS_BAM, "algn_ds", "Alignment DataSet", "Alignment Set Desc") | |
# add common opts here as well | |
return p | |
def add_tc(p): | |
p.tool_contract_parser.add_input_file_type(FileTypes.DS_REF, "ref_ds", "Reference Set", "Reference Set desc") | |
p.tool_contract_parser.add_output_file_type(FileTypes.GFF, "gff", "Gff", "GFF Desc", "output.gff") | |
p.tool_contract_parser.add_output_file_type(FileTypes.CSV, "csv", "CSV", "CSV Desc", "output.csv") | |
return p | |
def add_argparse(p): | |
p.arg_parser.parser.add_argument('--gff', type=validate_file, help="Path to Output GFF") | |
p.arg_parser.parser.add_argument('--csv', type=validate_file, help="Output CSV") # this should be validate_or_none | |
p.arg_parser.parser.add_argument('--reference-fasta', required=True, type=validate_file, help="Path to Fasta or ReferenceSet") | |
return p | |
def to_p(): | |
p = get_pbparser() | |
p = add_common(p) | |
p = add_tc(p) | |
p = add_argparse(p) | |
return p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment