From: martinahansen Date: Mon, 9 May 2011 10:24:51 +0000 (+0000) Subject: added coverage method to prodigal.rb X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=13f9d3da9b74bc95bfd0aaccbc66e096b9394648;p=biopieces.git added coverage method to prodigal.rb git-svn-id: http://biopieces.googlecode.com/svn/trunk@1384 74ccb610-7750-0410-82ae-013aeee3265d --- diff --git a/code_ruby/Maasha/lib/prodigal.rb b/code_ruby/Maasha/lib/prodigal.rb index a6661ad..1a1fd55 100644 --- a/code_ruby/Maasha/lib/prodigal.rb +++ b/code_ruby/Maasha/lib/prodigal.rb @@ -58,6 +58,17 @@ class Prodigal end end + # Method that returns the sum of the predicted gene lengths. + def coverage + coverage = 0 + + self.each do |gb| + coverage += gb[:S_END] - gb[:S_BEG] + end + + coverage + end + private # Method to execute commands on the command line.