summary refs log tree commit diff
path: root/paper-2026/benchmark.scm
blob: 241b41e370a4111de5e2052654c35f864836fb1b (plain)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
(define odgi-build
  (command #:inputs (tool #:type string) graph (threads #:type int)
           #:run "time" "${ var prefix='--format={\"metrics\": \"build %e %U %S %M\", \"odgi-graph\": {\"class\": \"File\", \"path\": \"'; var suffix='\"}}'; switch (inputs.tool) { case \"odgi\": return prefix + inputs.graph.nameroot + '.og' + suffix; case \"domagi\": return prefix + inputs.graph.nameroot + '.db' + suffix; }}" "--output=cwl.output.json" tool "build" ("-t" threads) ("-g" graph) ("-o" "${switch (inputs.tool) { case \"odgi\": return inputs.graph.nameroot + \".og\"; case \"domagi\": return inputs.graph.nameroot + \".db\";}}")
           #:outputs (metrics #:type string) (odgi-graph #:binding ((glob . "${switch (inputs.tool) { case \"odgi\": return inputs.graph.nameroot + \".og\"; case \"domagi\": return inputs.graph.nameroot + \".db\";}}")))
           #:other ((hints (ResourceRequirement
                            (coresMin . "$(inputs.threads)"))
                           (SoftwareRequirement
                            (packages . #(((package . "domagi"))
                                          ((package . "odgi"))
                                          ((package . "time")))))))))

(define odgi-paths
  (command #:inputs (tool #:type string) graph (threads #:type int)
           #:run "time" "--format={\"metrics\": \"paths %e %U %S %M\"}" "--output=cwl.output.json" tool "paths" ("-t" threads) ("-i" graph) "--list-paths"
	   #:outputs (metrics #:type string)
           #:other ((hints (ResourceRequirement
                            (coresMin . "$(inputs.threads)"))
                           (SoftwareRequirement
                            (packages . #(((package . "domagi"))
                                          ((package . "odgi"))
                                          ((package . "time")))))))))

(define odgi-crush
  (command #:inputs (tool #:type string) graph (threads #:type int)
           #:run "time" "--format={\"metrics\": \"crush %e %U %S %M\"}" "--output=cwl.output.json" tool "crush" ("-t" threads) ("-i" graph) ("-o" "${switch (inputs.tool) { case \"odgi\": return inputs.graph.nameroot + \".og\"; case \"domagi\": return inputs.graph.nameroot + \".db\";}}")
	   #:outputs (metrics #:type string)
           #:other ((hints (ResourceRequirement
                            (coresMin . "$(inputs.threads)"))
                           (SoftwareRequirement
                            (packages . #(((package . "domagi"))
                                          ((package . "odgi"))
                                          ((package . "time")))))))))

(define odgi-depth
  (command #:inputs (tool #:type string) graph (threads #:type int)
           #:run "time" "--format={\"metrics\": \"depth %e %U %S %M\"}" "--output=cwl.output.json" tool "depth" ("-t" threads) ("-i" graph)
	   #:outputs (metrics #:type string)
           #:other ((hints (ResourceRequirement
                            (coresMin . "$(inputs.threads)"))
                           (SoftwareRequirement
                            (packages . #(((package . "domagi"))
                                          ((package . "odgi"))
                                          ((package . "time")))))))))

(define odgi-depth-graph-depth-table
  (command #:inputs (tool #:type string) graph (threads #:type int)
           #:run "time" "--format={\"metrics\": \"depth-table %e %U %S %M\"}" "--output=cwl.output.json" tool "depth" ("-t" threads) ("-i" graph) "--graph-depth-table"
	   #:outputs (metrics #:type string)
           #:other ((hints (ResourceRequirement
                            (coresMin . "$(inputs.threads)"))
                           (SoftwareRequirement
                            (packages . #(((package . "domagi"))
                                          ((package . "odgi"))
                                          ((package . "time")))))))))

(define odgi-matrix
  (command #:inputs (tool #:type string) graph (threads #:type int)
           #:run "time" "--format={\"metrics\": \"matrix %e %U %S %M\"}" "--output=cwl.output.json" tool "matrix" ("-t" threads) ("-i" graph)
	   #:outputs (metrics #:type string)
           #:other ((hints (ResourceRequirement
                            (coresMin . "$(inputs.threads)"))
                           (SoftwareRequirement
                            (packages . #(((package . "domagi"))
                                          ((package . "odgi"))
                                          ((package . "time")))))))))

