Skip to content

Commit 1479a35

Browse files
author
Alan Christie
committed
feat: Add a smiles-to-file job and definition
1 parent 9c081ff commit 1479a35

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

tests/job-definitions/job-definitions.yaml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,36 @@ jobs:
2323

2424
nop:
2525
command: >-
26-
python --version
26+
nop.py
2727
2828
nop-fail:
2929
command: >-
30-
python --version
30+
nop-fail.py
31+
32+
smiles-to-file:
33+
command: >-
34+
string-to-file.py --smiles {{ smiles }} --output {{ outputFile }}
35+
variables:
36+
outputs:
37+
type: object
38+
properties:
39+
title: Output file
40+
mime-types:
41+
- chemical/x-mdl-sdfile
42+
- squonk/x-smiles
43+
creates: '{{ outputFile }}'
44+
type: file
45+
options:
46+
type: object
47+
required:
48+
- outputFile
49+
- smiles
50+
properties:
51+
outputFile:
52+
title: Output file
53+
type: string
54+
default: clustered.sdf
55+
pattern: "^[A-Za-z0-9_/\\.\\-]+\\.(smi|sdf)$"
56+
smiles:
57+
title: SMILES
58+
type: string

tests/jobs/smiles-to-file.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import argparse
2+
3+
parser = argparse.ArgumentParser(
4+
prog="smiles-to-file",
5+
description="Takes an input SMILES string and writes it to a file",
6+
)
7+
parser.add_argument("-s", "--smiles", required=True)
8+
parser.add_argument("-o", "--outputFile", required=True)
9+
args = parser.parse_args()
10+
11+
with open(args.outputFile, "wt", encoding="utf8") as output_file:
12+
output_file.write(f"{args.smiles}\n")

0 commit comments

Comments
 (0)