-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrywfr.py
More file actions
87 lines (70 loc) · 2.17 KB
/
Copy pathtrywfr.py
File metadata and controls
87 lines (70 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
from wfrcwflib.workflow import (
Workflow, Step,
PositionalArgument, OptionalArgument,
InputConnector, OutputConnector,
)
from wfrcwflib.file import (
SuffixedFiletype, SuffixedFiletypeBundle, FiletypeRegistry,
)
x = Step("say hello", "echo")
x.args.append(PositionalArgument("hello"))
x.args.append(PositionalArgument("world"))
print(x)
x2 = Step("read_file", "cat")
x2.args.append(PositionalArgument(InputConnector("f", ".txt")))
print(x2)
print(list(x2.inputs))
c1 = Step("copy_1", "cp")
c1.args.append(PositionalArgument(InputConnector("source", ".toml")))
c1.args.append(PositionalArgument(OutputConnector("dest", ".txt")))
c2 = Step("copy_2", "cp")
c2.args.append(PositionalArgument(InputConnector("source", ".txt")))
c2.args.append(PositionalArgument(OutputConnector("dest", ".config")))
w = Workflow([c1, c2])
print(list(w.inputs))
print(list(w.outputs))
w.connect("copy_1", "dest", "copy_2", "source")
print("Connections in:", w.connections_in)
print("Inputs:", list(w.inputs))
print("Connections out:", w.connections_out)
print("Outputs:", list(w.outputs))
print(w.dag)
print(list(w.edges))
csv_filetype = SuffixedFiletype("csv", ".csv")
fasta_filetype = SuffixedFiletype("fasta", ".fasta", [".fna", ".fa"])
fastq_r1 = SuffixedFiletype("r1", "_R1.fastq")
fastq_r2 = SuffixedFiletype("r2", "_R2.fastq")
paired_fastq_filetype = SuffixedFiletypeBundle("paired-fastq", (fastq_r1, fastq_r2))
registry = FiletypeRegistry()
registry.register(csv_filetype)
registry.register(fasta_filetype)
registry.register(paired_fastq_filetype)
print(registry["fasta"])
print(registry["paired-fastq"])
#input_fp = Path("pyproject.toml")
#p = Project(w, {}, {("copy_1", "source"): input_fp}, "myoutput")
# step copy_1
# cp
# { input source toml }
# { output dest txt }
# step copy_2
# cp
# { input source txt }
# { output dest config }
# workflow double_copy
# copy_1 dest -> copy_2 source
# step blastn_genes
# blastn
# -db {input db blastndb}
# -in {input seqs fasta}
# -evalue 1e-5
# configure blastn_genes
# -evalue 1e-3
#try:
# x2.run()
#except Exception as e:
# print(e)
#x2.set_input("f", "pyproject.toml")
#print(x2.inputs)
#print(x2.argv)
#x2.run()