summaryrefslogtreecommitdiff
path: root/test/use_cases.rb
blob: 4959f16d0f67d37d10689142b55817d61e86c4ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
require_relative "setup.rb"

class UseCasesTest < MiniTest::Test

  def test_PA
    kazius = Dataset.from_sdf_file "#{DATA_DIR}/cas_4337.sdf"
    hansen = Dataset.from_csv_file "#{DATA_DIR}/hansen.csv"
    efsa = Dataset.from_csv_file "#{DATA_DIR}/efsa.csv"
    datasets = [kazius,hansen,efsa]
    map = {"1" => "mutagen", "0" => "nonmutagen"}
    p "merging"
    training_dataset = Dataset.merge datasets: datasets, features: datasets.collect{|d| d.bioactivity_features.first}, value_maps: [nil,map,map], keep_original_features: false, remove_duplicates: true
    assert_equal 8281, training_dataset.compounds.size
    p training_dataset.features.size
    p training_dataset.id
    training_dataset = Dataset.find('5bd8ac8fca62695d767fca6b')
    p "create model_validation"
    model_validation = Model::Validation.from_dataset training_dataset: training_dataset, prediction_feature: training_dataset.merged_features.first, species: "Salmonella typhimurium", endpoint: "Mutagenicity"
    p model_validation.id
    p "predict"
    pa = Dataset.from_sdf_file "#{DATA_DIR}/PA.sdf"
    prediction_dataset = model_dataset.predict pa
    p prediction_dataset.id
    puts prediction_dataset.to_csv
  end

  def test_public_models
    skip
=begin
    #classification
    aids = [
      1205, #Rodents (multiple species/sites)
      1208, # rat carc
      1199 # mouse
      # Mutagenicity


      1195 #MRDD
      1188 #FHM
      1208, # rat carc td50
      1199 # mouse td50
    
    # daphnia
    # Blood Brain Barrier Penetration
    # Lowest observed adverse effect level (LOAEL)

      # 1204  estrogen receptor
      # 1259408, # GENE-TOX
      # 1159563 HepG2 cytotoxicity assay
      # 588209 hepatotoxicity
      # 1259333 cytotoxicity
      # 1159569 HepG2 cytotoxicity counterscreen Measured in Cell-Based System Using Plate Reader - 2153-03_Inhibitor_Dose_DryPowder_Activity
      # 2122 HTS Counterscreen for Detection of Compound Cytotoxicity in MIN6 Cells
      # 116724 Acute toxicity determined after intravenal administration in mice
      # 1148549 Toxicity in po dosed mouse assessed as mortality after 7 days
=end

  end
end