aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json142
-rw-r--r--test/lib/gntest.rb5
-rw-r--r--test/lib/mapping.rb70
3 files changed, 185 insertions, 32 deletions
diff --git a/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json b/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json
new file mode 100644
index 00000000..15428553
--- /dev/null
+++ b/test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json
@@ -0,0 +1,142 @@
+{
+ "temp_uuid" : "unknown",
+"maf" : "0.01",
+"control_marker" : "mCV24506226",
+"dataset" : "HC_M2_0606_P",
+ "do_control" : "false",
+ "maf" : "0.01",
+ "manhattan_plot" : "False",
+ "mapmethod_rqtl_geno" : "em",
+ "mapmodel_rqtl_geno" : "normal",
+ "method" : "rqtl_geno",
+ "num_bootstrap" : "2000",
+ "num_perm" : "",
+ "pair_scan" : "false",
+ "suggestive" : "0",
+ "trait_id" : "1433387_at",
+ "value:129S1/SvImJ" : "6.920",
+ "value:A/J" : "7.437",
+ "value:AKR/J" : "7.550",
+ "value:B6D2F1" : "7.742",
+ "value:BALB/cByJ" : "6.613",
+ "value:BALB/cJ" : "6.664",
+ "value:BXD1" : "6.749",
+ "value:BXD100" : "x",
+ "value:BXD101" : "x",
+ "value:BXD102" : "x",
+ "value:BXD103" : "x",
+ "value:BXD11" : "7.398",
+ "value:BXD12" : "7.073",
+ "value:BXD13" : "8.191",
+ "value:BXD14" : "x",
+ "value:BXD15" : "7.406",
+ "value:BXD16" : "6.890",
+ "value:BXD18" : "x",
+ "value:BXD19" : "6.980",
+ "value:BXD2" : "7.248",
+ "value:BXD20" : "7.554",
+ "value:BXD21" : "7.316",
+ "value:BXD22" : "7.327",
+ "value:BXD23" : "7.605",
+ "value:BXD24" : "7.306",
+ "value:BXD24a" : "x",
+ "value:BXD25" : "x",
+ "value:BXD27" : "7.800",
+ "value:BXD28" : "7.023",
+ "value:BXD29" : "7.518",
+ "value:BXD30" : "x",
+ "value:BXD31" : "7.301",
+ "value:BXD32" : "7.161",
+ "value:BXD33" : "7.140",
+ "value:BXD34" : "8.180",
+ "value:BXD35" : "x",
+ "value:BXD36" : "x",
+ "value:BXD37" : "x",
+ "value:BXD38" : "7.350",
+ "value:BXD39" : "6.976",
+ "value:BXD40" : "7.411",
+ "value:BXD41" : "x",
+ "value:BXD42" : "7.050",
+ "value:BXD43" : "6.866",
+ "value:BXD44" : "7.246",
+ "value:BXD45" : "7.576",
+ "value:BXD48" : "7.108",
+ "value:BXD48a" : "7.192",
+ "value:BXD49" : "x",
+ "value:BXD5" : "6.771",
+ "value:BXD50" : "7.528",
+ "value:BXD51" : "7.408",
+ "value:BXD52" : "x",
+ "value:BXD53" : "x",
+ "value:BXD54" : "x",
+ "value:BXD55" : "6.720",
+ "value:BXD56" : "x",
+ "value:BXD59" : "x",
+ "value:BXD6" : "7.372",
+ "value:BXD60" : "7.178",
+ "value:BXD61" : "7.198",
+ "value:BXD62" : "7.618",
+ "value:BXD63" : "7.076",
+ "value:BXD64" : "6.576",
+ "value:BXD65" : "7.046",
+ "value:BXD65a" : "7.046",
+ "value:BXD65b" : "7.385",
+ "value:BXD66" : "7.108",
+ "value:BXD67" : "7.342",
+ "value:BXD68" : "7.668",
+ "value:BXD69" : "7.310",
+ "value:BXD70" : "7.278",
+ "value:BXD71" : "x",
+ "value:BXD72" : "x",
+ "value:BXD73" : "7.342",
+ "value:BXD73a" : "7.841",
+ "value:BXD74" : "7.298",
+ "value:BXD75" : "7.133",
+ "value:BXD76" : "7.448",
+ "value:BXD77" : "7.014",
+ "value:BXD78" : "x",
+ "value:BXD79" : "7.916",
+ "value:BXD8" : "7.148",
+ "value:BXD81" : "x",
+ "value:BXD83" : "7.322",
+ "value:BXD84" : "7.298",
+ "value:BXD85" : "7.243",
+ "value:BXD86" : "7.719",
+ "value:BXD87" : "7.145",
+ "value:BXD88" : "x",
+ "value:BXD89" : "7.162",
+ "value:BXD9" : "6.708",
+ "value:BXD90" : "7.497",
+ "value:BXD91" : "x",
+ "value:BXD93" : "7.558",
+ "value:BXD94" : "6.817",
+ "value:BXD95" : "x",
+ "value:BXD98" : "7.753",
+ "value:BXD99" : "8.076",
+ "value:C3H/HeJ" : "7.536",
+ "value:C57BL/6ByJ" : "6.940",
+ "value:C57BL/6J" : "7.309",
+ "value:CAST/EiJ" : "8.796",
+ "value:CXB1" : "6.430",
+ "value:CXB10" : "6.958",
+ "value:CXB11" : "6.182",
+ "value:CXB12" : "6.432",
+ "value:CXB13" : "6.388",
+ "value:CXB2" : "7.687",
+ "value:CXB3" : "6.312",
+ "value:CXB4" : "6.453",
+ "value:CXB5" : "6.959",
+ "value:CXB6" : "7.022",
+ "value:CXB7" : "6.334",
+ "value:CXB8" : "6.790",
+ "value:CXB9" : "6.545",
+ "value:D2B6F1" : "7.615",
+ "value:DBA/2J" : "7.816",
+ "value:KK/HlJ" : "8.035",
+ "value:LG/J" : "7.594",
+ "value:NOD/ShiLtJ" : "8.220",
+ "value:NZO/HlLtJ" : "7.629",
+ "value:PWD/PhJ" : "6.320",
+ "value:PWK/PhJ" : "7.235",
+ "value:WSB/EiJ" : "7.650"
+}
diff --git a/test/lib/gntest.rb b/test/lib/gntest.rb
new file mode 100644
index 00000000..865ef51d
--- /dev/null
+++ b/test/lib/gntest.rb
@@ -0,0 +1,5 @@
+require 'minitest/autorun'
+require 'mechanize'
+
+# ---- Use some default parameters if not set
+$host = "http://localhost:5003" if !$host
diff --git a/test/lib/mapping.rb b/test/lib/mapping.rb
index 08b6b5da..4c8ff632 100644
--- a/test/lib/mapping.rb
+++ b/test/lib/mapping.rb
@@ -1,5 +1,6 @@
# In these tests we navigate from the main page to a specific trait then hit the different mapping tool buttons (In this case pylMM and r/qtl) followed by computing the results (marker regressions).
+require 'gntest'
class MappingTest
end
@@ -11,41 +12,46 @@ describe MappingTest do
end
describe MappingTest do
- it "pyLMM mapping tool selection" do
- url = $host+'/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P'
- page = @agent.get(url)
- # get the form
- # form = @agent.page.form_with(:name => "my-form")
- # get the button you want from the form
- # page.forms.each do |form|
- # p form
- # end
- # button = page.button_with(:value => "pylmm_compute")
- # submit the form using that button
- # agent.submit(form, button)
- # link = page.link_with(text: 'pyLMM')
- # page = link.click
- # puts page.uri
- # link = page.link_with(text: 'Compute')
- # page = link.click
- # puts page.uri
- # probe_link.uri.to_s.must_equal "/marker_regression"
+ it "pylmm mapping tool selection" do
+ url = $host+'/marker_regression'
+
+ json = JSON::load(File.read('test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json'))
+ json["method"] = "pylmm"
+ # p json
+ page = @agent.post(URI.encode(url), json)
+ # Unpacking the page is slow - but the run is enough as a test
+ # form = page.forms_with("marker_regression")[0]
+ # form.fields.select { |fld| fld.name == 'dataset' }.first.value.must_equal 'HC_M2_0606_P'
+ # form.fields.select { |fld| fld.name == 'value:BXD1' }.first.value.must_equal '6.749'
end
end
-end
-
-describe MappingTest do
+ describe MappingTest do
it "R/qtl mapping tool selection" do
- break if $options[:skip_broken]
- page = @agent.get($host+'/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P')
- link = page.link_with(text: 'R/qtl')
- page = link.click
- puts page.uri
- form.field_with(:name => 'Methods').options[2].select
- link = page.link_with(text: 'Compute')
- page = link.click
- puts page.uri
- probe_link.uri.to_s.must_equal "/marker_regression"
+ url = $host+'/marker_regression' # ?trait_id=1435395_s_at&dataset=HC_M2_0606_P'
+
+ json = JSON::load(File.read('test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json'))
+ # p json
+ page = @agent.post(URI.encode(url),
+ json,
+ ({'Content-Type' => 'application/x-www-form-urlencoded'}))
+ form = page.forms_with("marker_regression")[0]
+ form.fields.select { |fld| fld.name == 'dataset' }.first.value.must_equal 'HC_M2_0606_P'
+ form.fields.select { |fld| fld.name == 'value:BXD1' }.first.value.must_equal '6.749'
end
+ end
+
+ describe MappingTest do
+ it "CIM mapping tool selection (using reaper)" do
+ url = $host+'/marker_regression'
+
+ json = JSON::load(File.read('test/data/input/mapping/1435395_s_at_HC_M2_0606_P.json'))
+ json["method"] = "reaper"
+ page = @agent.post(URI.encode(url), json)
+ form = page.forms_with("marker_regression")[0]
+ form.fields.select { |fld| fld.name == 'dataset' }.first.value.must_equal 'HC_M2_0606_P'
+ form.fields.select { |fld| fld.name == 'value:BXD1' }.first.value.must_equal '6.749'
+ end
+ end
+
end