Sha256: 541f1f0cc0a2059349639428f390401cc27cf44611170b133700011e8960efa4

Contents?: true

Size: 1.63 KB

Versions: 706

Compression:

Stored size: 1.63 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '../../../test_helper')
require 'rbbt/util/tmpfile'
require 'test/unit'
require 'rbbt/knowledge_base'
require 'rbbt/knowledge_base/query'

module Gene
  extend Entity
end
class TestKnowledgeBaseSyndicate < Test::Unit::TestCase

  EFFECT =StringIO.new <<-END
#: :sep=" "#:type=:double
#SG TG Effect
MDM2 TP53 inhibition
TP53 NFKB1|GLI1 activation|activation true|true
  END

  EFFECT_OPTIONS = {
    :source => "SG=~Associated Gene Name",
    :target => "TG=~Associated Gene Name=>Ensembl Gene ID",
    :persist => false,
    :identifiers => datafile_test('identifiers'),
    :undirected => true,
    :namespace => "Hsa"
  }

  EFFECT_TSV = TSV.open EFFECT, EFFECT_OPTIONS.dup 

  KNOWLEDGE_BASE = KnowledgeBase.new '/tmp/kb.foo2', "Hsa"
  KNOWLEDGE_BASE.format = {"Gene" => "Ensembl Gene ID"}
  KNOWLEDGE_BASE.entity_options["Gene"] = {:organism => "Mmu", :test_option => "TEST"}

  KNOWLEDGE_BASE.register :effects, EFFECT_TSV, EFFECT_OPTIONS.dup

  def test_syndicate_entity_options
    Gene.add_identifiers datafile_test('identifiers')
    kb = KnowledgeBase.new "/tmp/kb.foo3", "Hsa"
    kb.format = {"Gene" => "Associated Gene Name"} 
    kb.syndicate :orig, KNOWLEDGE_BASE
    assert_equal "Mmu", KNOWLEDGE_BASE.entity_options_for("Gene", "effects")[:organism]
    assert_equal "Mmu", kb.get_index("effects@orig").entity_options["Gene"][:organism]
    assert_equal "Mmu", kb.get_database("effects@orig").entity_options["Gene"][:organism]
    assert_equal "Mmu", kb.entity_options_for("Gene", "effects@orig")[:organism]
    assert_equal "Mmu", kb.children("effects@orig", "TP53").source_entity.organism
  end
end

Version data entries

706 entries across 706 versions & 1 rubygems

Version Path
rbbt-util-5.17.77 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.76 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.75 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.74 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.73 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.72 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.71 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.70 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.69 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.68 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.67 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.66 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.65 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.64 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.63 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.62 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.61 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.60 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.59 test/rbbt/knowledge_base/test_syndicate.rb
rbbt-util-5.17.58 test/rbbt/knowledge_base/test_syndicate.rb