Skip to content

Commit 5e97a97

Browse files
committed
Add helper
1 parent 271e78a commit 5e97a97

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed

.DS_Store

6 KB
Binary file not shown.

workflows/.DS_Store

0 Bytes
Binary file not shown.
6 KB
Binary file not shown.

workflows/working_example/workflow/Snakefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
# Load configuration from config.yaml
1+
"""Testing GRAPEVNE
2+
3+
This is a simple example module that demonstrates how to use GRAPEVNE modules. This module displays an image on the screen in a platform-independent way. The module touches an output file that we call a 'trigger' to signify that the module has completed successfully. The name of the trigger file is configurable.
4+
"""
5+
configfile: "config/config.yaml"
6+
from grapevne_helper import import_grapevne # Import the bundled GRAPEVNE helper
7+
8+
grapevne = import_grapevne(workflow) # Use the helper to import GRAPEVNE
9+
# You can specify version requirements here, e.g.
10+
# import_grapevne(workflow, version="0.2")
11+
12+
globals().update(vars(grapevne)) # For convenience, we expose all variables from
13+
# the GRAPEVNE module
14+
215
configfile: "config/config.yaml"
316

417
# Rule to run the R script with the path parameter
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import logging
2+
import sys
3+
4+
try:
5+
import grapevne
6+
except ImportError:
7+
import ensurepip
8+
import subprocess
9+
10+
ensurepip.bootstrap()
11+
subprocess.check_call(
12+
[sys.executable, "-m", "pip", "install", "--upgrade", "grapevne"]
13+
)
14+
try:
15+
import grapevne
16+
except ImportError:
17+
logging.error("Failed to install grapevne. Exiting.")
18+
sys.exit(1)
19+
20+
21+
def import_grapevne(workflow=None, version=None):
22+
_grapevne = grapevne.install(version)
23+
if workflow:
24+
_grapevne.helpers.init(workflow)
25+
return _grapevne.helpers

0 commit comments

Comments
 (0)