4 solqtl.t - Tests for /phenome/qtl_analysis.pl & /phenome/qtl.pl
6 This page takes a few minutes to run R computations.
10 Tests for /phenome/qtl_analysis.pl & /phenome/qtl.pl
18 use SGN::Test::WWW::Mechanize;
19 use SGN::Test qw/qsub_is_configured/;
22 local $TODO = "qsub not configured properly" if !qsub_is_configured();
23 my $mech = SGN::Test::WWW::Mechanize->new;
26 ##############################
27 #/phenome/qtl_analysis.pl page
28 ##############################
29 print STDERR "\n\n.....starting to test /phenome/qtl_analysis.pl.....\n\n";
32 '/phenome/qtl_analysis.pl?population_id=12&cvterm_id=39945',
33 ' got a qtl_analysis.pl page. (In case of failure, try to run it again. Takes 2 - 4 min to run R computations)' );
35 $mech->content_contains($_)
39 'Phenotype frequency distribution',
46 my @qtl_images = $mech->find_all_images(alt_regex => qr/chromosome/i );
47 cmp_ok( scalar(@qtl_images), '>=', 12, 'got 12 or more qtl map images' );
49 $mech->content_contains( 'lines', 'frequency distribution plot generated');
50 $mech->content_contains( 'Trait data', 'Phenotype data table generated');
51 $mech->content_contains( 'Abstract', 'abstract content');
52 $mech->content_contains( 'QTL genotype probability method', 'Legend for QTL map: key');
53 $mech->content_contains( 'Based on 95%', 'Legend for QTL map: value');
54 $mech->content_contains( 'Abstract', 'abstract content for qtl pub');
55 $mech->content_contains( 'Standard deviation', 'descriptive statistics for trait phenotype data');
58 my $phenotype_download_link =
59 $mech->find_link( text_regex => qr/phenotype data/i );
60 ok( $phenotype_download_link, 'got a phenotype data download link' );
62 my $url = defined $phenotype_download_link ? $phenotype_download_link->url : '';
64 $url ? $mech->links_ok( $url, 'phenotype data download link works' ) : ok(0, 'no phenotype url found');
66 cmp_ok( length( $mech->content ),
68 'got at least 1KB of data from the phenotype data download' );
70 my $genotype_download_link = $mech->find_link( text_regex => qr/genotype data/i );
72 ok( $genotype_download_link, 'got a genotype data download link' );
74 if ($genotype_download_link) {
75 $mech->links_ok($genotype_download_link->url, 'genotype data download link works' );
77 ok(0, 'no genotype download link');
79 cmp_ok( length( $mech->content ),
81 'got at least 1KB of data from the genotype data download' );
88 print STDERR "\n\n.....starting to test /phenome/qtl.pl.....\n\n";
90 '/phenome/qtl.pl?population_id=12&term_id=39945&chr=3&peak_marker=T0581&lod=3.6&qtl=../data/qtl.png',
91 'got a qtl detail page (/phenome/qtl.pl).'
94 $mech->content_contains($_)
98 'QTL markers\' genomic matches',
100 'QTL markers\' genetic positions',
104 my $qtl_image = $mech->find_image( alt_regex => qr/qtl for/i );
105 ok( $qtl_image, 'There is a qtl image' );
107 ###########################
108 # lib/SGN/Controller/Qtl.pm
109 ###########################
111 print STDERR "\n\n.....starting to test qtl search related pages.....\n\n";
113 use_ok( 'SGN::Controller::Qtl' )
114 or BAIL_OUT('could not include SGN::Controller::Qtl');
116 $mech->get_ok("/search/qtl", "Got qtl search page");
117 $mech->get_ok("/qtl/search", "Got qtl search page, another url");
118 $mech->get_ok("/qtl/search/results?trait=fruit+shape", "Got qtl search results page");
119 $mech->get_ok("/qtl/search/help", "Got qtl search help page");
121 print STDERR "\n\n.....starting to test qtl data submission webforms.....\n\n";
123 $mech->get_ok("/qtl/form", "intro qtl data submission webform");
124 $mech->get_ok("/qtl/form/intro", "intro qtl data submission webform -intro");
125 $mech->get_ok("/qtl/form/pop_form", "population detail -- qtl data submission webform");
126 $mech->get_ok("/qtl/form/trait_form/12", "trait data -- qtl data submission webform");
127 $mech->get_ok("/qtl/form/pheno_form/12", "phenotype data -- qtl data submission webform");
128 $mech->get_ok("/qtl/form/geno_form/12", "genotype data -- qtl data submission webform");
129 $mech->get_ok("/qtl/form/stat_form/12", "statistical parameters -- qtl data submission webform");
130 $mech->get_ok("/qtl/form/confirm/12", "confirmation-- qtl data submission webform");
132 print STDERR "\n\n.....starting to test traits list pages.....\n\n";
134 $mech->get_ok("/qtl/traits/H", "qtl traits list page");
135 $mech->get_ok("/qtl/submission/guide/", "qtl submission guide page");
137 print STDERR "\n\n.....starting to test qtl population page.....\n\n";
138 $mech->get_ok("/qtl/view/12", "Got qtl population page - old url");
139 $mech->get_ok("/qtl/population/12", "Got qtl population page");
140 $mech->content_contains("Population summary", "there is population summary section");
141 $mech->content_contains("Set statistical parameters", "there is statistical parameters section");
142 $mech->content_contains("Analyze QTLs", "there is list of traits section");
143 $mech->content_contains("Pearson correlation", "there is correlation section");
144 $mech->content_contains("Download", "there is data download section");
145 $mech->content_contains("Set your own QTL analysis parameters", "interactive statistics interface loaded");
147 ok($mech->find_image(alt_regex => qr/run solQTL/i ), "Got atleast one trait for solQTL");
148 my @links_to_solqtl = $mech->find_all_links( text_regex => qr/run solQTL/i );
149 my $traits = scalar(@links_to_solqtl);
150 cmp_ok($traits, '>=', 1, "this population has $traits traits for QTL analysis");
152 ok($mech->find_image(alt_regex => qr/correlation/i ), "Got correlation heatmap");
153 $mech->content_contains("Acronyms key", "Got trait acronyms key");
156 #$mech->with_test_level( process => sub {
157 # my ($res, $c) = ctx_request("qtl/view/12");
158 # my $controller = SGN->Controller("Qtl");