[BioRuby-cvs] bioruby/lib/bio tree.rb,1.3,1.4
Naohisa Goto
ngoto at dev.open-bio.org
Fri Dec 15 18:32:02 UTC 2006
Update of /home/repository/bioruby/bioruby/lib/bio
In directory dev.open-bio.org:/tmp/cvs-serv20722/lib/bio
Modified Files:
tree.rb
Log Message:
Added Bio::Tree::total_distance to calculate total distance (total
length) of the current tree.
Index: tree.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/tree.rb,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** tree.rb 13 Dec 2006 16:29:37 -0000 1.3
--- tree.rb 15 Dec 2006 18:32:00 -0000 1.4
***************
*** 694,697 ****
--- 694,706 ----
end
+ # Returns total distance of all edges.
+ # It would raise error if some edges didn't contain distance values.
+ def total_distance
+ distance = 0
+ self.each_edge do |source, target, edge|
+ distance += get_edge_distance(edge)
+ end
+ distance
+ end
# Calculates distance matrix of given nodes.
More information about the bioruby-cvs
mailing list