6 use File::Spec::Functions qw / catfile catdir/;
8 use SGN::Test::WWW::WebDriver;
9 use SGN::Test::Fixture;
10 use SGN::Test::solGSData;
13 my $d = SGN::Test::WWW::WebDriver->new();
14 my $f = SGN::Test::Fixture->new();
15 my $solgs_data = SGN::Test::solGSData->new(
18 'accessions_list_subset' => 60,
19 'plots_list_subset' => 60
23 my $cache_dir = $solgs_data->site_cluster_shared_dir();
24 my $protocol_dir = $solgs_data->default_protocol_dir();
25 my $pca_dir = catdir( $protocol_dir, 'pca' );
26 my $log_dir = catdir( $protocol_dir, 'log' );
28 # my $cache_dir = $solgs_data->site_cluster_shared_dir();
29 print STDERR "\nsite_cluster_shared_dir-- $cache_dir\n";
31 my $accessions_list = $solgs_data->load_accessions_list();
33 # my $accessions_list = $solgs_data->get_list_details('accessions');
34 my $accessions_list_name = $accessions_list->{list_name};
35 my $accessions_list_id = 'list_' . $accessions_list->{list_id};
36 print STDERR "\naccessions list: $accessions_list_name -- $accessions_list_id\n";
37 my $plots_list = $solgs_data->load_plots_list();
39 # my $plots_list = $solgs_data->get_list_details('plots');
40 my $plots_list_name = $plots_list->{list_name};
41 my $plots_list_id = 'list_' . $plots_list->{list_id};
43 print STDERR "\nadding trials list\n";
44 my $trials_list = $solgs_data->load_trials_list();
46 # my $trials_list = $solgs_data->get_list_details('trials');
47 my $trials_list_name = $trials_list->{list_name};
48 my $trials_list_id = 'list_' . $trials_list->{list_id};
49 print STDERR "\nadding trials dataset\n";
51 # my $trials_dt = $solgs_data->get_dataset_details('trials');
52 my $trials_dt = $solgs_data->load_trials_dataset();
53 my $trials_dt_name = $trials_dt->{dataset_name};
54 my $trials_dt_id = 'dataset_' . $trials_dt->{dataset_id};
55 print STDERR "\nadding accessions dataset\n";
57 # my $accessions_dt = $solgs_data->get_dataset_details('accessions');
58 my $accessions_dt = $solgs_data->load_accessions_dataset();
59 my $accessions_dt_name = $accessions_dt->{dataset_name};
60 my $accessions_dt_id = 'dataset_' . $accessions_dt->{dataset_id};
62 print STDERR "\nadding plots dataset\n";
64 # my $plots_dt = $solgs_data->get_dataset_details('plots');
65 my $plots_dt = $solgs_data->load_plots_dataset();
66 my $plots_dt_name = $plots_dt->{dataset_name};
67 my $plots_dt_id = 'dataset_' . $plots_dt->{dataset_id};
69 #$accessions_dt_name = '' . $accessions_dt_name . '';
70 print STDERR "\ntrials dt: $trials_dt_name -- $trials_dt_id\n";
71 print STDERR "\naccessions dt: $accessions_dt_name -- $accessions_dt_id\n";
72 print STDERR "\nplots dt: $plots_dt_name -- $plots_dt_id\n";
74 print STDERR "\ntrials list: $trials_list_name -- $trials_list_id\n";
75 print STDERR "\naccessions list: $accessions_list_name -- $accessions_list_id\n";
76 print STDERR "\nplots list: $plots_list_name -- $plots_list_id\n";
80 $d->while_logged_in_as("submitter", sub {
82 $d->get_ok('/pca/analysis', 'pca home page');
84 $d->find_element_ok('//tr[@id="' . $accessions_list_id .'"]//*[starts-with(@id,"pca_data_type_select")]/option[text()="Genotype"]', 'xpath', 'select genotype')->click();
86 $d->find_element_ok('//tr[@id="' . $accessions_list_id .'"]//*[starts-with(@id, "run_pca")]', 'xpath', 'run pca')->click();
88 $d->find_element_ok('queue_job', 'id', 'queue pca job')->click();
90 $d->find_element_ok('analysis_name', 'id', 'clones list job name')->send_keys('geno pca job');
92 $d->find_element_ok('user_email', 'id', 'user email')->send_keys('email@email.com');
94 $d->find_element_ok('submit_job', 'id', 'submit')->click();
96 $d->find_element_ok('Go back', 'partial_link_text', 'go back to pca pg')->click();
99 $d->find_element_ok('//tr[@id="' . $accessions_list_id .'"]//*[starts-with(@id,"pca_data_type_select")]/option[text()="Genotype"]', 'xpath', 'select genotype')->click();
101 $d->find_element_ok('//tr[@id="' . $accessions_list_id .'"]//*[starts-with(@id, "run_pca")]', 'xpath', 'run pca accessions list (genotype)')->click();
103 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check accessions list geno pca plot')->click();
107 $d->driver->refresh();
110 $d->find_element_ok('//tr[@id="' . $accessions_list_id .'"]//*[starts-with(@id,"pca_data_type_select")]/option[text()="Genotype"]', 'xpath', 'select genotype')->click();
112 $d->find_element_ok('//tr[@id="' . $accessions_list_id .'"]//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
114 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
116 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check accessions list geno pca plot')->click();
119 $d->driver->refresh();
122 $d->find_element_ok('//tr[@id="' . $plots_list_id .'"]//*[starts-with(@id,"pca_data_type_select")]/option[text()="Phenotype"]', 'xpath', 'select phenotype')->click();
124 $d->find_element_ok('//tr[@id="' . $plots_list_id .'"]//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
126 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
128 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check trials list pheno pca plot')->click();
131 $d->driver->refresh();
134 $d->find_element_ok('//tr[@id="' . $trials_list_id .'"]//*[starts-with(@id,"pca_data_type_select")]/option[text()="Genotype"]', 'xpath', 'select genotype')->click();
136 $d->find_element_ok('//tr[@id="' . $trials_list_id .'"]//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
138 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
140 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check trials list geno pca plot')->click();
144 $d->driver->refresh();
147 $d->find_element_ok('//tr[@id="' . $trials_list_id .'"]//*[starts-with(@id,"pca_data_type_select")]/option[text()="Phenotype"]', 'xpath', 'select genotype')->click();
149 $d->find_element_ok('//tr[@id="' . $trials_list_id .'"]//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
151 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
153 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check trials list pheno pca plot')->click();
158 $d->driver->refresh();
161 $d->find_element_ok('//tr[@id="' . $accessions_dt_id .'"]//*[starts-with(@id,"pca_data_type_select")]/option[text()="Genotype"]', 'xpath', 'select genotype')->click();
163 $d->find_element_ok('//tr[@id="' . $accessions_dt_id .'"]//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
165 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
167 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check accessions dataset geno pca plot')->click();
170 $d->driver->refresh();
173 $d->find_element_ok('//tr[@id="' . $plots_dt_id .'"]//*[starts-with(@id,"pca_data_type_select")]/option[text()="Phenotype"]', 'xpath', 'select phenotype')->click();
175 $d->find_element_ok('//tr[@id="' . $plots_dt_id .'"]//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
177 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
179 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check plots dataset pheno pca plot')->click();
182 $d->driver->refresh();
185 $d->find_element_ok('//tr[@id="' . $trials_dt_id .'"]//*[starts-with(@id,"pca_data_type_select")]/option[text()="Genotype"]', 'xpath', 'select genotype')->click();
187 $d->find_element_ok('//tr[@id="' . $trials_dt_id .'"]//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
189 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
191 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check trials dataset geno pca plot')->click();
194 $d->driver->refresh();
197 $d->find_element_ok('//tr[@id="' . $trials_dt_id .'"]//*[starts-with(@id,"pca_data_type_select")]/option[text()="Phenotype"]', 'xpath', 'select phenotype')->click();
199 $d->find_element_ok('//tr[@id="' . $trials_dt_id .'"]//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
201 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
203 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check trials dataset pheno pca plot')->click();
208 $d->get_ok('/breeders/trial/139', 'trial detail home page');
211 my $analysis_tools = $d->find_element('Analysis Tools', 'partial_link_text', 'toogle analysis tools');
212 my $elem = $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-70);", $analysis_tools);
214 $d->find_element_ok('Analysis Tools', 'partial_link_text', 'toogle analysis')->click();
216 $d->find_element_ok('ANOVA', 'partial_link_text', 'collapse anova')->click();
218 $d->find_element_ok('PCA', 'partial_link_text', 'expand PCA')->click();
220 $d->find_element_ok('//*[starts-with(@id,"pca_data_type_select")]/option[text()="Phenotype"]', 'xpath', 'select phenotype')->click();
222 $d->find_element_ok('//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
224 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
226 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check trial page pheno pca plot')->click();
229 $d->driver->refresh();
232 my $analysis_tools = $d->find_element('Analysis Tools', 'partial_link_text', 'toogle analysis tools');
233 my $elem = $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-70);", $analysis_tools);
235 $d->find_element_ok('Analysis Tools', 'partial_link_text', 'toogle analysis tools')->click();
237 $d->find_element_ok('ANOVA', 'partial_link_text', 'collapse anova')->click();
239 $d->find_element_ok('PCA', 'partial_link_text', 'expand PCA')->click();
241 $d->find_element_ok('//*[starts-with(@id,"pca_data_type_select")]/option[text()="Genotype"]', 'xpath', 'select genotype')->click();
243 $d->find_element_ok('//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
245 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
247 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check trials page geno pca plot')->click();
252 $d->get_ok('/solgs', 'solgs homepage');
255 $d->find_element_ok('trial_search_box', 'id', 'population search form')->send_keys('Kasese solgs trial');
257 $d->find_element_ok('search_trial', 'id', 'search for training pop')->click();
259 $d->find_element_ok('Kasese', 'partial_link_text', 'create training pop')->click();
261 $d->find_element_ok('queue_job', 'id', 'submit job tr pop')->click();
263 $d->find_element_ok('analysis_name', 'id', 'Test Kasese Tr pop')->send_keys('Test Kasese Tr pop');
265 $d->find_element_ok('user_email', 'id', 'user email')->send_keys('email@email.com');
267 $d->find_element_ok('submit_job', 'id', 'submit')->click();
269 $d->find_element_ok('Go back', 'partial_link_text', 'go back to solgs homepage')->click();
272 $d->find_element_ok('trial_search_box', 'id', 'population search form')->send_keys('Kasese solgs trial');
274 $d->find_element_ok('search_trial', 'id', 'search for training pop')->click();
276 $d->find_element_ok('Kasese', 'partial_link_text', 'create training pop')->click();
279 $d->find_element_ok('dry matter', 'partial_link_text', 'build model')->click();
281 $d->find_element_ok('queue_job', 'id', 'modeling job queueing')->click();
283 $d->find_element_ok('analysis_name', 'id', 'modeling analysis name')->send_keys('Test DMCP model Kasese');
285 $d->find_element_ok('user_email', 'id', 'user email')->send_keys('email@email.com');
287 $d->find_element_ok('submit_job', 'id', 'submit')->click();
289 $d->find_element_ok('Go back', 'partial_link_text', 'go back to training pop page')->click();
292 $d->find_element_ok('dry matter', 'partial_link_text', 'build model -- go to model page')->click();
294 my $pca = $d->find_element('PCA', 'partial_link_text', 'scroll up');
295 $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-100);", $pca);
297 $d->find_element_ok('//*[starts-with(@id,"pca_data_type_select")]/option[text()="Genotype"]', 'xpath', 'select genotype')->click();
299 $d->find_element_ok('//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
301 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
303 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check geno pca plot in model page')->click();
306 $d->driver->refresh();
309 my $pca = $d->find_element('PCA', 'partial_link_text', 'scroll up');
310 $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-100);", $pca);
312 $d->find_element_ok('//*[starts-with(@id,"pca_data_type_select")]/option[text()="Phenotype"]', 'xpath', 'select genotype')->click();
314 $d->find_element_ok('//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
316 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
318 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check pheno pca plot in model page')->click();
321 $d->driver->refresh();
324 my $sel_pred = $d->find_element('Predict', 'partial_link_text', 'scroll to selection pred');
325 my $elem = $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-70);", $sel_pred);
327 $d->find_element_ok('trial_search_box', 'id', 'population search form')->send_keys('trial2 NaCRRI');
329 $d->find_element_ok('search_selection_pop', 'id', 'search for selection pop')->click();
331 $d->find_element_ok('//table[@id="selection_pops_table"]//*[contains(text(), "Predict")]', 'xpath', 'click training pop')->click();
333 $d->find_element_ok('queue_job', 'id', 'job queueing')->click();
335 $d->find_element_ok('analysis_name', 'id', ' sel pred analysis name')->send_keys('Test DMCP selection pred Kasese');
337 $d->find_element_ok('user_email', 'id', 'user email')->send_keys('email@email.com');
339 $d->find_element_ok('submit_job', 'id', 'submit')->click();
341 $d->find_element_ok('Go back', 'partial_link_text', 'go back to model page')->click();
344 my $sel_pred = $d->find_element('Predict', 'partial_link_text', 'scroll to selection pred');
345 my $elem = $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-70);", $sel_pred);
347 $d->find_element_ok('DMCP', 'partial_link_text', 'go to selection pop prediction page')->click();
350 # $d->get_ok('/solgs/selection/141/model/139/trait/70666/gp/1', 'selection prediction page');
353 my $pca = $d->find_element('PCA', 'partial_link_text', 'scroll up');
354 $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-100);", $pca);
356 $d->find_element_ok('//*[starts-with(@id,"pca_data_type_select")]/option[text()="Genotype"]', 'xpath', 'select genotype')->click();
358 $d->find_element_ok('//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
360 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
362 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check geno pca plot in selection pop page')->click();
367 $d->get_ok('/solgs', 'solgs homepage');
370 $d->find_element_ok('trial_search_box', 'id', 'population search form')->send_keys('Kasese solgs trial');
372 $d->find_element_ok('search_trial', 'id', 'search for training pop')->click();
374 $d->find_element_ok('trial_search_box', 'id', 'population search form')->clear();
376 $d->find_element_ok('trial_search_box', 'id', 'population search form')->send_keys('nacrri');
378 $d->find_element_ok('search_trial', 'id', 'search for training pop')->click();
381 $d->find_element_ok('//table[@id="searched_trials_table"]//input[@value="139"]', 'xpath', 'select trial kasese')->click();
383 $d->find_element_ok('//table[@id="searched_trials_table"]//input[@value="141"]', 'xpath', 'select trial nacrri')->click();
385 $d->find_element_ok('select_trials_btn', 'id', 'done selecting')->click();
387 $d->find_element_ok('combine_trait_trials', 'id', 'combine trials')->click();
389 $d->find_element_ok('queue_job', 'id', 'submit combine trials job ')->click();
391 $d->find_element_ok('analysis_name', 'id', 'combo trials tr pop')->send_keys('combo trials tr pop');
393 $d->find_element_ok('user_email', 'id', 'user email')->send_keys('email@email.com');
395 $d->find_element_ok('submit_job', 'id', 'submit')->click();
397 $d->find_element_ok('Go back', 'partial_link_text', 'go back to solgs homepage')->click();
401 $d->find_element_ok('trial_search_box', 'id', 'population search form')->send_keys('Kasese solgs trial');
403 $d->find_element_ok('search_trial', 'id', 'search for training pop')->click();
405 $d->find_element_ok('trial_search_box', 'id', 'population search form')->clear();
407 $d->find_element_ok('trial_search_box', 'id', 'population search form')->send_keys('nacrri');
409 $d->find_element_ok('search_trial', 'id', 'search for training pop')->click();
412 $d->find_element_ok('//table[@id="searched_trials_table"]//input[@value="139"]', 'xpath', 'select trial kasese')->click();
414 $d->find_element_ok('//table[@id="searched_trials_table"]//input[@value="141"]', 'xpath', 'select trial nacrri')->click();
416 $d->find_element_ok('select_trials_btn', 'id', 'done selecting')->click();
418 $d->find_element_ok('combine_trait_trials', 'id', 'combine trials -- go to combined trials training pop page')->click();
421 $d->find_element_ok('dry matter', 'partial_link_text', 'build model')->click();
423 $d->find_element_ok('queue_job', 'id', 'no job queueing')->click();
425 $d->find_element_ok('analysis_name', 'id', 'Test DMCP model combo')->send_keys('Test DMCP model combo');
427 $d->find_element_ok('user_email', 'id', 'user email')->send_keys('email@email.com');
429 $d->find_element_ok('submit_job', 'id', 'submit')->click();
431 $d->find_element_ok('Go back', 'partial_link_text', 'go back to training pop page')->click();
435 $d->find_element_ok('dry matter', 'partial_link_text', 'build model')->click();
437 my $pca = $d->find_element('PCA', 'partial_link_text', 'scroll up');
438 $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-100);", $pca);
440 $d->find_element_ok('//*[starts-with(@id,"pca_data_type_select")]/option[text()="Genotype"]', 'xpath', 'select genotype')->click();
442 $d->find_element_ok('//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
444 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
446 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check geno pca plot in model page')->click();
449 $d->driver->refresh();
452 my $pca = $d->find_element('PCA', 'partial_link_text', 'scroll up');
453 $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-100);", $pca);
455 $d->find_element_ok('//*[starts-with(@id,"pca_data_type_select")]/option[text()="Phenotype"]', 'xpath', 'select phenotype')->click();
457 $d->find_element_ok('//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
459 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
461 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check pheno pca plot in model page')->click();
464 $d->driver->refresh();
467 my $sel_pred = $d->find_element('Predict', 'partial_link_text', 'scroll to selection pred');
468 my $elem = $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-70);", $sel_pred);
470 $d->find_element_ok('trial_search_box', 'id', 'population search form')->send_keys('trial2 NaCRRI');
472 $d->find_element_ok('search_selection_pop', 'id', 'search for selection pop')->click();
474 $d->find_element_ok('//table[@id="selection_pops_table"]//*[contains(text(), "Predict")]', 'xpath', 'click sel pop')->click();
476 $d->find_element_ok('queue_job', 'id', 'job queueing')->click();
478 $d->find_element_ok('analysis_name', 'id', 'selection pop prediction analysis name')->send_keys('Test DMCP selection pred nacrri');
480 $d->find_element_ok('user_email', 'id', 'user email')->send_keys('email@email.com');
482 $d->find_element_ok('submit_job', 'id', 'submit')->click();
484 $d->find_element_ok('Go back', 'partial_link_text', 'go back to model page')->click();
487 my $sel_pred = $d->find_element('Predict', 'partial_link_text', 'scroll to selection pred');
488 my $elem = $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-70);", $sel_pred);
490 $d->find_element_ok('DMCP', 'partial_link_text', 'go to selection pop prediction page')->click();
493 # $d->get_ok('/solgs/selection/141/model/139/trait/70666/gp/1', 'selection prediction page');
496 my $pca = $d->find_element('PCA', 'partial_link_text', 'scroll up');
497 $d->driver->execute_script( "arguments[0].scrollIntoView(true);window.scrollBy(0,-100);", $pca);
499 $d->find_element_ok('//*[starts-with(@id,"pca_data_type_select")]/option[text()="Genotype"]', 'xpath', 'select genotype')->click();
501 $d->find_element_ok('//*[starts-with(@id, "run_pca")]', 'xpath', 'run_pca')->click();
503 $d->find_element_ok('no_queue', 'id', 'no job queueing')->click();
505 $d->find_element_ok('//*[contains(text(), "PC2")]', 'xpath', 'check geno pca plot in selection pop page')->click();
509 foreach my $list_id ( $trials_list_id, $accessions_list_id, $plots_list_id ) {
510 $list_id =~ s/\w+_//g;
511 $solgs_data->delete_list($list_id);
514 foreach my $dataset_id ( $trials_dt_id, $accessions_dt_id, $plots_dt_id ) {
515 $dataset_id =~ s/\w+_//g;
516 $solgs_data->delete_dataset($dataset_id);