3 use Test::More tests => 61;
7 use SGN::Test::WWW::Mechanize skip_cgi => 1;
8 use SGN::Test::Data qw/ create_test /;
9 use Catalyst::Test 'SGN';
10 use Digest::SHA1 qw/sha1_hex/;
13 my $mech = SGN::Test::WWW::Mechanize->new;
15 $mech->with_test_level( remote => sub {
16 $mech->get('/tools/bulk/tabs/gene_tab');
17 $mech->submit_form_ok({
18 form_name => "bulk_gene",
20 ids => "Solyc02g081670 BLARG",
23 }, "submit bulk_gene with some invalid identifiers");
26 $mech->with_test_level( remote => sub {
27 $mech->get('/tools/bulk/tabs/gene_tab');
28 $mech->submit_form_ok({
29 form_name => "bulk_gene",
31 ids => "NYARLATHOTEP BLARG",
34 }, "submit bulk_gene with all invalid identifiers");
35 $mech->content_like(qr/did not contain any valid identifiers/);
38 $mech->with_test_level( remote => sub {
39 $mech->get('/tools/bulk/tabs/gene_tab');
40 $mech->submit_form_ok({
41 form_name => "bulk_gene",
43 ids => "Solyc02g081670",
46 }, "submit bulk_gene with a single valid identifier but invalid gene_type");
47 $mech->content_like(qr/Invalid data type chosen/);
50 $mech->with_test_level( remote => sub {
51 $mech->get('/tools/bulk/tabs/gene_tab');
52 $mech->submit_form_ok({
53 form_name => "bulk_gene",
55 ids => "Solyc02g081670",
56 gene_type => 'not_valid',
58 }, "submit bulk_gene with a single valid identifier");
59 $mech->content_like(qr/Invalid data type chosen/);
62 $mech->with_test_level( remote => sub {
63 $mech->get('/tools/bulk/tabs/gene_tab');
64 $mech->submit_form_ok({
65 form_name => "bulk_gene",
67 ids => "Solyc02g081670",
70 }, "submit bulk_gene with a single valid identifier for cds");
71 $mech->content_unlike(qr/Caught exception/);
72 $mech->content_unlike(qr/Your query did not contain any valid identifiers/);
75 $mech->with_test_level( remote => sub {
76 my $id = 'Solyc02g081670';
77 my $gene_type = 'cds';
78 $mech->get_ok('/tools/bulk/tabs/gene_tab');
79 $mech->submit_form_ok({
80 form_name => "bulk_gene",
83 gene_type => $gene_type,
85 }, "submit bulk_gene with a single valid identifier for cdna");
86 my $sha1 = sha1_hex("cds $id");
87 $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
88 $mech->content_unlike(qr/Your query did not contain any valid identifiers/);
89 $mech->content_unlike(qr/Invalid data type/);
90 $mech->content_unlike(qr/At least one valid identifier must be given/);
91 my @flinks = $mech->find_all_links( url_regex => qr{/gene/download/$sha1\.fasta} );
92 cmp_ok(@flinks, '==', 1, "found one FASTA download link for $gene_type $id $sha1.fasta");
93 $mech->links_ok( \@flinks );
95 # cds sequence for Solyc02g081670.1
96 my $expected_sequence =<<SEQ;
97 >Solyc02g081670.1.1 Fimbriata (Fragment) (AHRD V1 **-- Q6QVW9_MIMLE); contains Interpro domain(s) IPR001810 Cyclin-like F-box
98 ATGGAAGCTTTTCATCATCCCCCTATTAGCTTTCACTTTCCCTATGCTTTTCCTATCCCA
99 ACACCAACAACCAATTTTCTTGGAACTCCAAATTCATCATCAGTTAATGGAATGATCATC
100 AACACTTGGATGGATAGTAGAATTTGGAGTAGACTTCCACATAGGCTTATTGATAGAATC
101 ATTGCTTTTCTACCACCACCTGCTTTCTTTAGAGCTAGAGTTGTGTGTAAGAGATTCTAT
102 GGACTTATTTACTCTACACATTTTCTTGAATTGTACTTGCAAGTTTCACCTAAGAGGAAC
103 TGGTTCATTTTCTTTAAACAAAAAGTACCAAGAAACAACATTTACAAGAACGTGATGAAT
104 AGTAGTAACTCAGGAGTTTGTTCTGTTGAAGGTTACTTGTTTGATCCTGATAATCTTTGT
105 TGGTATAGGCTTTCTTTTGCTTTAATCCCACAAGGGTTTTCTCCTGTTTCATCTTCTGGT
106 GGATTAATTTGCTTTGTTTCTGATGAATCTGGATCAAAAAACATTCTTTTATGTAATCCA
107 CTTGTAGGATCCATAATTCCCCTGCCTCCAACTTTAAGGCCTAGGCTTTTTCCTTCTATT
108 GGTTTAACTATAACCAACACATCTATTGATATAGCTGTAGCTGGAGATGACTTGATATCA
109 CCTTATGCTGTTAAAAACTTAACTACAGAGTCATTTCATATTGATGGTAATGGATTTTAC
110 TCAATATGGGGTACAACTTCTACACTTCCAAGATTATGCAGTTTTGAATCAGGCAAAATG
111 GTGCATGTACAGGGGAGATTTTATTGCATGAATTTTAGTCCTTTTAGTGTGCTTTCTTAT
112 GATATAGGGACTAATAACTGGTGCAAGATTCAAGCCCCGATGCGACGATTCCTACGTTCA
113 CCGAGCCTTGTTGAAGGGAATGGTAAGGTTGTTTTAGTTGCAGCAGTTGAAAAGAGTAAA
114 CTGAATGTGCCAAGAAGTTTGAGGCTTTGGGCATTGCAAGATTGTGGTACAATGTGGTTG
115 GAAATAGAAAGAATGCCACAACAATTGTATGTGCAGTTTGCTGAAGTGGAGAATGGACAA
116 GGGTTTAGTTGTGTTGGACATGGTGAATATGTGGTGATAATGATTAAGAATAATTCAGAT
117 AAGGCATTGTTGTTTGATTTCTGTAAGAAGAGATGGATTTGGATACCTCCTTGTCCATTT
118 TTGGGAAATAATTTAGACTATGGTGGTGTTGGTAGTAGTAATAATTATTGTGGAGAATTT
119 GGAGTTGGAGGGGGAGAGTTGCATGGATTTGGTTATGACCCTAGACTTGCTGCACCTATT
120 GGTGCACTTCTTGATCAGTTGACATTGCCCTTTCAGTCATTCAACTGA
124 cmp_ok(length($mech->get($_->url)->content), '>', 0, $_->url . " length > 0 ");
125 $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
126 eq_or_diff($mech->content,$expected_sequence, $_->url . " looks like expected sequence");
131 $mech->with_test_level( remote => sub {
132 my $id = 'Solyc02g081670';
133 my $gene_type = 'cdna';
134 $mech->get_ok('/tools/bulk/tabs/gene_tab');
135 $mech->submit_form_ok({
136 form_name => "bulk_gene",
139 gene_type => $gene_type,
141 }, "submit bulk_gene $id with a single valid identifier for cdna");
142 my $sha1 = sha1_hex("cdna $id");
143 $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
144 $mech->content_unlike(qr/Your query did not contain any valid identifiers/);
145 $mech->content_unlike(qr/Invalid data type/);
146 $mech->content_unlike(qr/At least one valid identifier must be given/);
147 my @flinks = $mech->find_all_links( url_regex => qr{/bulk/gene/download/$sha1\.fasta} );
148 cmp_ok(@flinks, '==', 1, "found one FASTA download link for $gene_type $id $sha1.fasta");
149 $mech->links_ok( \@flinks );
151 # TODO: Depends on live data.
153 # cDNA sequence for Solyc02g081670.1
154 my $expected_sequence =<<SEQ;
155 >Solyc02g081670.1.1 Fimbriata (Fragment) (AHRD V1 **-- Q6QVW9_MIMLE); contains Interpro domain(s) IPR001810 Cyclin-like F-box
156 ATGGAAGCTTTTCATCATCCCCCTATTAGCTTTCACTTTCCCTATGCTTTTCCTATCCCA
157 ACACCAACAACCAATTTTCTTGGAACTCCAAATTCATCATCAGTTAATGGAATGATCATC
158 AACACTTGGATGGATAGTAGAATTTGGAGTAGACTTCCACATAGGCTTATTGATAGAATC
159 ATTGCTTTTCTACCACCACCTGCTTTCTTTAGAGCTAGAGTTGTGTGTAAGAGATTCTAT
160 GGACTTATTTACTCTACACATTTTCTTGAATTGTACTTGCAAGTTTCACCTAAGAGGAAC
161 TGGTTCATTTTCTTTAAACAAAAAGTACCAAGAAACAACATTTACAAGAACGTGATGAAT
162 AGTAGTAACTCAGGAGTTTGTTCTGTTGAAGGTTACTTGTTTGATCCTGATAATCTTTGT
163 TGGTATAGGCTTTCTTTTGCTTTAATCCCACAAGGGTTTTCTCCTGTTTCATCTTCTGGT
164 GGATTAATTTGCTTTGTTTCTGATGAATCTGGATCAAAAAACATTCTTTTATGTAATCCA
165 CTTGTAGGATCCATAATTCCCCTGCCTCCAACTTTAAGGCCTAGGCTTTTTCCTTCTATT
166 GGTTTAACTATAACCAACACATCTATTGATATAGCTGTAGCTGGAGATGACTTGATATCA
167 CCTTATGCTGTTAAAAACTTAACTACAGAGTCATTTCATATTGATGGTAATGGATTTTAC
168 TCAATATGGGGTACAACTTCTACACTTCCAAGATTATGCAGTTTTGAATCAGGCAAAATG
169 GTGCATGTACAGGGGAGATTTTATTGCATGAATTTTAGTCCTTTTAGTGTGCTTTCTTAT
170 GATATAGGGACTAATAACTGGTGCAAGATTCAAGCCCCGATGCGACGATTCCTACGTTCA
171 CCGAGCCTTGTTGAAGGGAATGGTAAGGTTGTTTTAGTTGCAGCAGTTGAAAAGAGTAAA
172 CTGAATGTGCCAAGAAGTTTGAGGCTTTGGGCATTGCAAGATTGTGGTACAATGTGGTTG
173 GAAATAGAAAGAATGCCACAACAATTGTATGTGCAGTTTGCTGAAGTGGAGAATGGACAA
174 GGGTTTAGTTGTGTTGGACATGGTGAATATGTGGTGATAATGATTAAGAATAATTCAGAT
175 AAGGCATTGTTGTTTGATTTCTGTAAGAAGAGATGGATTTGGATACCTCCTTGTCCATTT
176 TTGGGAAATAATTTAGACTATGGTGGTGTTGGTAGTAGTAATAATTATTGTGGAGAATTT
177 GGAGTTGGAGGGGGAGAGTTGCATGGATTTGGTTATGACCCTAGACTTGCTGCACCTATT
178 GGTGCACTTCTTGATCAGTTGACATTGCCCTTTCAGTCATTCAACTGA
182 cmp_ok(length($mech->get($_->url)->content), '>', 0, $_->url . " length > 0 ");
183 $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
184 eq_or_diff($mech->content,$expected_sequence, $_->url . " looks like expected sequence");
189 $mech->with_test_level( remote => sub {
190 $mech->get('/tools/bulk/tabs/gene_tab');
191 my $gene_type = 'protein';
192 my $id = "Solyc02g081670";
193 $mech->submit_form_ok({
194 form_name => "bulk_gene",
197 gene_type => $gene_type,
199 }, "submit bulk_gene $id with a single valid identifier for protein");
200 my $sha1 = sha1_hex("protein $id");
201 $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
202 $mech->content_unlike(qr/Your query did not contain any valid identifiers/);
203 $mech->content_unlike(qr/At least one valid identifier must be given/);
204 my @flinks = $mech->find_all_links( url_regex => qr{/bulk/gene/download/$sha1\.fasta} );
205 cmp_ok(@flinks, '==', 1, "found one FASTA download link for $gene_type $id $sha1.fasta");
206 $mech->links_ok( \@flinks );
207 # TODO: Depends on live data.
208 my $expected_sequence =<<SEQ;
209 >Solyc02g081670.1.1 Fimbriata (Fragment) (AHRD V1 **-- Q6QVW9_MIMLE); contains Interpro domain(s) IPR001810 Cyclin-like F-box
210 MEAFHHPPISFHFPYAFPIPTPTTNFLGTPNSSSVNGMIINTWMDSRIWSRLPHRLIDRI
211 IAFLPPPAFFRARVVCKRFYGLIYSTHFLELYLQVSPKRNWFIFFKQKVPRNNIYKNVMN
212 SSNSGVCSVEGYLFDPDNLCWYRLSFALIPQGFSPVSSSGGLICFVSDESGSKNILLCNP
213 LVGSIIPLPPTLRPRLFPSIGLTITNTSIDIAVAGDDLISPYAVKNLTTESFHIDGNGFY
214 SIWGTTSTLPRLCSFESGKMVHVQGRFYCMNFSPFSVLSYDIGTNNWCKIQAPMRRFLRS
215 PSLVEGNGKVVLVAAVEKSKLNVPRSLRLWALQDCGTMWLEIERMPQQLYVQFAEVENGQ
216 GFSCVGHGEYVVIMIKNNSDKALLFDFCKKRWIWIPPCPFLGNNLDYGGVGSSNNYCGEF
217 GVGGGELHGFGYDPRLAAPIGALLDQLTLPFQSFN*
220 cmp_ok(length($mech->get($_->url)->content), '>', 0, $_->url . " length > 0 ");
221 $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
222 $mech->content_unlike(qr/Unable to perform storage-dependent operations/);
223 eq_or_diff($mech->content,$expected_sequence, $_->url . " looks like expected sequence");
227 $mech->with_test_level( remote => sub {
228 $mech->get('/tools/bulk/tabs/gene_tab');
229 my $gene_type = 'protein';
230 my $id = "Solyc02g092680";
231 $mech->submit_form_ok({
232 form_name => "bulk_gene",
235 gene_type => $gene_type,
237 }, "submit bulk_gene $id with a single valid identifier for protein");
238 my $sha1 = sha1_hex("protein $id");
239 $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
240 $mech->content_unlike(qr/Your query did not contain any valid identifiers/);
241 $mech->content_unlike(qr/At least one valid identifier must be given/);
242 my @flinks = $mech->find_all_links( url_regex => qr{/bulk/gene/download/$sha1\.fasta} );
243 cmp_ok(@flinks, '==', 1, "found one FASTA download link for $gene_type $id $sha1.fasta");
244 $mech->links_ok( \@flinks );
245 # TODO: Depends on live data.
246 my $expected_sequence = <<SEQ;
247 >Solyc02g092680.1.1 Subtilisin-like protease (AHRD V1 ***- A9XG40_TOBAC); contains Interpro domain(s) IPR015500 Peptidase S8, subtilisin-related
248 MSTYPLIVVVVVLVCLCHMSVAMEEKKTYIIHMAKSQMPATFDDHTHWYDASLKSVSESA
249 EMIYVYNNVIHGFAARLTAQEAESLKTQPGILSVLSEVIYQLHTTRTPLFLGLDNRPDVF
250 NDSDAMSNVIIGILDSGIWPERRSFDDTGLGPVPESWKGECESGINFSSAMCNRKLIGAR
251 YFSSGYEATLGPIDESKESKSPRDNEGHGTHTASTAAGSVVQGASLFGYASGTARGMAYR
252 ARVAVYKVCWLGKCFGPDILAGMDKAIDDNVNVLSLSLGGEHFDFYSDDVAIGAFAAMEK
253 GIMVSCSAGNAGPNQFSLANQAPWITTVGAGTVDRDFPAYVSLGNGKNFSGVSLYAGDPL
254 PSGMLPLVYAGNASNATNGNLCIMGTLIPEKVKGKIVLCDGGVNVRAEKGYVVKSAGGAG
255 MIFANTNGLGLLADAHLLPAAAVGQLDGDEIKKYITSDPNPTATILFGGTMVGVQPAPIL
256 AAFSSRGPNSITPEILKPDIIAPGVNILAGWSGAVGPTGLPEDDRRVEFNIISGTSMSCP
257 HVSGLAALLKGVHPEWSPAAIRSALMTTAYTTYRNGGALLDVATGKPSTPFGHGAGHVDP
258 VSAVNPGLVYDINADDYLNFLCALKYSPSQINIIARRNFTCDSSKIYSVTDLNYPSFSVA
259 FPADTGSNTIRYSRTLTNVGPSGTYKVAVTLPDSSVEIIVEPETVSFTQINEKISYSVSF
260 TAPSKPPSTNVFGKIEWSDGTHLVTSPVAISWS*
263 cmp_ok(length($mech->get($_->url)->content), '>', 0, $_->url . " length > 0 ");
264 $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
265 $mech->content_unlike(qr/Unable to perform storage-dependent operations/);
266 eq_or_diff($mech->content,$expected_sequence, $_->url . " looks like expected sequence");
272 $mech->with_test_level( remote => sub {
273 $mech->get('/tools/bulk/tabs/gene_tab');
274 my $gene_type = 'protein';
275 my $id = "Os01g0276000";
276 $mech->submit_form_ok({
277 form_name => "bulk_gene",
279 ids => "01g0274500\r\n Os01g0274601\r\n Os01g0274800\r\n Os01g0274901\r\n Os01g0275200\r\n Os01g0275300\r\n Os01g0275500\r\n Os01g0275600\r\n Os01g0275800\r\n Os01g0275900\r\n Os01g0275950\r\n Os01g0276000\r\n Os01g0276100\r\n Os01g0276200\r\n Os01g0276300\r\n Os01g0276400\r\n Os01g0276500\r\n Os01g0276600\r\n Os01g0276700\r\n Os01g0276800\r\n Os01g0276900\r\n",
280 gene_type => $gene_type,
282 }, "submit bulk_gene with a single valid identifier for protein");
283 my $sha1 = sha1_hex("protein $id");
284 $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
285 $mech->content_unlike(qr/Your query did not contain any valid identifiers/);
286 $mech->content_unlike(qr/At least one valid identifier must be given/);
287 my @flinks = $mech->find_all_links( url_regex => qr{/bulk/gene/download/[a-f\d]+\.fasta} );
288 cmp_ok(@flinks, '==', 1, "found one FASTA download link for $gene_type $id $sha1.fasta");
289 $mech->links_ok( \@flinks );
292 cmp_ok(length($mech->get($_->url)->content), '>', 0, $_->url . " length > 0 ");
293 $mech->content_unlike(qr/Caught exception/) or diag $mech->content;
294 $mech->content_unlike(qr/Unable to perform storage-dependent operations/);