iroki 0.0.1

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.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in iroki.gemspec
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,70 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %w(app lib config test spec features) \
6
+ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
7
+
8
+ ## Note: if you are using the `directories` clause above and you are not
9
+ ## watching the project directory ('.'), then you will want to move
10
+ ## the Guardfile to a watched dir and symlink it back, e.g.
11
+ #
12
+ # $ mkdir config
13
+ # $ mv Guardfile config/
14
+ # $ ln -s config/Guardfile .
15
+ #
16
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
17
+
18
+ # Note: The cmd option is now required due to the increasing number of ways
19
+ # rspec may be run, below are examples of the most common uses.
20
+ # * bundler: 'bundle exec rspec'
21
+ # * bundler binstubs: 'bin/rspec'
22
+ # * spring: 'bin/rspec' (This will use spring if running and you have
23
+ # installed the spring binstubs per the docs)
24
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
25
+ # * 'just' rspec: 'rspec'
26
+
27
+ guard :rspec, cmd: "bundle exec rspec" do
28
+ require "guard/rspec/dsl"
29
+ dsl = Guard::RSpec::Dsl.new(self)
30
+
31
+ # Feel free to open issues for suggestions and improvements
32
+
33
+ # RSpec files
34
+ rspec = dsl.rspec
35
+ watch(rspec.spec_helper) { rspec.spec_dir }
36
+ watch(rspec.spec_support) { rspec.spec_dir }
37
+ watch(rspec.spec_files)
38
+
39
+ # Ruby files
40
+ ruby = dsl.ruby
41
+ dsl.watch_spec_files_for(ruby.lib_files)
42
+
43
+ # Rails files
44
+ rails = dsl.rails(view_extensions: %w(erb haml slim))
45
+ dsl.watch_spec_files_for(rails.app_files)
46
+ dsl.watch_spec_files_for(rails.views)
47
+
48
+ watch(rails.controllers) do |m|
49
+ [
50
+ rspec.spec.("routing/#{m[1]}_routing"),
51
+ rspec.spec.("controllers/#{m[1]}_controller"),
52
+ rspec.spec.("acceptance/#{m[1]}")
53
+ ]
54
+ end
55
+
56
+ # Rails config changes
57
+ watch(rails.spec_helper) { rspec.spec_dir }
58
+ watch(rails.routes) { "#{rspec.spec_dir}/routing" }
59
+ watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
60
+
61
+ # Capybara features specs
62
+ watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
63
+ watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") }
64
+
65
+ # Turnip features and steps
66
+ watch(%r{^spec/acceptance/(.+)\.feature$})
67
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
68
+ Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
69
+ end
70
+ end
data/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Iroki #
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/iroki.svg)](https://badge.fury.io/rb/iroki) [![Build Status](https://travis-ci.org/mooreryan/iroki.svg?branch=master)](https://travis-ci.org/mooreryan/iroki) [![Coverage Status](https://coveralls.io/repos/github/mooreryan/iroki/badge.svg?branch=master)](https://coveralls.io/github/mooreryan/iroki?branch=master)
4
+
5
+ Library code for Iroki, a phylogenetic tree customization program.
6
+
7
+ ## Installation ##
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'iroki'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install iroki
22
+
23
+ ## Development ##
24
+
25
+ After checking out the repo, run `bin/setup` to install
26
+ dependencies. Then, run `rake spec` to run the tests. You can also run
27
+ `bin/console` for an interactive prompt that will allow you to
28
+ experiment.
29
+
30
+ To install this gem onto your local machine, run `bundle exec rake
31
+ install`. To release a new version, update the version number in
32
+ `version.rb`, and then run `bundle exec rake release`, which will
33
+ create a git tag for the version, push git commits and tags, and push
34
+ the `.gem` file to [rubygems.org](https://rubygems.org).
35
+
36
+ ## Contributing ##
37
+
38
+ Bug reports and pull requests are welcome on GitHub at
39
+ https://github.com/mooreryan/iroki. This project is intended to
40
+ be a safe, welcoming space for collaboration, and contributors are
41
+ expected to adhere to the
42
+ [Contributor Covenant](http://contributor-covenant.org) code of
43
+ conduct.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "iroki"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/iroki ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Copyright 2016 Ryan Moore
4
+ # Contact: moorer@udel.edu
5
+ #
6
+ # This file is part of Iroki.
7
+ #
8
+ # Iroki is free software: you can redistribute it and/or modify it
9
+ # under the terms of the GNU General Public License as published by
10
+ # the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # Iroki is distributed in the hope that it will be useful, but
14
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU General Public License
19
+ # along with Iroki. If not, see <http://www.gnu.org/licenses/>.
20
+
21
+ require "iroki"
22
+ require "trollop"
23
+
24
+ opts = Trollop.options do
25
+ version Iroki::VERSION_BANNER
26
+
27
+ banner <<-EOS
28
+
29
+ #{Iroki::VERSION_BANNER}
30
+
31
+ Iroki command line program.
32
+
33
+ Options:
34
+ EOS
35
+
36
+ opt(:color_branches,
37
+ "Color branches?",
38
+ short: "-b")
39
+
40
+ opt(:color_taxa_names,
41
+ "Color label names?",
42
+ short: "-t")
43
+
44
+ opt(:exact,
45
+ "Exact pattern matching")
46
+
47
+ opt(:remove_bootstraps_below,
48
+ "Remove bootstrap values below given value",
49
+ type: :float)
50
+
51
+ opt(:color_map,
52
+ "File with color mappings",
53
+ type: :string)
54
+
55
+ opt(:name_map,
56
+ "File with name mappings",
57
+ type: :string)
58
+
59
+ opt(:auto_color,
60
+ "Specify color scheme for auto coloring",
61
+ type: :string)
62
+
63
+ opt(:display_auto_color_options,
64
+ "Display options for auto coloring")
65
+
66
+ opt(:infile,
67
+ "Name of input newick file",
68
+ type: :string)
69
+
70
+ opt(:outfile,
71
+ "Name of outfile",
72
+ type: :string)
73
+ end
74
+
75
+ Iroki::Main.main(
76
+ color_branches: opts[:color_branches],
77
+ color_taxa_names: opts[:color_taxa_names],
78
+ exact: opts[:exact],
79
+ remove_bootstraps_below: opts[:remove_bootstraps_below],
80
+ color_map_f: opts[:color_map],
81
+ name_map_f: opts[:name_map],
82
+ auto_color: opts[:auto_color],
83
+ display_auto_color_options: opts[:display_auto_color_options],
84
+ newick_f: opts[:infile],
85
+ out_f: opts[:outfile]
86
+ )
data/iroki.gemspec ADDED
@@ -0,0 +1,34 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'iroki/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "iroki"
8
+ spec.version = Iroki::VERSION
9
+ spec.authors = ["Ryan Moore"]
10
+ spec.email = ["moorer@udel.edu"]
11
+
12
+ spec.summary = %q{Library code for Iroki, a phylogenetic tree customization program.}
13
+ spec.description = %q{Library code for Iroki, a phylogenetic tree customization program.}
14
+ spec.homepage = "https://github.com/mooreryan/iroki"
15
+ spec.license = "GPLv3: http://www.gnu.org/licenses/gpl.txt"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.required_ruby_version = ">= 2.2.4"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.11"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.0"
27
+ spec.add_development_dependency "guard-rspec", "~> 4.6", ">= 4.6.4"
28
+ spec.add_development_dependency "yard", "~> 0.8.7.6"
29
+ spec.add_development_dependency "coveralls", "~> 0.8.11"
30
+
31
+ spec.add_runtime_dependency "abort_if", "~> 0.1.0"
32
+ spec.add_runtime_dependency "bio", "~> 1.5"
33
+ spec.add_runtime_dependency "trollop", "~> 2.1", ">= 2.1.2"
34
+ end
data/lib/iroki.rb ADDED
@@ -0,0 +1,42 @@
1
+ # Copyright 2016 Ryan Moore
2
+ # Contact: moorer@udel.edu
3
+ #
4
+ # This file is part of Iroki.
5
+ #
6
+ # Iroki is free software: you can redistribute it and/or modify it
7
+ # under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Iroki is distributed in the hope that it will be useful, but
12
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Iroki. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ require "abort_if"
20
+
21
+ require "iroki/version"
22
+ require "iroki/const/const"
23
+ require "iroki/color/color"
24
+ require "iroki/core_ext/hash/hash"
25
+ require "iroki/core_ext/string/string"
26
+ require "iroki/core_ext/file/file"
27
+ require "iroki/utils/utils"
28
+ require "iroki/main/main"
29
+
30
+
31
+ include Iroki::Const
32
+ include Iroki::Color
33
+ include Iroki::CoreExt::Hash
34
+ include Iroki::CoreExt::String
35
+ include Iroki::CoreExt::File
36
+ include Iroki::Utils
37
+
38
+ include AbortIf
39
+
40
+
41
+ module Iroki
42
+ end
@@ -0,0 +1,58 @@
1
+ # Copyright 2016 Ryan Moore
2
+ # Contact: moorer@udel.edu
3
+ #
4
+ # This file is part of Iroki.
5
+ #
6
+ # Iroki is free software: you can redistribute it and/or modify it
7
+ # under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Iroki is distributed in the hope that it will be useful, but
12
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Iroki. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ module Iroki
20
+ module Color
21
+ BASIC =
22
+ { "1" => "#FF3814", # red
23
+ "2" => "#712BFF", # blue
24
+ "3" => "#FFDF14", # yellow
25
+ "4" => "#14FF63", } # green
26
+
27
+ BASIC_LIGHT =
28
+ { "1" => "#FF8872",
29
+ "2" => "#A97FFE",
30
+ "3" => "#FFEC72",
31
+ "4" => "#71FEA1", }
32
+
33
+ BASIC_DARK =
34
+ { "1" => "#FF2800",
35
+ "2" => "#4901DD",
36
+ "3" => "#FFDD00",
37
+ "4" => "#00E24D", }
38
+
39
+ FUNKY =
40
+ { "1" => "#FF7314",
41
+ "2" => "#9F23FF",
42
+ "3" => "#FFF814",
43
+ "4" => "#14FFD8", }
44
+
45
+ FUNKY_LIGHT =
46
+ { "1" => "#FFAB72",
47
+ "2" => "#C57AFE",
48
+ "3" => "#FFFB72",
49
+ "4" => "#71FEE6", }
50
+
51
+ FUNKY_DARK =
52
+ { "1" => "#FF6700",
53
+ "2" => "#7C01DC",
54
+ "3" => "#FFF700",
55
+ "4" => "#00D7B3", }
56
+
57
+ end
58
+ end
@@ -0,0 +1,115 @@
1
+ # Copyright 2016 Ryan Moore
2
+ # Contact: moorer@udel.edu
3
+ #
4
+ # This file is part of Iroki.
5
+ #
6
+ # Iroki is free software: you can redistribute it and/or modify it
7
+ # under the terms of the GNU General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # Iroki is distributed in the hope that it will be useful, but
12
+ # WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU General Public License
17
+ # along with Iroki. If not, see <http://www.gnu.org/licenses/>.
18
+
19
+ module Iroki
20
+ module Const
21
+ COPYRIGHT = "2016 Ryan Moore"
22
+ CONTACT = "moorer@udel.edu"
23
+ WEBSITE = "https://github.com/mooreryan/color_tree"
24
+ LICENSE = "GPLv3"
25
+
26
+ VERSION_BANNER = " # Version: #{Iroki::VERSION}
27
+ # Copyright #{COPYRIGHT}
28
+ # Contact: #{CONTACT}
29
+ # Website: #{WEBSITE}
30
+ # License: #{LICENSE}"
31
+
32
+ FIG = 'begin figtree;
33
+ set appearance.backgroundColorAttribute="Default";
34
+ set appearance.backgroundColour=#-1;
35
+ set appearance.branchColorAttribute="User selection";
36
+ set appearance.branchLineWidth=1.0;
37
+ set appearance.branchMinLineWidth=0.0;
38
+ set appearance.branchWidthAttribute="Fixed";
39
+ set appearance.foregroundColour=#-16777216;
40
+ set appearance.selectionColour=#-2144520576;
41
+ set branchLabels.colorAttribute="User selection";
42
+ set branchLabels.displayAttribute="Branch times";
43
+ set branchLabels.fontName="sansserif";
44
+ set branchLabels.fontSize=8;
45
+ set branchLabels.fontStyle=0;
46
+ set branchLabels.isShown=false;
47
+ set branchLabels.significantDigits=2;
48
+ set colour.scheme.label="label:InterpolatingContinuous{{false,false,0.0,0.0},#000000,#000000}";
49
+ set layout.expansion=0;
50
+ set layout.layoutType="RECTILINEAR";
51
+ set layout.zoom=0;
52
+ set legend.attribute=null;
53
+ set legend.fontSize=10.0;
54
+ set legend.isShown=false;
55
+ set legend.significantDigits=2;
56
+ set nodeBars.barWidth=4.0;
57
+ set nodeBars.displayAttribute=null;
58
+ set nodeBars.isShown=false;
59
+ set nodeLabels.colorAttribute="label";
60
+ set nodeLabels.displayAttribute="label";
61
+ set nodeLabels.fontName="sansserif";
62
+ set nodeLabels.fontSize=8;
63
+ set nodeLabels.fontStyle=0;
64
+ set nodeLabels.isShown=true;
65
+ set nodeLabels.significantDigits=2;
66
+ set nodeShape.colourAttribute=null;
67
+ set nodeShape.isShown=false;
68
+ set nodeShape.minSize=10.0;
69
+ set nodeShape.scaleType=Width;
70
+ set nodeShape.shapeType=Circle;
71
+ set nodeShape.size=4.0;
72
+ set nodeShape.sizeAttribute=null;
73
+ set polarLayout.alignTipLabels=false;
74
+ set polarLayout.angularRange=0;
75
+ set polarLayout.rootAngle=0;
76
+ set polarLayout.rootLength=100;
77
+ set polarLayout.showRoot=true;
78
+ set radialLayout.spread=0.0;
79
+ set rectilinearLayout.alignTipLabels=false;
80
+ set rectilinearLayout.curvature=0;
81
+ set rectilinearLayout.rootLength=100;
82
+ set scale.offsetAge=0.0;
83
+ set scale.rootAge=1.0;
84
+ set scale.scaleFactor=1.0;
85
+ set scale.scaleRoot=false;
86
+ set scaleAxis.automaticScale=true;
87
+ set scaleAxis.fontSize=8.0;
88
+ set scaleAxis.isShown=false;
89
+ set scaleAxis.lineWidth=1.0;
90
+ set scaleAxis.majorTicks=1.0;
91
+ set scaleAxis.origin=0.0;
92
+ set scaleAxis.reverseAxis=false;
93
+ set scaleAxis.showGrid=true;
94
+ set scaleBar.automaticScale=true;
95
+ set scaleBar.fontSize=10.0;
96
+ set scaleBar.isShown=true;
97
+ set scaleBar.lineWidth=1.0;
98
+ set scaleBar.scaleRange=0.0;
99
+ set tipLabels.colorAttribute="User selection";
100
+ set tipLabels.displayAttribute="Names";
101
+ set tipLabels.fontName="sansserif";
102
+ set tipLabels.fontSize=8;
103
+ set tipLabels.fontStyle=0;
104
+ set tipLabels.isShown=true;
105
+ set tipLabels.significantDigits=2;
106
+ set trees.order=true;
107
+ set trees.orderType="increasing";
108
+ set trees.rooting=false;
109
+ set trees.rootingType="User Selection";
110
+ set trees.transform=false;
111
+ set trees.transformType="cladogram";
112
+ end;
113
+ '
114
+ end
115
+ end