iroki 0.0.19 → 0.0.20
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/README.md +4 -0
 - data/lib/iroki/biom.rb +18 -2
 - data/lib/iroki/core_ext/file/file.rb +3 -0
 - data/lib/iroki/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: cb67d2dc5061c2179894ac9f073504df648d29d7
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 71f43e1773fcb2e69e5088543f83856673727ac2
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: eed9c447d1cf5cc883d94474abf826619a04bbe9688b6c7be99d5512bbdda14c17174b3becad1751122b845deaa31bc8641e17ca43cb6f034f0f2707c04a5a31
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d6808c9ed89514ed2ce541869c297c64a53111d827cf7e7ed698570b6135b2c686988606ee753980d8f8e80d1fc6570b78d92b45577bd1518724f65ba81041f6
         
     | 
    
        data/README.md
    CHANGED
    
    
    
        data/lib/iroki/biom.rb
    CHANGED
    
    | 
         @@ -16,6 +16,10 @@ 
     | 
|
| 
       16 
16 
     | 
    
         
             
            # You should have received a copy of the GNU General Public License
         
     | 
| 
       17 
17 
     | 
    
         
             
            # along with Iroki.  If not, see <http://www.gnu.org/licenses/>.
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
      
 19 
     | 
    
         
            +
            def count_or_rel_abund? str
         
     | 
| 
      
 20 
     | 
    
         
            +
              str.match /\A[01]?.?[0-9]+\Z/
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       19 
23 
     | 
    
         
             
            module Iroki
         
     | 
| 
       20 
24 
     | 
    
         
             
              class Biom < File
         
     | 
| 
       21 
25 
     | 
    
         
             
                attr_accessor :single_group
         
     | 
| 
         @@ -31,12 +35,24 @@ module Iroki 
     | 
|
| 
       31 
35 
     | 
    
         
             
                      lineno += 1
         
     | 
| 
       32 
36 
     | 
    
         
             
                      sample, *the_counts = line.chomp.split "\t"
         
     | 
| 
       33 
37 
     | 
    
         | 
| 
      
 38 
     | 
    
         
            +
                      abort_if sample.nil? || sample.empty? || sample =~ / +/,
         
     | 
| 
      
 39 
     | 
    
         
            +
                               "Line #{idx+1} has no sample"
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                      the_counts.flatten.each do |count|
         
     | 
| 
      
 42 
     | 
    
         
            +
                        abort_unless count_or_rel_abund?(count),
         
     | 
| 
      
 43 
     | 
    
         
            +
                                     "The value '#{count}' in the biom file " +
         
     | 
| 
      
 44 
     | 
    
         
            +
                                     "was not a count or relative abundance"
         
     | 
| 
      
 45 
     | 
    
         
            +
                      end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
       34 
47 
     | 
    
         
             
                      if lineno.zero?
         
     | 
| 
       35 
48 
     | 
    
         
             
                        first_line_count = the_counts.count
         
     | 
| 
       36 
49 
     | 
    
         
             
                      else
         
     | 
| 
       37 
50 
     | 
    
         
             
                        abort_unless first_line_count == the_counts.count,
         
     | 
| 
       38 
     | 
    
         
            -
                                     " 
     | 
| 
       39 
     | 
    
         
            -
                                     " 
     | 
| 
      
 51 
     | 
    
         
            +
                                     "Line number #{idx+1} (#{line.inspect}) in the " +
         
     | 
| 
      
 52 
     | 
    
         
            +
                                     "biom file has #{the_counts.count} " +
         
     | 
| 
      
 53 
     | 
    
         
            +
                                     "columns when it should have " +
         
     | 
| 
      
 54 
     | 
    
         
            +
                                     "#{first_line_count} columns like the " +
         
     | 
| 
      
 55 
     | 
    
         
            +
                                     "first row does."
         
     | 
| 
       40 
56 
     | 
    
         
             
                      end
         
     | 
| 
       41 
57 
     | 
    
         | 
| 
       42 
58 
     | 
    
         
             
                      samples << sample
         
     | 
| 
         @@ -226,6 +226,9 @@ module Iroki 
     | 
|
| 
       226 
226 
     | 
    
         
             
                    name_map = {}
         
     | 
| 
       227 
227 
     | 
    
         
             
                    Object::File.open(fname, "rt").each_line do |line|
         
     | 
| 
       228 
228 
     | 
    
         
             
                      unless line.start_with? "#"
         
     | 
| 
      
 229 
     | 
    
         
            +
                        abort_if line.chomp.split("\t").count > 2,
         
     | 
| 
      
 230 
     | 
    
         
            +
                                 "Line (#{line.inspect}) has more than two columns"
         
     | 
| 
      
 231 
     | 
    
         
            +
             
     | 
| 
       229 
232 
     | 
    
         
             
                        oldname, newname = line.chomp.split "\t"
         
     | 
| 
       230 
233 
     | 
    
         | 
| 
       231 
234 
     | 
    
         | 
    
        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.20
         
     | 
| 
       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-19 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |