iroki 0.0.27 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b2edb3ca335f17d6a626dfb3942e126406aee07
4
- data.tar.gz: 8ce0d9190c92bde7dd7df73002e2521fefd3fd90
3
+ metadata.gz: 7fb0a7ac745f83ec8341cbfbac699f9ac3c5f54b
4
+ data.tar.gz: decf8043b7d513ce31aef186155133d63758ddcb
5
5
  SHA512:
6
- metadata.gz: 1b88a8d47e9034dfc393020d54a011f986ea1cbb291479213ed779a8f1220cabc415c7c6c7cfcb2915e7b5e5e7306e9e33196d6f0cba0d6194c676c3ae1c4f07
7
- data.tar.gz: 32530d5109ff8868232d224e78d78a5ff88a8d549ebba7646772cc736eddbe15c84cf80808f17594e07863780371e3c8198198a056b0db7edf5b64a1d4aec6bf
6
+ metadata.gz: 0e823649d07424f55164ed15ecf1af65d2a72f2b7aeb1e6e57003cef2ee009b2b5c6d0b6a3a68c64cf32805499b3f99093a5a60b4842b41f9b3ed3583fa77fa7
7
+ data.tar.gz: 33f53a9b7853311080a57af7815ff5572d4f00fd2e19099b3a9bb615d14b641adbaad35b22a32fffa9fe44aebce9710e86a904b325a2044700af4d3bbcdd286e
data/.gitignore CHANGED
@@ -18,3 +18,4 @@ spec/test_files/nexus_files/output.nex
18
18
  .idea
19
19
  .DS_Store
20
20
  spec/.DS_Store
21
+ TODO.md
data/CHANGELOG.md CHANGED
@@ -111,3 +111,8 @@ Add `reorder_nodes` script.
111
111
  ### 0.0.27 ###
112
112
 
113
113
  - Remove some debugging statements
114
+
115
+ ### 0.0.28 ###
116
+
117
+ - Update `Dockerfile`
118
+ - Let user choose default color (issue 15)
data/bin/iroki_docker CHANGED
@@ -5,17 +5,35 @@ use File::Spec;
5
5
  my @args = ();
6
6
 
7
7
  foreach my $arg (@ARGV) {
8
- if ($arg =~ /^-/) {
8
+ if ($arg =~ /^-/) { # arg is a flag
9
9
  push @args, $arg;
10
- } else {
10
+
11
+ # check if next arg should expand (these are file inputs)
12
+ if ($arg eq "-c" || $arg eq "--color-map" ||
13
+ $arg eq "-i" || $arg eq "--biom" ||
14
+ $arg eq "-f" || $arg eq "--infile" ||
15
+ $arg eq "-o" || $arg eq "--outfile" ||
16
+ $arg eq "-n" || $arg eq "--name-map") {
17
+
18
+ $expand = 1;
19
+ } else {
20
+ $expand = 0;
21
+ }
22
+ } elsif ($expand) { # an arg that is a path, expand it
11
23
  my $path = File::Spec->rel2abs($arg);
24
+
12
25
  push @args, $path;
26
+ } else { # an arg that is not a path and not a flag
27
+ push @args, $arg;
13
28
  }
14
29
  }
15
30
 
16
31
  my $img = "mooreryan/iroki";
17
- my $cmd = "docker run -v \"\$HOME:\$HOME\" $img @args";
32
+ my $pull = "docker pull $img";
33
+ my $run = "docker run -v \"\$HOME:\$HOME\" $img @args";
18
34
 
19
- print "\nRUNNING COMMAND: $cmd\n";
35
+ print "\n\n\nRUNNING COMMAND: $pull\n\n\n";
36
+ system("$pull");
20
37
 
21
- exec("$cmd");
38
+ print "\n\n\nRUNNING COMMAND: $run\n\n\n";
39
+ exec("$run");
data/exe/iroki CHANGED
@@ -30,6 +30,8 @@ opts = Trollop.options do
30
30
 
31
31
  Iroki command line program.
32
32
 
33
+ See https://github.com/mooreryan/iroki/wiki for the Iroki manual.
34
+
33
35
  Options:
34
36
  EOS
35
37
 
@@ -78,6 +80,11 @@ opts = Trollop.options do
78
80
  opt(:outfile,
79
81
  "Name of outfile",
80
82
  type: :string)
83
+
84
+ opt(:default_color,
85
+ "Default color",
86
+ type: :string,
87
+ default: "black")
81
88
  end
82
89
 
83
90
  Iroki::Main.main(
@@ -92,5 +99,6 @@ Iroki::Main.main(
92
99
  auto_color: opts[:auto_color],
93
100
  display_auto_color_options: opts[:display_auto_color_options],
94
101
  newick_f: opts[:infile],
95
- out_f: opts[:outfile]
102
+ out_f: opts[:outfile],
103
+ default_color: opts[:default_color]
96
104
  )
@@ -731,5 +731,13 @@ module Iroki
731
731
  hex = colors[col]
732
732
  %Q{[&!color="#{hex.upcase}"]}
733
733
  end
734
+
735
+ def self.default_color_tag= tag_hash
736
+ @@default_color = tag_hash
737
+ end
738
+
739
+ def self.default_color_tag
740
+ @@default_color ||= nil
741
+ end
734
742
  end
735
743
  end
@@ -183,7 +183,8 @@ module Iroki
183
183
  auto_color: nil,
184
184
  display_auto_color_options: nil,
185
185
  newick_f: nil,
186
- out_f: nil)
186
+ out_f: nil,
187
+ default_color: "black")
187
188
 
188
189
  args = method(__method__).parameters.map { |arg| arg[1] }
189
190
  AbortIf::logger.info "Args " + args.map { |arg| "#{arg} = #{eval(arg.to_s).inspect}" }.join(', ')
@@ -345,6 +346,18 @@ module Iroki
345
346
  patterns = nil
346
347
  end
347
348
 
349
+ # set default color if needed
350
+ if default_color && default_color != "black"
351
+
352
+ abort_if !default_color.hex? && !Iroki::Color::COLORS[default_color],
353
+ "--default-color must be a hex code (don't forget the '#' or a valid color. Got '#{default_color}'."
354
+
355
+ Iroki::Color::default_color_tag = { label: Iroki::Color.get_tag(default_color),
356
+ branch: Iroki::Color.get_tag(default_color), }
357
+ end
358
+
359
+
360
+
348
361
  ####################
349
362
  # get color patterns
350
363
  #################################################################
@@ -32,6 +32,10 @@ module Iroki
32
32
  if patterns.has_key? node_s
33
33
  color = patterns[node_s]
34
34
 
35
+ return color
36
+ elsif Iroki::Color::default_color_tag
37
+ color = Iroki::Color::default_color_tag
38
+
35
39
  return color
36
40
  else
37
41
  return nil
data/lib/iroki/version.rb CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  # Library metadata
20
20
  module Iroki
21
- VERSION = "0.0.27"
21
+ VERSION = "0.0.28"
22
22
  COPYRIGHT = "2015 - 2016 Ryan Moore"
23
23
  CONTACT = "moorer@udel.edu"
24
24
  WEBSITE = "https://github.com/mooreryan/iroki"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iroki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.27
4
+ version: 0.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Moore
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-26 00:00:00.000000000 Z
11
+ date: 2016-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler