rbbt-util 5.21.8 → 5.21.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 215819a1374483cea2057ae08343d6f03b71d41f
4
- data.tar.gz: a22977fcc3e07a9eac6f544d77a61be31caddc9c
3
+ metadata.gz: b865dd691227ababbe46a03ea0ed6960754aea22
4
+ data.tar.gz: 7d68152324663bf6e220f3f66faa9e585815f30f
5
5
  SHA512:
6
- metadata.gz: 3f74b31e23ec63d0f47998a144c0149109804a3421b6f35562769d1488f5fe78b7f8469933a2a8f207c9106b1a8b8daff0ecdd8b81ff6d21eece27d734ab6734
7
- data.tar.gz: 833a891002ef13c8bd6e8655475843af420130b621ba15113e5cddb466f9118eb93e7b0628c2a2a0c97750e24ee37ad25f2a4c851b8618958f691b312420aaa0
6
+ metadata.gz: ff5692023b4ba9aaca267200230eca86ef7f269a7d76f0d1770e4adc54dd436101bf98023f252c01c970c51a01bf311a88b31d7251fded28a4a5394870312149
7
+ data.tar.gz: f1cc66e3892f332b0dca011c06a3b952f0517f18aba6b3e3dda8550b4d3503d77702a90abad1aa65b06256ebea5e566f3f14fc46b2d1994814c7e9ac623970a0
@@ -659,4 +659,9 @@ module Misc
659
659
  end
660
660
  end
661
661
 
662
+ def self.sort_mutations(stream)
663
+ CMD.cmd('grep ":" | sort -u | sed "s/^M:/MT:/" | env LC_ALL=C sort -k1,1 -k2,2n -t:', :in => stream, :pipe => true, :no_fail => true)
664
+ end
665
+
666
+
662
667
  end
@@ -374,7 +374,7 @@ class Step
374
374
  end
375
375
 
376
376
  def stalled?
377
- ! (done? || error? || aborted?) && ! running?
377
+ started? && ! (done? || error? || aborted?) && ! running?
378
378
  end
379
379
 
380
380
  def error?
@@ -16,6 +16,7 @@ $ rbbt workflow info <job-result>
16
16
  -h--help Help
17
17
  -a--all Print all info entries
18
18
  -r--recursive Print recursive input values
19
+ -o--original Print original object
19
20
  EOF
20
21
 
21
22
  SOPT.usage if options[:help]
@@ -59,6 +60,12 @@ end
59
60
  step = get_step file
60
61
 
61
62
  info = step.info
63
+
64
+ if options[:original]
65
+ puts info.inspect
66
+ exit 0
67
+ end
68
+
62
69
  dependencies = info[:dependencies]
63
70
  inputs = info[:inputs]
64
71
  status = info[:status]
@@ -19,6 +19,7 @@ Examine the provenance of a job result
19
19
  $ rbbt workflow prov <job-result>
20
20
 
21
21
  -h--help Help
22
+ -p--plot* draw the dependency plot into <file.png>
22
23
  EOF
23
24
 
24
25
  SOPT.usage if options[:help]
@@ -82,4 +83,78 @@ end
82
83
  step = get_step file
83
84
  $main_mtime = File.exist?(step.path) ? File.mtime(step.path) : nil
84
85
 
85
- puts report(step).strip
86
+ def adjacency(step)
87
+
88
+ info = step.info || {}
89
+ path = step.path
90
+ status = info[:status] || :missing
91
+ status = "remote" if Open.remote?(path)
92
+ if status == 'remote'
93
+ workflow, task, name = path.sub(/\{.*/,'').split("/")[-3..-1]
94
+ else
95
+ workflow, task, name = path.split("/")[-3..-1]
96
+ end
97
+ name = name.split(":").last
98
+ status = :unsync if status == :done and not File.exist? path
99
+ edge_info = {:status => status, :workflow => workflow, :task => task, :name => name, :label => task, :shape => shapes[workflow], :color => status == 'remote' ? 'blue' : 'green'}
100
+ id = Misc.digest(path)
101
+ edges = []
102
+ node_info = {}
103
+ node_info[id] = edge_info
104
+ if info[:dependencies]
105
+ info[:dependencies].each do |task,name,path|
106
+ dep = get_step path
107
+ _id, _edges, _node_info = adjacency(dep)
108
+ edges << [id, _id]
109
+ edges.concat _edges
110
+ node_info.merge!(_node_info)
111
+ end
112
+ end
113
+
114
+ [id, edges, node_info]
115
+ end
116
+
117
+ if options[:plot]
118
+ id, edges, node_info = adjacency(step)
119
+ node_info[id][:color] = 'red'
120
+ TmpFile.with_file do |edge_file|
121
+ Open.write(edge_file) do |f|
122
+ f.puts "from,to"
123
+ edges.each do |from,to|
124
+ f.puts [from,to]*","
125
+ end
126
+ end
127
+ TmpFile.with_file do |node_info_file|
128
+ Open.write(node_info_file) do |f|
129
+ fields = node_info.first.last.keys
130
+ f.puts "id," + fields * ","
131
+ node_info.each do |id,info|
132
+ f.puts ([id] + info.values_at(*fields)) * ","
133
+ end
134
+ end
135
+
136
+ require 'rbbt/util/R'
137
+
138
+ ppp Open.read edge_file
139
+ ppp Open.read node_info_file
140
+
141
+ R.run <<-EOF
142
+ nodes <- read.csv("#{node_info_file}", header=T, as.is=T)
143
+ links <- read.csv("#{edge_file}", header=T, as.is=T)
144
+
145
+ library(igraph)
146
+
147
+ net <- graph.data.frame(links, nodes, directed=T)
148
+ net <- simplify(net, remove.multiple = F, remove.loops = T)
149
+
150
+ png("#{options[:plot]}")
151
+ plot(net, edge.arrow.size=0.4, vertex.label=net$label, vertex.color=net$color)
152
+ dev.off()
153
+ EOF
154
+ end
155
+ end
156
+
157
+ else
158
+ puts report(step).strip
159
+ end
160
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.21.8
4
+ version: 5.21.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-28 00:00:00.000000000 Z
11
+ date: 2016-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake