iroki 0.0.19 → 0.0.20

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: d7215825faf52d3fac7519b74ed50f548f32a26d
4
- data.tar.gz: 2c1099e7848d771595966d610a18130714a904bf
3
+ metadata.gz: cb67d2dc5061c2179894ac9f073504df648d29d7
4
+ data.tar.gz: 71f43e1773fcb2e69e5088543f83856673727ac2
5
5
  SHA512:
6
- metadata.gz: be40fd327706b67f1100a66c90ce0dec9361250bbc03e1fa2d9ec389d845f6a3ea54d4592946c6734f788f248690b87a32410a08c094e53f2aa6330cd3f9d3b3
7
- data.tar.gz: a744c93eab63c176cde75b6e0de6eb2817e85094c4411f44664cf280c00ef864117e6315191cec838d3fecf8bef1de80a379f8db8c229b7a325b2b76cf004c6d
6
+ metadata.gz: eed9c447d1cf5cc883d94474abf826619a04bbe9688b6c7be99d5512bbdda14c17174b3becad1751122b845deaa31bc8641e17ca43cb6f034f0f2707c04a5a31
7
+ data.tar.gz: d6808c9ed89514ed2ce541869c297c64a53111d827cf7e7ed698570b6135b2c686988606ee753980d8f8e80d1fc6570b78d92b45577bd1518724f65ba81041f6
data/README.md CHANGED
@@ -160,3 +160,7 @@ Add `reorder_nodes` script.
160
160
  ### 0.0.19 ###
161
161
 
162
162
  - Remove assertion that color map cannot have entries that aren't in the newick file
163
+
164
+ ### 0.0.20 ###
165
+
166
+ - Handle more examples of bad biom files and bad name maps
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
- "The biom file has rows with different " +
39
- "numbers of columns"
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
@@ -18,7 +18,7 @@
18
18
 
19
19
  # Library metadata
20
20
  module Iroki
21
- VERSION = "0.0.19"
21
+ VERSION = "0.0.20"
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.19
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-17 00:00:00.000000000 Z
11
+ date: 2016-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler