iroki 0.0.13 → 0.0.14
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 +4 -4
 - data/.ruby-version +1 -1
 - data/.travis.yml +1 -1
 - data/README.md +4 -0
 - data/iroki.gemspec +1 -1
 - data/lib/iroki/biom.rb +12 -1
 - data/lib/iroki/color/color.rb +4 -7
 - data/lib/iroki/color/single_group_gradient.rb +4 -0
 - data/lib/iroki/core_ext/file/file.rb +2 -2
 - data/lib/iroki/main/main.rb +1 -1
 - data/lib/iroki/version.rb +1 -1
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 95a7ef76c36216350d0b539cd3e4b259e725e588
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9701c392d7bbba6e02bccafe2d12461567a8c5dd
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8a9a52dd9d3937beb6dabd144ce98599bc67d30a2f0fed0b094f94aa68e7f044f26d3c725db11e941ea497c39319cda26b6c82532fc1c1c5d6fcb41a730c6338
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d3aed5abfb0cd2b89c06e0e963e47414c7ff082b46d55c467ab5746c85c317b9ff08d97cf682b6e0c75817a72e0f857662ebc7fcbeb660612ac6dce82446578a
         
     | 
    
        data/.ruby-version
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            ruby-2. 
     | 
| 
      
 1 
     | 
    
         
            +
            ruby-2.3.1
         
     | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    
    
        data/iroki.gemspec
    CHANGED
    
    | 
         @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       19 
19 
     | 
    
         
             
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
       20 
20 
     | 
    
         
             
              spec.require_paths = ["lib"]
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
              spec.required_ruby_version = ">= 2. 
     | 
| 
      
 22 
     | 
    
         
            +
              spec.required_ruby_version = ">= 2.3.1"
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
              spec.add_development_dependency "bundler", "~> 1.11"
         
     | 
| 
       25 
25 
     | 
    
         
             
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
    
        data/lib/iroki/biom.rb
    CHANGED
    
    | 
         @@ -23,11 +23,22 @@ module Iroki 
     | 
|
| 
       23 
23 
     | 
    
         
             
                def parse
         
     | 
| 
       24 
24 
     | 
    
         
             
                  samples = []
         
     | 
| 
       25 
25 
     | 
    
         
             
                  counts  = []
         
     | 
| 
      
 26 
     | 
    
         
            +
                  lineno = -1
         
     | 
| 
      
 27 
     | 
    
         
            +
                  first_line_count = -1
         
     | 
| 
       26 
28 
     | 
    
         | 
| 
       27 
     | 
    
         
            -
                  self.each_line do |line|
         
     | 
| 
      
 29 
     | 
    
         
            +
                  self.each_line.with_index do |line, idx|
         
     | 
| 
       28 
30 
     | 
    
         
             
                    unless line.start_with? "#"
         
     | 
| 
      
 31 
     | 
    
         
            +
                      lineno += 1
         
     | 
| 
       29 
32 
     | 
    
         
             
                      sample, *the_counts = line.chomp.split "\t"
         
     | 
| 
       30 
33 
     | 
    
         | 
| 
      
 34 
     | 
    
         
            +
                      if lineno.zero?
         
     | 
| 
      
 35 
     | 
    
         
            +
                        first_line_count = the_counts.count
         
     | 
| 
      
 36 
     | 
    
         
            +
                      else
         
     | 
| 
      
 37 
     | 
    
         
            +
                        abort_unless first_line_count == the_counts.count,
         
     | 
| 
      
 38 
     | 
    
         
            +
                                     "The biom file has rows with different " +
         
     | 
| 
      
 39 
     | 
    
         
            +
                                     "numbers of columns"
         
     | 
| 
      
 40 
     | 
    
         
            +
                      end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
       31 
42 
     | 
    
         
             
                      samples << sample
         
     | 
| 
       32 
43 
     | 
    
         | 
| 
       33 
44 
     | 
    
         
             
                      if the_counts.length == 1
         
     | 
    
        data/lib/iroki/color/color.rb
    CHANGED
    
    | 
         @@ -698,7 +698,7 @@ module Iroki 
     | 
|
| 
       698 
698 
     | 
    
         
             
                WHITE = HSL.from_fraction WHITE_HUE, FULLY_SATURATED, PURE_LIGHT
         
     | 
| 
       699 
699 
     | 
    
         | 
| 
       700 
700 
     | 
    
         
             
                DARK_GREEN = RGB.by_hex(COLORS["darkgreen"])
         
     | 
| 
       701 
     | 
    
         
            -
                GRAY  
     | 
| 
      
 701 
     | 
    
         
            +
                GRAY       = RGB.by_hex(COLORS["gray"])
         
     | 
| 
       702 
702 
     | 
    
         | 
| 
       703 
703 
     | 
    
         
             
                def self.get_tag str, palette=nil
         
     | 
| 
       704 
704 
     | 
    
         
             
                  if str.hex?
         
     | 
| 
         @@ -725,13 +725,10 @@ module Iroki 
     | 
|
| 
       725 
725 
     | 
    
         
             
                    colors = COLORS
         
     | 
| 
       726 
726 
     | 
    
         
             
                  end
         
     | 
| 
       727 
727 
     | 
    
         | 
| 
       728 
     | 
    
         
            -
                   
     | 
| 
       729 
     | 
    
         
            -
             
     | 
| 
       730 
     | 
    
         
            -
                  else
         
     | 
| 
       731 
     | 
    
         
            -
                    # if passed color other than one defined, return black
         
     | 
| 
       732 
     | 
    
         
            -
                    hex = colors["black"]
         
     | 
| 
       733 
     | 
    
         
            -
                  end
         
     | 
| 
      
 728 
     | 
    
         
            +
                  abort_unless colors.has_key?(col),
         
     | 
| 
      
 729 
     | 
    
         
            +
                               "Color '#{col}' is not defined."
         
     | 
| 
       734 
730 
     | 
    
         | 
| 
      
 731 
     | 
    
         
            +
                  hex = colors[col]
         
     | 
| 
       735 
732 
     | 
    
         
             
                  %Q{[&!color="#{hex.upcase}"]}
         
     | 
| 
       736 
733 
     | 
    
         
             
                end
         
     | 
| 
       737 
734 
     | 
    
         
             
              end
         
     | 
| 
         @@ -22,6 +22,10 @@ module Iroki 
     | 
|
| 
       22 
22 
     | 
    
         
             
                  attr_accessor :counts, :rel_abunds
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                  def initialize samples, counts, single_color=false
         
     | 
| 
      
 25 
     | 
    
         
            +
                    abort_unless samples.count == counts.count,
         
     | 
| 
      
 26 
     | 
    
         
            +
                                 "Samples (#{samples.count}) and counts " +
         
     | 
| 
      
 27 
     | 
    
         
            +
                                 "#{counts.count} are different size."
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
       25 
29 
     | 
    
         
             
                    @single_color = single_color
         
     | 
| 
       26 
30 
     | 
    
         
             
                    @samples = samples
         
     | 
| 
       27 
31 
     | 
    
         
             
                    @counts = counts
         
     | 
| 
         @@ -55,7 +55,7 @@ module Iroki 
     | 
|
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
57 
     | 
    
         
             
                    patterns = {}
         
     | 
| 
       58 
     | 
    
         
            -
                    Object::File.open(fname).each_line do |line|
         
     | 
| 
      
 58 
     | 
    
         
            +
                    Object::File.open(fname, "rt").each_line do |line|
         
     | 
| 
       59 
59 
     | 
    
         
             
                      unless line.start_with? "#"
         
     | 
| 
       60 
60 
     | 
    
         
             
                        label_tag = ""
         
     | 
| 
       61 
61 
     | 
    
         
             
                        branch_tag = ""
         
     | 
| 
         @@ -131,7 +131,7 @@ module Iroki 
     | 
|
| 
       131 
131 
     | 
    
         
             
                    check_file fname, :name_map
         
     | 
| 
       132 
132 
     | 
    
         | 
| 
       133 
133 
     | 
    
         
             
                    name_map = {}
         
     | 
| 
       134 
     | 
    
         
            -
                    Object::File.open(fname).each_line do |line|
         
     | 
| 
      
 134 
     | 
    
         
            +
                    Object::File.open(fname, "rt").each_line do |line|
         
     | 
| 
       135 
135 
     | 
    
         
             
                      unless line.start_with? "#"
         
     | 
| 
       136 
136 
     | 
    
         
             
                        oldname, newname = line.chomp.split "\t"
         
     | 
| 
       137 
137 
     | 
    
         | 
    
        data/lib/iroki/main/main.rb
    CHANGED
    
    | 
         @@ -98,7 +98,7 @@ module Iroki 
     | 
|
| 
       98 
98 
     | 
    
         
             
                                               exact_matching: exact,
         
     | 
| 
       99 
99 
     | 
    
         
             
                                               auto_color: auto_color_hash
         
     | 
| 
       100 
100 
     | 
    
         
             
                  else
         
     | 
| 
       101 
     | 
    
         
            -
                    samples, counts, is_single_group = Biom.open(biom_f).parse
         
     | 
| 
      
 101 
     | 
    
         
            +
                    samples, counts, is_single_group = Biom.open(biom_f, "rt").parse
         
     | 
| 
       102 
102 
     | 
    
         | 
| 
       103 
103 
     | 
    
         
             
                    if is_single_group
         
     | 
| 
       104 
104 
     | 
    
         
             
                      patterns = SingleGroupGradient.new(samples, counts, single_color).patterns
         
     | 
    
        data/lib/iroki/version.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.14
         
     | 
| 
       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-08- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-08-04 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -222,7 +222,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       222 
222 
     | 
    
         
             
              requirements:
         
     | 
| 
       223 
223 
     | 
    
         
             
              - - ">="
         
     | 
| 
       224 
224 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       225 
     | 
    
         
            -
                  version: 2. 
     | 
| 
      
 225 
     | 
    
         
            +
                  version: 2.3.1
         
     | 
| 
       226 
226 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       227 
227 
     | 
    
         
             
              requirements:
         
     | 
| 
       228 
228 
     | 
    
         
             
              - - ">="
         
     | 
| 
         @@ -230,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       230 
230 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       231 
231 
     | 
    
         
             
            requirements: []
         
     | 
| 
       232 
232 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       233 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 233 
     | 
    
         
            +
            rubygems_version: 2.5.1
         
     | 
| 
       234 
234 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       235 
235 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       236 
236 
     | 
    
         
             
            summary: Command line app and library code for Iroki, a phylogenetic tree customization
         
     |