Sha256: e49cbffd90d85cdc399e4d8b55ddb12ee953051508c0804f91fb5dbbd76ce13f

Contents?: true

Size: 1.75 KB

Versions: 18

Compression:

Stored size: 1.75 KB

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), '../..', 'test_helper.rb')
require 'rbbt/knowledge_base/traverse'
require 'rbbt/workflow'

class TestKnowledgeBaseTraverse < Test::Unit::TestCase
  def setup
    Workflow.require_workflow "Genomics"
  end

  def kb
    Genomics.knowledge_base
  end

  def test_traverse
    rules = []
    rules << "?1 pina SF3B1 - Method=MI:0006"
    rules << "TP53 pina ?2"
    rules << "?2 pina ?1"
    res =  kb.traverse rules
    assert res.first.include? "?1"
  end

  def test_traverse2
    rules = []
    rules << "?target =pina SF3B1"
    rules << "?1 pina ?target - Method=MI:0006"
    rules << "TP53 pina ?2"
    rules << "?2 pina ?1"
    res =  kb.traverse rules
    assert res.first.include? "?1"
  end

  def test_traverse3
    rules = []
    rules << "?target = ENSG00000115524"
    rules << "?1 pina ?target - Method=MI:0006"
    rules << "TP53 pina ?2"
    rules << "?2 pina ?1"
    res =  kb.traverse rules
    assert res.first.include? "?1"
  end


  def test_traverse_acc
    Log.severity = 0
    rules_str=<<-EOF
?target{
  ?target pina SF3B1
}
?1 pina TP53
?1 pina ?target
    EOF
    rules = rules_str.split "\n"
    res =  kb.traverse rules
    iii res
    assert res.first.include? "?1"
  end


  def test_path
    rules = []
    rules << "?1 pina ARPC2"
    rules << "ARPC3 pina ?2"
    rules << "?2 pina ?1"
    res =  kb.traverse rules
    assert res.first.include? "?1"
  end

  def test_path2
    rules = []
    rules << "?1 pina SF3B1"
    rules << "?2 pina SF3B1"
    rules << "?1 pina ?2"
    res =  kb.traverse rules
    assert res.first.include? "?1"
  end

  def test_wildcard_db
    rules = []
    rules << "?1 ?db SF3B1 - Method=MI:0006"
    res =  kb.traverse rules
    assert res.first.include? "?1"
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
rbbt-util-5.42.0 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.41.1 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.41.0 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.40.5 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.40.4 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.40.3 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.40.0 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.39.0 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.38.1 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.38.0 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.37.16 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.37.15 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.37.14 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.37.13 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.37.12 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.37.11 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.37.10 test/rbbt/knowledge_base/test_traverse.rb
rbbt-util-5.37.9 test/rbbt/knowledge_base/test_traverse.rb