lib/WingenderTFClass/obo/tf_classification.rb in WingenderTFClass-0.1.0 vs lib/WingenderTFClass/obo/tf_classification.rb in WingenderTFClass-0.1.1
- old
+ new
@@ -1,8 +1,21 @@
require_relative 'term'
+require_relative '../local_paths'
module WingenderTFClass
module OBO
class TFClassification
+
+ def self.by_species(species)
+ case species.to_s.downcase
+ when 'human'
+ OBO::TFClassification.from_file(FilePaths::TFOntologyHuman)
+ when 'mouse'
+ OBO::TFClassification.from_file(FilePaths::TFOntologyMouse)
+ else
+ raise "Unknown species `#{species}`"
+ end
+ end
+
# terms by ids
def initialize()
@terms_by_id = {}
@children_by_id = Hash.new{|h,k| h[k] = [] }
@terms_by_name = Hash.new{|h,k| h[k] = [] }