3 solgs.t - integration tests for solgs
15 use SGN::Test::WWW::Mechanize;
18 BEGIN { use_ok( 'SGN::Test::WWW::Mechanize' ) or
19 BAIL_OUT('Could not load SGN::Test::WWW::Mechanize');
22 BEGIN { use_ok( 'Test::More' ) or
23 BAIL_OUT('Could not load Test::More');
26 BEGIN { use_ok( 'SGN::Controller::solGS::solGS' ) or
27 BAIL_OUT( 'Could not load SGN::Controller::solGS::solGS');
29 BEGIN { use_ok( 'SGN::Model::solGS::solGS' ) or
30 BAIL_OUT( 'Could not load SGN::Model::solGS::solGS');
34 my $mech = SGN::Test::WWW::Mechanize->new;
36 $mech->get_ok('/solgs/search', 'search page');
37 $mech->content_contains('Search for a trait', 'search trait section');
38 $mech->content_contains('Browse by traits', 'traits index');
40 my @traits_indices = $mech->find_all_links( url_regex => qr/solgs\/traits/ );
41 $mech->links_ok( \@traits_indices, 'trait indices links work' );
42 $mech->get_ok($traits_indices[0], 'a page for a list of traits starting with a certain letter');
43 $mech->content_contains('Traits beginning with', 'traits list section');
45 my @traits_list= $mech->find_all_links( url_regex => qr/solgs\/search\/result\/traits/i );
46 $mech->links_ok( \@traits_list, 'links to traits starting with a certain letter work.' );
47 $mech->get_ok($traits_list[0], 'a link to a traits search page works');
48 $mech->content_contains('Traits with genomic selection data', 'Traits with genomic selection data');
50 my @traits_pop= $mech->find_all_links( url_regex => qr/solgs\/search\/result\/populations/i );
51 $mech->links_ok( \@traits_pop, 'links to search page for populations evaluated for a trait work.' );
52 $mech->get_ok($traits_pop[0], 'a link to populations evaluated for a trait search page works');
53 $mech->get_ok($traits_pop[0], $traits_pop[0]->url);
54 $mech->content_contains('select a training population to calculate GEBV', 'list of training populations for a trait section');
55 # diag('Please wait..this may take a few minutes..');
56 # my @training_pops = $mech->find_all_links(url_regex=> qr/trait\/70682\/population/);
59 # foreach my $tr_pop (@training_pops) {
60 # my $url = $tr_pop->url;
61 # $mech->links_ok( $url, $url ) or
62 # diag("if similar urls are passing the test, page $url might be
63 # failing because of the type of its dataset.");
66 $mech->get_ok('/solgs/trait/70682/population/128', 'a training population page');
67 $mech->content_contains($_)
70 'Trait phenotype data',
71 'Predicted genomc estimated breeding values',
74 '10 folds cross-validation report',
77 diag('GEBV data download');
78 my $gebv_download_link = $mech->find_link( text_regex => qr/download all gebvs/i );
79 ok( $gebv_download_link, 'got a GEBV data download link' );
80 my $url = defined $gebv_download_link ? $gebv_download_link->url : '';
81 $url ? $mech->links_ok( $url, 'GEBV data download link works' )
82 : ok(0, 'no GEBV download url found');
84 my $size = length( $mech->content );
85 cmp_ok( $size, '>=', 1000,"got at least 1KB (file size: $size, $url) of data from the GEBV data download url" );
88 diag('Marker Effects data download');
89 $mech->get_ok('/solgs/trait/70682/population/128', 'a training population page');
90 my $marker_download_link = $mech->find_link( text_regex => qr/download all marker effects/i );
91 ok( $marker_download_link, 'got a marker effects data download link' );
92 $url = defined $marker_download_link ? $marker_download_link->url : '';
93 $url ? $mech->links_ok( $url, 'Marker effects data download link works' )
94 : ok(0, 'no marker effects download url found');
96 $size = length( $mech->content );
97 cmp_ok( length( $mech->content ), '>=', 1000,"got at least 1KB (file size: $size, $url) of data from the marker effects data download url" );
100 diag('Model accuracy data download');
101 $mech->get_ok('/solgs/trait/70682/population/128', 'a training population page');
102 my $accuracy_download_link = $mech->find_link( text_regex => qr/download model accuracy/i );
103 ok( $accuracy_download_link, 'got a model accuracy data download link' );
104 $url = defined $accuracy_download_link ? $accuracy_download_link->url : '';
105 $url ? $mech->links_ok( $url, 'Model accuracy data download link works' )
106 : ok(0, 'no model accuracy download url found');
108 $size = length( $mech->content);
109 cmp_ok( $size, '>=', 100,"got at least 0.1KB (file size: $size, $url) of data from the model accuracy data download url" );
112 $mech->get_ok('/solgs/population/128', 'Got a population page');
113 $mech->content_contains($_)
115 'Population summary',
120 diag("Please wait... this may a few minutes..");
121 my @traits= $mech->find_all_links( url_regex => qr/solgs\/trait/ );
122 my $no_traits = scalar(@traits);
123 cmp_ok($no_traits, '>=', 1, "this population has $no_traits traits for GS analysis");
125 diag("Please wait... this may take a few minutes..");
126 $url = $traits[0]->url;
127 $mech->get_ok($traits[0], "run GS for a trait ($url) of a training population");
128 $mech->content_contains($_)
130 'Population summary',
131 'Trait phenotype data',
132 'Predicted genomc estimated breeding values',
135 '10 folds cross-validation report',
136 'prediction population',
139 diag("Please wait... combining populations...this may a few minutes..");
140 $mech->get_ok('/solgs/combine/populations/trait/confirm/70762', 'confirmation page for populations to be combined');
141 $mech->get_ok('/solgs/model/combined/populations/2789927696/trait/70762', 'GEBV output for combined training populations');
142 $mech->content_contains($_)
144 'Population summary',
145 'Trait phenotype data',
146 'Predicted genomc estimated breeding values',
149 '10 folds cross-validation report',