From 6d68a1ca94937a0553f61ebbbbd317dae54ce4e6 Mon Sep 17 00:00:00 2001 From: "helma@in-silico.ch" Date: Mon, 12 Nov 2018 17:08:51 +0100 Subject: PubChem classification download --- test/download.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 test/download.rb (limited to 'test/download.rb') diff --git a/test/download.rb b/test/download.rb new file mode 100644 index 0000000..9fd0f40 --- /dev/null +++ b/test/download.rb @@ -0,0 +1,22 @@ +require_relative "setup.rb" + +class DownloadTest < MiniTest::Test + + def test_pubchem_classification + Download.pubchem_classification aid: 1191, active: "carcinogen", inactive: "non-carcinogen", species: "Hamster", endpoint: "Carcinogen" + csv = File.join(File.dirname(__FILE__),"..","data","Carcinogen-Hamster.csv") + meta_file = File.join(File.dirname(__FILE__),"..","data","Carcinogen-Hamster.json") + assert File.exists?(csv) + table = CSV.read csv + assert_equal 87, table.size + assert_equal ["48413129", "CC=O", "carcinogen"], table[1] + meta = JSON.parse(File.read(meta_file)) + assert_equal "Hamster", meta["species"] + assert_equal 1, meta["warnings"].size + FileUtils.rm(csv) + FileUtils.rm(meta_file) + end + +end + + -- cgit v1.2.3 From 0882c2cd0de934d7377fc9d08c306be98612c88a Mon Sep 17 00:00:00 2001 From: "helma@in-silico.ch" Date: Fri, 16 Nov 2018 18:42:42 +0100 Subject: real datasets for testing, test data cleanup, Daphnia import, upper and lower similarity thresholds --- test/download.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/download.rb') diff --git a/test/download.rb b/test/download.rb index 9fd0f40..aeb99b9 100644 --- a/test/download.rb +++ b/test/download.rb @@ -17,6 +17,14 @@ class DownloadTest < MiniTest::Test FileUtils.rm(meta_file) end + def test_import_daphnia + Download.daphnia + table = CSV.read File.join(Download::DATA,"Acute_toxicity-Daphnia_magna.csv") + assert_equal "BrC(Br)Br", table[1][1] + assert_equal 0.74, table[1][2].to_f.round(2) + assert_equal "-log[LC50_mmol/L]", table[0][2] + end + end -- cgit v1.2.3