(define odgi-stats
  (command #:inputs (tool #:type string) graph (threads #:type int)
           #:run "time" "--format={\"metrics\": \"stats %e %U %S %M\"}" "--output=cwl.output.json" tool "stats" ("-t" threads) ("-i" graph)
	   #:outputs (metrics #:type string)
           #:other ((hints (ResourceRequirement
                            (coresMin . "$(inputs.threads)"))
                           (SoftwareRequirement
                            (packages . #(((package . "domagi"))
                                          ((package . "odgi"))
                                          ((package . "time")))))))))

(define odgi-view
  (command #:inputs (tool #:type string) graph (threads #:type int)
           #:run "time" "--format={\"metrics\": \"view %e %U %S %M\"}" "--output=cwl.output.json" tool "view" ("-t" threads) ("-i" graph) "--to-gfa"
	   #:outputs (metrics #:type string)
           #:other ((hints (ResourceRequirement
                            (coresMin . "$(inputs.threads)"))
                           (SoftwareRequirement
                            (packages . #(((package . "domagi"))
                                          ((package . "odgi"))
                                          ((package . "time")))))))))

(define combine-metrics
  (command #:inputs (tool #:type string) (build_metrics #:type string) (crush_metrics #:type string) (depth_metrics #:type string) (depth_graph_depth_table_metrics #:type string) (matrix_metrics #:type string) (paths_metrics #:type string) (stats_metrics #:type string) (view_metrics #:type string)
           #:run "echo" "$([inputs.build_metrics, inputs.crush_metrics, inputs.depth_metrics, inputs.depth_graph_depth_table_metrics, inputs.matrix_metrics, inputs.paths_metrics, inputs.stats_metrics, inputs.view_metrics].join(`\n`))"
           #:outputs (metrics #:type stdout)
           #:stdout "$(inputs.tool)-metrics"
           #:other ((hints (SoftwareRequirement
                            (packages . #(((package . "coreutils")))))))))

(define benchmark-tool
  (workflow ((tool #:type string) chr8 (threads #:type int))
    (pipe (odgi-build #:tool tool
                      #:graph chr8
		      #:threads threads)
	  (rename #:build-metrics metrics)
	  (tee (identity)
               (pipe (odgi-crush #:tool tool
                                 #:graph odgi-graph
				 #:threads threads)
		     (rename #:crush-metrics metrics))
	       (pipe (odgi-depth #:tool tool
                                 #:graph odgi-graph
				 #:threads threads)
		     (rename #:depth-metrics metrics))
	       (pipe (odgi-depth-graph-depth-table #:tool tool
                                                   #:graph odgi-graph
	        			           #:threads threads)
	             (rename #:depth-graph-depth-table-metrics metrics))
               (pipe (odgi-matrix #:tool tool
                                 #:graph odgi-graph
				 #:threads threads)
		     (rename #:matrix-metrics metrics))
	       (pipe (odgi-paths #:tool tool
                                 #:graph odgi-graph
				 #:threads threads)
		     (rename #:paths-metrics metrics))
	       (pipe (odgi-stats #:tool tool
                                 #:graph odgi-graph
				 #:threads threads)
		     (rename #:stats-metrics metrics))
               (pipe (odgi-view #:tool tool
                                #:graph odgi-graph
				#:threads threads)
		     (rename #:view-metrics metrics)))
          (combine-metrics #:tool tool
                           #:build_metrics build-metrics
                           #:crush_metrics crush-metrics
                           #:depth_metrics depth-metrics
                           #:depth_graph_depth_table_metrics depth-graph-depth-table-metrics
                           #:matrix_metrics matrix-metrics
                           #:paths_metrics paths-metrics
                           #:stats_metrics stats-metrics
                           #:view_metrics view-metrics))))

(workflow ((tools #:type (array string)) chr8 (threads #:type int))
  (scatter (benchmark-tool #:chr8 chr8
                           #:threads threads)
           #:tool tools))