class BioInterchange::Phylogenetics::TreeSet

A phylogenetic tree set that can contain multiple phylogenetic trees.

Public Class Methods

new() click to toggle source

Create a new instance of a tree set. A tree set can contain multiple phylogenetic trees.

# File lib/biointerchange/phylogenetics/tree_set.rb, line 9
def initialize
  # Trees are stored as the keys of a hash map to increase performance:
  @set = {}
end

Public Instance Methods

add(tree) click to toggle source

Add a tree to the tree set.

tree

BioRuby tree instance that is added to the contents of this tree set

# File lib/biointerchange/phylogenetics/tree_set.rb, line 39
def add(tree)
  @set[tree] = true
end
contents() click to toggle source

Returns the contents of the tree set.

# File lib/biointerchange/phylogenetics/tree_set.rb, line 15
def contents
  @set.keys
end
date() click to toggle source

If a date was provided, then this method returns its value.

# File lib/biointerchange/phylogenetics/tree_set.rb, line 20
def date
  @date
end
prune() click to toggle source

Removes all features from the set, but keeps additional data (e.g., the date).

# File lib/biointerchange/phylogenetics/tree_set.rb, line 44
def prune
  @set.clear
end
set_date(date) click to toggle source

Sets a date that is associated with the trees in this model (e.g., annotation date, creation date, etc.).

date

an instance of Date that is associated with all trees in the model

# File lib/biointerchange/phylogenetics/tree_set.rb, line 27
def set_date(date)
  @date = date
end
uri() click to toggle source

Returns an URI for this particular tree set, which is a not necessarily globally unique SHA1 hash.

# File lib/biointerchange/phylogenetics/tree_set.rb, line 32
def uri
  "biointerchange://phylogenetics/treeset/self/#{Digest::SHA1.hexdigest(Time.now.to_s)}"
end