lib/iroki/biom.rb in iroki-0.0.29 vs lib/iroki/biom.rb in iroki-0.0.30

- old
+ new

@@ -14,12 +14,13 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Iroki. If not, see <http://www.gnu.org/licenses/>. -def count_or_rel_abund? str - str.match /\A[01]?.?[0-9]+\Z/ +def valid_numerical_val? str + # looks something like sci notation + str.match(/[-+]?[0-9]?\.?[0-9]?[eE]?[-+]?[0-9]+/) end module Iroki class Biom < File attr_accessor :single_group @@ -37,12 +38,12 @@ abort_if sample.nil? || sample.empty? || sample =~ / +/, "Line #{idx+1} has no sample" the_counts.flatten.each do |count| - abort_unless count_or_rel_abund?(count), - "The value '#{count}' in the biom file " + - "was not a count or relative abundance" + abort_unless valid_numerical_val?(count), + "The value '#{count}' in the " + + "biom file might not be valid" end if lineno.zero? first_line_count = the_counts.count else