Created
March 5, 2017 11:16
-
-
Save mpkocher/8bb57339a69b9807f30e04fdde0a66aa to your computer and use it in GitHub Desktop.
Possible Pure Python SnakeMake API
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 snakemake.core import SnakeMakeShellRule, SnakeMakePyRule, AllRule | |
class CollectReferences(SnakeMakeShellRule): | |
ID = "collect_references" | |
THREADS = 8 | |
DESCRIPTION = "Does some stuff" | |
def inputs(): | |
return dict(alpha="f1.fasta") | |
def resolve_params(config): | |
return dict(a=1, b=2) | |
def outputs(): | |
return dict(gamma="out1.txt", delta="out2.txt") | |
def shell(inputs, outputs, config): | |
return "run-my-exe {config.nthreads} {inputs.alpha} {outs.gamma}" | |
class SubreadSetSummary(SnakeMakePyRule): | |
ID = "subreads_summary" | |
DESCRIPTION = "Create a txt summary of SubreadSet XML" | |
def inputs(): | |
return dict(s1="/path/to/subreadset.xml") | |
def outputs(): | |
return dict(summary="summary.txt") | |
def run(inputs, outputs, config): | |
from pbcore.dataset.io import SubreadSet | |
s = SubreadSet(inputs.s1) | |
with open(outputs.summary, 'w+') as f: | |
f.write(repr(s)) | |
return 0 | |
class CustomSummaryWorkflow(AllRule): | |
INPUTS = dict( | |
s1="summary.txt", | |
gamma="out1.txt", | |
delta="outs2.txt") | |
DEFAULT_PARAMS = dict(a=1, b=2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment