tests pass
[sgn.git] / t / unit_fixture / CXGN / Trial / AddPlants.t
blob4d074317f1ef9ef4fe411b1d220639ec286ad7d2
2 use strict;
4 use lib 't/lib';
6 use Test::More;
7 use Data::Dumper;
8 use SGN::Test::Fixture;
9 use CXGN::Trial::TrialLayout;
10 use CXGN::Trial;
11 use CXGN::Trial::Download;
12 use Spreadsheet::WriteExcel;
13 use Spreadsheet::Read;
14 use CXGN::Fieldbook::DownloadTrial;
16 my $f = SGN::Test::Fixture->new();
18 my $trial_id = 137;
20 my $tl = CXGN::Trial::TrialLayout->new({ schema => $f->bcs_schema(), trial_id => $trial_id });
22 my $d = $tl->get_design();
23 #print STDERR Dumper($d);
25 my @plot_nums;
26 my @accessions;
27 my @plant_names;
28 my @rep_nums;
29 my @plot_names;
30 foreach my $plot_num (keys %$d) {
31     push @plot_nums, $plot_num;
32     push @accessions, $d->{$plot_num}->{'accession_name'};
33     push @plant_names, $d->{$plot_num}->{'plant_names'};
34     push @rep_nums, $d->{$plot_num}->{'rep_number'};
35     push @plot_names, $d->{$plot_num}->{'plot_name'};
37 @plot_nums = sort @plot_nums;
38 @accessions = sort @accessions;
39 @plant_names = sort @plant_names;
40 @rep_nums = sort @rep_nums;
41 @plot_names = sort @plot_names;
43 #print STDERR Dumper \@plot_nums;
44 #print STDERR Dumper \@accessions;
45 #print STDERR Dumper \@plant_names;
46 #print STDERR Dumper \@rep_nums;
47 #print STDERR Dumper \@plot_names;
49 is_deeply(\@plot_nums, [
50           '1',
51           '10',
52           '11',
53           '12',
54           '13',
55           '14',
56           '15',
57           '2',
58           '3',
59           '4',
60           '5',
61           '6',
62           '7',
63           '8',
64           '9'
65         ], 'check design plot_nums');
67 is_deeply(\@accessions, [
68           'test_accession1',
69           'test_accession1',
70           'test_accession1',
71           'test_accession2',
72           'test_accession2',
73           'test_accession2',
74           'test_accession3',
75           'test_accession3',
76           'test_accession3',
77           'test_accession4',
78           'test_accession4',
79           'test_accession4',
80           'test_accession5',
81           'test_accession5',
82           'test_accession5'
83         ], 'check design accessions');
85 is_deeply(\@plant_names, [
86           [],
87           [],
88           [],
89           [],
90           [],
91           [],
92           [],
93           [],
94           [],
95           [],
96           [],
97           [],
98           [],
99           [],
100           []
101         ], "check design plant_names");
103 is_deeply(\@rep_nums, [
104           '1',
105           '1',
106           '1',
107           '1',
108           '1',
109           '2',
110           '2',
111           '2',
112           '2',
113           '2',
114           '3',
115           '3',
116           '3',
117           '3',
118           '3'
119         ], "check design rep_nums");
121 is_deeply(\@plot_names, [
122           'test_trial21',
123           'test_trial210',
124           'test_trial211',
125           'test_trial212',
126           'test_trial213',
127           'test_trial214',
128           'test_trial215',
129           'test_trial22',
130           'test_trial23',
131           'test_trial24',
132           'test_trial25',
133           'test_trial26',
134           'test_trial27',
135           'test_trial28',
136           'test_trial29'
137         ], "check design plot_names");
140 my $trial = CXGN::Trial->new({ bcs_schema => $f->bcs_schema(), trial_id => $trial_id });
141 $trial->create_plant_entities('2');
143 my $tl = CXGN::Trial::TrialLayout->new({ schema => $f->bcs_schema(), trial_id => $trial_id });
144 $d = $tl->get_design();
145 #print STDERR Dumper($d);
147 @plot_nums = ();
148 @accessions = ();
149 @plant_names = ();
150 @rep_nums = ();
151 @plot_names = ();
152 my @plant_names_flat;
153 foreach my $plot_num (keys %$d) {
154     push @plot_nums, $plot_num;
155     push @accessions, $d->{$plot_num}->{'accession_name'};
156     push @plant_names, $d->{$plot_num}->{'plant_names'};
157     push @rep_nums, $d->{$plot_num}->{'rep_number'};
158     push @plot_names, $d->{$plot_num}->{'plot_name'};
160 @plot_nums = sort @plot_nums;
161 @accessions = sort @accessions;
162 @rep_nums = sort @rep_nums;
163 @plot_names = sort @plot_names;
165 foreach my $plant_name_arr_ref (@plant_names) {
166     foreach (@$plant_name_arr_ref) {
167         push @plant_names_flat, $_;
168     }
170 @plant_names_flat = sort @plant_names_flat;
172 #print STDERR Dumper \@plot_nums;
173 #print STDERR Dumper \@accessions;
174 #print STDERR Dumper \@plant_names_flat;
175 #print STDERR Dumper \@rep_nums;
176 #print STDERR Dumper \@plot_names;
178 is_deeply(\@plot_nums, [
179           '1',
180           '10',
181           '11',
182           '12',
183           '13',
184           '14',
185           '15',
186           '2',
187           '3',
188           '4',
189           '5',
190           '6',
191           '7',
192           '8',
193           '9'
194         ], "check plot_nums after plant addition");
196 is_deeply(\@accessions, [
197           'test_accession1',
198           'test_accession1',
199           'test_accession1',
200           'test_accession2',
201           'test_accession2',
202           'test_accession2',
203           'test_accession3',
204           'test_accession3',
205           'test_accession3',
206           'test_accession4',
207           'test_accession4',
208           'test_accession4',
209           'test_accession5',
210           'test_accession5',
211           'test_accession5'
212         ], "check accessions after plant addition");
214 is_deeply(\@plant_names_flat, [
215           'test_trial210_plant_1',
216           'test_trial210_plant_2',
217           'test_trial211_plant_1',
218           'test_trial211_plant_2',
219           'test_trial212_plant_1',
220           'test_trial212_plant_2',
221           'test_trial213_plant_1',
222           'test_trial213_plant_2',
223           'test_trial214_plant_1',
224           'test_trial214_plant_2',
225           'test_trial215_plant_1',
226           'test_trial215_plant_2',
227           'test_trial21_plant_1',
228           'test_trial21_plant_2',
229           'test_trial22_plant_1',
230           'test_trial22_plant_2',
231           'test_trial23_plant_1',
232           'test_trial23_plant_2',
233           'test_trial24_plant_1',
234           'test_trial24_plant_2',
235           'test_trial25_plant_1',
236           'test_trial25_plant_2',
237           'test_trial26_plant_1',
238           'test_trial26_plant_2',
239           'test_trial27_plant_1',
240           'test_trial27_plant_2',
241           'test_trial28_plant_1',
242           'test_trial28_plant_2',
243           'test_trial29_plant_1',
244           'test_trial29_plant_2'
245         ], "check plant names");
247 is_deeply(\@rep_nums, [
248           '1',
249           '1',
250           '1',
251           '1',
252           '1',
253           '2',
254           '2',
255           '2',
256           '2',
257           '2',
258           '3',
259           '3',
260           '3',
261           '3',
262           '3'
263         ],"check rep nums after plant addition");
265 is_deeply(\@plot_names, [
266           'test_trial21',
267           'test_trial210',
268           'test_trial211',
269           'test_trial212',
270           'test_trial213',
271           'test_trial214',
272           'test_trial215',
273           'test_trial22',
274           'test_trial23',
275           'test_trial24',
276           'test_trial25',
277           'test_trial26',
278           'test_trial27',
279           'test_trial28',
280           'test_trial29'
281         ],"check plot_names after plant addition");
286 my $tempfile = "/tmp/test_create_trial_fieldbook_plots.xls";
288 my $create_fieldbook = CXGN::Fieldbook::DownloadTrial->new({
289     bcs_schema => $f->bcs_schema,
290     metadata_schema => $f->metadata_schema,
291     phenome_schema => $f->phenome_schema,
292     trial_id => $trial_id,
293     tempfile => $tempfile,
294     archive_path => $f->config->{archive_path},
295     user_id => 41,
296     user_name => "janedoe",
297     data_level => 'plots',
300 my $create_fieldbook_return = $create_fieldbook->download();
301 ok($create_fieldbook_return, "check that download trial fieldbook returns something.");
303 my @contents = ReadData ($create_fieldbook_return->{'file'});
305 #print STDERR Dumper @contents->[0]->[0];
306 is(@contents->[0]->[0]->{'type'}, 'xls', "check that type of file is correct");
307 is(@contents->[0]->[0]->{'sheets'}, '1', "check that type of file is correct");
309 my $columns = @contents->[0]->[1]->{'cell'};
310 #print STDERR Dumper scalar(@$columns);
311 ok(scalar(@$columns) == 9, "check number of col in created file.");
313 #print STDERR Dumper $columns;
314 is_deeply($columns, [
315           [],
316           [
317             undef,
318             'plot_name',
319             'test_trial21',
320             'test_trial22',
321             'test_trial23',
322             'test_trial24',
323             'test_trial25',
324             'test_trial26',
325             'test_trial27',
326             'test_trial28',
327             'test_trial29',
328             'test_trial210',
329             'test_trial211',
330             'test_trial212',
331             'test_trial213',
332             'test_trial214',
333             'test_trial215'
334           ],
335           [
336             undef,
337             'block_number',
338             '1',
339             '1',
340             '1',
341             '1',
342             '1',
343             '1',
344             '1',
345             '1',
346             '1',
347             '1',
348             '1',
349             '1',
350             '1',
351             '1',
352             '1'
353           ],
354           [
355             undef,
356             'plot_number',
357             '1',
358             '2',
359             '3',
360             '4',
361             '5',
362             '6',
363             '7',
364             '8',
365             '9',
366             '10',
367             '11',
368             '12',
369             '13',
370             '14',
371             '15'
372           ],
373           [
374             undef,
375             'rep_number',
376             '1',
377             '1',
378             '1',
379             '2',
380             '1',
381             '2',
382             '2',
383             '2',
384             '1',
385             '3',
386             '3',
387             '3',
388             '2',
389             '3',
390             '3'
391           ],
392           [
393             undef,
394             'row_number'
395           ],
396           [
397             undef,
398             'col_number'
399           ],
400           [
401             undef,
402             'accession_name',
403             'test_accession4',
404             'test_accession5',
405             'test_accession3',
406             'test_accession3',
407             'test_accession1',
408             'test_accession4',
409             'test_accession5',
410             'test_accession1',
411             'test_accession2',
412             'test_accession3',
413             'test_accession1',
414             'test_accession5',
415             'test_accession2',
416             'test_accession4',
417             'test_accession2'
418           ],
419           [
420             undef,
421             'is_a_control'
422           ]
423         ], "check fieldbook creation of plots after plants created");
428 my $tempfile = "/tmp/test_create_trial_fieldbook_plants.xls";
430 my $create_fieldbook = CXGN::Fieldbook::DownloadTrial->new({
431     bcs_schema => $f->bcs_schema,
432     metadata_schema => $f->metadata_schema,
433     phenome_schema => $f->phenome_schema,
434     trial_id => $trial_id,
435     tempfile => $tempfile,
436     archive_path => $f->config->{archive_path},
437     user_id => 41,
438     user_name => "janedoe",
439     data_level => 'plants',
442 my $create_fieldbook_return = $create_fieldbook->download();
443 ok($create_fieldbook_return, "check that download trial fieldbook returns something.");
445 my @contents = ReadData ($create_fieldbook_return->{'file'});
447 #print STDERR Dumper @contents->[0]->[0];
448 is(@contents->[0]->[0]->{'type'}, 'xls', "check that type of file is correct");
449 is(@contents->[0]->[0]->{'sheets'}, '1', "check that type of file is correct");
451 my $columns = @contents->[0]->[1]->{'cell'};
452 #print STDERR Dumper scalar(@$columns);
453 ok(scalar(@$columns) == 11, "check number of col in created file.");
455 #print STDERR Dumper $columns;
457 is_deeply($columns->[1], [
458             undef,
459             'plant_name',
460             'test_trial21_plant_1',
461             'test_trial21_plant_2',
462             'test_trial22_plant_1',
463             'test_trial22_plant_2',
464             'test_trial23_plant_1',
465             'test_trial23_plant_2',
466             'test_trial24_plant_1',
467             'test_trial24_plant_2',
468             'test_trial25_plant_1',
469             'test_trial25_plant_2',
470             'test_trial26_plant_1',
471             'test_trial26_plant_2',
472             'test_trial27_plant_1',
473             'test_trial27_plant_2',
474             'test_trial28_plant_1',
475             'test_trial28_plant_2',
476             'test_trial29_plant_1',
477             'test_trial29_plant_2',
478             'test_trial210_plant_1',
479             'test_trial210_plant_2',
480             'test_trial211_plant_1',
481             'test_trial211_plant_2',
482             'test_trial212_plant_1',
483             'test_trial212_plant_2',
484             'test_trial213_plant_1',
485             'test_trial213_plant_2',
486             'test_trial214_plant_1',
487             'test_trial214_plant_2',
488             'test_trial215_plant_1',
489             'test_trial215_plant_2'
490           ], "check contents of first col");
492 is_deeply($columns->[2], [
493             undef,
494             'plot_name',
495             'test_trial21',
496             'test_trial21',
497             'test_trial22',
498             'test_trial22',
499             'test_trial23',
500             'test_trial23',
501             'test_trial24',
502             'test_trial24',
503             'test_trial25',
504             'test_trial25',
505             'test_trial26',
506             'test_trial26',
507             'test_trial27',
508             'test_trial27',
509             'test_trial28',
510             'test_trial28',
511             'test_trial29',
512             'test_trial29',
513             'test_trial210',
514             'test_trial210',
515             'test_trial211',
516             'test_trial211',
517             'test_trial212',
518             'test_trial212',
519             'test_trial213',
520             'test_trial213',
521             'test_trial214',
522             'test_trial214',
523             'test_trial215',
524             'test_trial215'
525           ], "check 2nd col");
527 is_deeply($columns->[3], [
528             undef,
529             'block_number',
530             '1',
531             '1',
532             '1',
533             '1',
534             '1',
535             '1',
536             '1',
537             '1',
538             '1',
539             '1',
540             '1',
541             '1',
542             '1',
543             '1',
544             '1',
545             '1',
546             '1',
547             '1',
548             '1',
549             '1',
550             '1',
551             '1',
552             '1',
553             '1',
554             '1',
555             '1',
556             '1',
557             '1',
558             '1',
559             '1'
560           ], "check contents of second col");
562 is_deeply($columns->[4],[
563             undef,
564             'plant_number',
565             '1',
566             '2',
567             '1',
568             '2',
569             '1',
570             '2',
571             '1',
572             '2',
573             '1',
574             '2',
575             '1',
576             '2',
577             '1',
578             '2',
579             '1',
580             '2',
581             '1',
582             '2',
583             '1',
584             '2',
585             '1',
586             '2',
587             '1',
588             '2',
589             '1',
590             '2',
591             '1',
592             '2',
593             '1',
594             '2'
595           ], "check contents of third col");
597 is_deeply($columns->[5], [
598             undef,
599             'plot_number',
600             '1',
601             '1',
602             '2',
603             '2',
604             '3',
605             '3',
606             '4',
607             '4',
608             '5',
609             '5',
610             '6',
611             '6',
612             '7',
613             '7',
614             '8',
615             '8',
616             '9',
617             '9',
618             '10',
619             '10',
620             '11',
621             '11',
622             '12',
623             '12',
624             '13',
625             '13',
626             '14',
627             '14',
628             '15',
629             '15'
630           ], "check contents of fourth col");
632 is_deeply($columns->[6], [
633             undef,
634             'rep_number',
635             '1',
636             '1',
637             '1',
638             '1',
639             '1',
640             '1',
641             '2',
642             '2',
643             '1',
644             '1',
645             '2',
646             '2',
647             '2',
648             '2',
649             '2',
650             '2',
651             '1',
652             '1',
653             '3',
654             '3',
655             '3',
656             '3',
657             '3',
658             '3',
659             '2',
660             '2',
661             '3',
662             '3',
663             '3',
664             '3'
665           ], "check contents of fifth col");
667 is_deeply($columns->[7], [
668             undef,
669             'row_number'
670           ], "check contents");
672 is_deeply($columns->[8], [
673           undef,
674           'col_number'
675         ], "check contents");
676     
677 is_deeply($columns->[9],[
678             undef,
679             'accession_name',
680             'test_accession4',
681             'test_accession4',
682             'test_accession5',
683             'test_accession5',
684             'test_accession3',
685             'test_accession3',
686             'test_accession3',
687             'test_accession3',
688             'test_accession1',
689             'test_accession1',
690             'test_accession4',
691             'test_accession4',
692             'test_accession5',
693             'test_accession5',
694             'test_accession1',
695             'test_accession1',
696             'test_accession2',
697             'test_accession2',
698             'test_accession3',
699             'test_accession3',
700             'test_accession1',
701             'test_accession1',
702             'test_accession5',
703             'test_accession5',
704             'test_accession2',
705             'test_accession2',
706             'test_accession4',
707             'test_accession4',
708             'test_accession2',
709             'test_accession2'
710           ], "check contents of sixth col");
712 is_deeply($columns->[10],[
713             undef,
714             'is_a_control'
715           ], "check contents of 7th col");
718 my @trait_list = ("dry matter content percentage|CO_334:0000092", "fresh root weight|CO_334:0000012");
719 my $tempfile = "/tmp/test_create_pheno_spreadsheet_plots_after_plants.xls";
720 my $format = 'ExcelBasic';
721 my $create_spreadsheet = CXGN::Trial::Download->new( 
722   { 
723   bcs_schema => $f->bcs_schema,
724   trial_id => $trial_id,
725   trait_list => \@trait_list,
726   filename => $tempfile,
727   format => $format,
728   data_level => 'plots',
729   });
731 $create_spreadsheet->download();
732 my @contents = ReadData ($tempfile);
734 my $columns = @contents->[0]->[1]->{'cell'};
735 #print STDERR Dumper scalar(@$columns);
736 ok(scalar(@$columns) == 9, "check number of col in created file.");
738 #print STDERR Dumper @contents->[0]->[0];
739 is(@contents->[0]->[0]->{'type'}, 'xls', "check that type of file is correct");
740 is(@contents->[0]->[0]->{'sheets'}, '1', "check that type of file is correct");
742 #print STDERR Dumper @contents->[0]->[1]->{'cell'}->[1];
743 is_deeply(@contents->[0]->[1]->{'cell'}->[1], [
744                             undef,
745                             'Spreadsheet ID',
746                             'Trial name',
747                             'Description',
748                             'Trial location',
749                             'Predefined Columns',
750                             undef,
751                             'plot_name',
752                             'test_trial21',
753                             'test_trial22',
754                             'test_trial23',
755                             'test_trial24',
756                             'test_trial25',
757                             'test_trial26',
758                             'test_trial27',
759                             'test_trial28',
760                             'test_trial29',
761                             'test_trial210',
762                             'test_trial211',
763                             'test_trial212',
764                             'test_trial213',
765                             'test_trial214',
766                             'test_trial215'
767                           ], "check 1st col");
769 my $contents_col_2 = @contents->[0]->[1]->{'cell'}->[2];
770 #remove unique ID number from test...
771 splice @$contents_col_2, 0, 2;
772 #print STDERR Dumper $contents_col_2;
773 is_deeply($contents_col_2, ['test_trial',
774                             'test trial',
775                             'test_location',
776                             '[]',
777                             undef,
778                             'accession_name',
779                             'test_accession4',
780                             'test_accession5',
781                             'test_accession3',
782                             'test_accession3',
783                             'test_accession1',
784                             'test_accession4',
785                             'test_accession5',
786                             'test_accession1',
787                             'test_accession2',
788                             'test_accession3',
789                             'test_accession1',
790                             'test_accession5',
791                             'test_accession2',
792                             'test_accession4',
793                             'test_accession2'
794                           ], "check 2nd col");
796 is_deeply(@contents->[0]->[1]->{'cell'}->[3], [
797                             undef,
798                             'Spreadsheet format',
799                             'Operator',
800                             'Date',
801                             'Design Type',
802                             'Treatment',
803                             undef,
804                             'plot_number',
805                             '1',
806                             '2',
807                             '3',
808                             '4',
809                             '5',
810                             '6',
811                             '7',
812                             '8',
813                             '9',
814                             '10',
815                             '11',
816                             '12',
817                             '13',
818                             '14',
819                             '15'
820                           ], "check thrid col");
822 is_deeply(@contents->[0]->[1]->{'cell'}->[4], [
823                             undef,
824                             'BasicExcel',
825                             'Enter operator here',
826                             'Enter date here',
827                             'CRD',
828                             undef,
829                             undef,
830                             'block_number',
831                             '1',
832                             '1',
833                             '1',
834                             '1',
835                             '1',
836                             '1',
837                             '1',
838                             '1',
839                             '1',
840                             '1',
841                             '1',
842                             '1',
843                             '1',
844                             '1',
845                             '1'
846                           ], "check 4th col");
848 is_deeply(@contents->[0]->[1]->{'cell'}->[5], [
849                             undef,
850                             undef,
851                             undef,
852                             undef,
853                             undef,
854                             undef,
855                             undef,
856                             'is_a_control'
857                           ], "check 5th col");
859 is_deeply(@contents->[0]->[1]->{'cell'}->[6], [
860                             undef,
861                             undef,
862                             undef,
863                             undef,
864                             undef,
865                             undef,
866                             undef,
867                             'rep_number',
868                             '1',
869                             '1',
870                             '1',
871                             '2',
872                             '1',
873                             '2',
874                             '2',
875                             '2',
876                             '1',
877                             '3',
878                             '3',
879                             '3',
880                             '2',
881                             '3',
882                             '3'
883                           ], "check 6th col");
885 is_deeply(@contents->[0]->[1]->{'cell'}->[7], [
886                             undef,
887                             undef,
888                             undef,
889                             undef,
890                             undef,
891                             undef,
892                             undef,
893                             'dry matter content percentage|CO_334:0000092'
894                           ], "check 7th col");
896 is_deeply(@contents->[0]->[1]->{'cell'}->[8], [
897                             undef,
898                             undef,
899                             undef,
900                             undef,
901                             undef,
902                             undef,
903                             undef,
904                             'fresh root weight|CO_334:0000012'
905                           ], "check 8th col");
908 my @trait_list = ("dry matter content percentage|CO_334:0000092", "fresh root weight|CO_334:0000012");
909 my $tempfile = "/tmp/test_create_pheno_spreadsheet_plots_after_plants.xls";
910 my $format = 'ExcelBasic';
911 my $create_spreadsheet = CXGN::Trial::Download->new( 
913 bcs_schema => $f->bcs_schema,
914 trial_id => $trial_id,
915 trait_list => \@trait_list,
916 filename => $tempfile,
917 format => $format,
918 data_level => 'plants',
919 sample_number => '2',
920 predefined_columns => [{'plant_age' => '2 weeks'}],
923 $create_spreadsheet->download();
924 my @contents = ReadData ($tempfile);
926 my $columns = @contents->[0]->[1]->{'cell'};
927 #print STDERR Dumper scalar(@$columns);
928 ok(scalar(@$columns) == 11, "check number of col in created file.");
930 #print STDERR Dumper @contents->[0];
931 is(@contents->[0]->[0]->{'type'}, 'xls', "check that type of file is correct");
932 is(@contents->[0]->[0]->{'sheets'}, '1', "check that type of file is correct");
934 #print STDERR Dumper @contents->[0]->[1]->{'cell'}->[1];
935 is_deeply(@contents->[0]->[1]->{'cell'}->[1], [
936                           undef,
937                           'Spreadsheet ID',
938                           'Trial name',
939                           'Description',
940                           'Trial location',
941                           'Predefined Columns',
942                           undef,
943                           'plant_name',
944                           'test_trial21_plant_1',
945                           'test_trial21_plant_2',
946                           'test_trial22_plant_1',
947                           'test_trial22_plant_2',
948                           'test_trial23_plant_1',
949                           'test_trial23_plant_2',
950                           'test_trial24_plant_1',
951                           'test_trial24_plant_2',
952                           'test_trial25_plant_1',
953                           'test_trial25_plant_2',
954                           'test_trial26_plant_1',
955                           'test_trial26_plant_2',
956                           'test_trial27_plant_1',
957                           'test_trial27_plant_2',
958                           'test_trial28_plant_1',
959                           'test_trial28_plant_2',
960                           'test_trial29_plant_1',
961                           'test_trial29_plant_2',
962                           'test_trial210_plant_1',
963                           'test_trial210_plant_2',
964                           'test_trial211_plant_1',
965                           'test_trial211_plant_2',
966                           'test_trial212_plant_1',
967                           'test_trial212_plant_2',
968                           'test_trial213_plant_1',
969                           'test_trial213_plant_2',
970                           'test_trial214_plant_1',
971                           'test_trial214_plant_2',
972                           'test_trial215_plant_1',
973                           'test_trial215_plant_2'
974                         ], "check col1");
976 my $contents_col_2 = @contents->[0]->[1]->{'cell'}->[2];
977 #remove unique ID number from test...
978 splice @$contents_col_2, 0, 2;
979 #print STDERR Dumper $contents_col_2;
980 is_deeply($contents_col_2, ['test_trial',
981                           'test trial',
982                           'test_location',
983                           '["plant_age"]',
984                           undef,
985                           'plot_name',
986                           'test_trial21',
987                           'test_trial21',
988                           'test_trial22',
989                           'test_trial22',
990                           'test_trial23',
991                           'test_trial23',
992                           'test_trial24',
993                           'test_trial24',
994                           'test_trial25',
995                           'test_trial25',
996                           'test_trial26',
997                           'test_trial26',
998                           'test_trial27',
999                           'test_trial27',
1000                           'test_trial28',
1001                           'test_trial28',
1002                           'test_trial29',
1003                           'test_trial29',
1004                           'test_trial210',
1005                           'test_trial210',
1006                           'test_trial211',
1007                           'test_trial211',
1008                           'test_trial212',
1009                           'test_trial212',
1010                           'test_trial213',
1011                           'test_trial213',
1012                           'test_trial214',
1013                           'test_trial214',
1014                           'test_trial215',
1015                           'test_trial215'
1016                         ], "check col2");
1018 is_deeply(@contents->[0]->[1]->{'cell'}->[3], [
1019                           undef,
1020                           'Spreadsheet format',
1021                           'Operator',
1022                           'Date',
1023                           'Design Type',
1024                           'Treatment',
1025                           undef,
1026                           'accession_name',
1027                           'test_accession4',
1028                           'test_accession4',
1029                           'test_accession5',
1030                           'test_accession5',
1031                           'test_accession3',
1032                           'test_accession3',
1033                           'test_accession3',
1034                           'test_accession3',
1035                           'test_accession1',
1036                           'test_accession1',
1037                           'test_accession4',
1038                           'test_accession4',
1039                           'test_accession5',
1040                           'test_accession5',
1041                           'test_accession1',
1042                           'test_accession1',
1043                           'test_accession2',
1044                           'test_accession2',
1045                           'test_accession3',
1046                           'test_accession3',
1047                           'test_accession1',
1048                           'test_accession1',
1049                           'test_accession5',
1050                           'test_accession5',
1051                           'test_accession2',
1052                           'test_accession2',
1053                           'test_accession4',
1054                           'test_accession4',
1055                           'test_accession2',
1056                           'test_accession2'
1057                         ], "check col3");
1059 is_deeply(@contents->[0]->[1]->{'cell'}->[4], [
1060                           undef,
1061                           'BasicExcel',
1062                           'Enter operator here',
1063                           'Enter date here',
1064                           'CRD',
1065                           undef,
1066                           undef,
1067                           'plot_number',
1068                           '1',
1069                           '1',
1070                           '2',
1071                           '2',
1072                           '3',
1073                           '3',
1074                           '4',
1075                           '4',
1076                           '5',
1077                           '5',
1078                           '6',
1079                           '6',
1080                           '7',
1081                           '7',
1082                           '8',
1083                           '8',
1084                           '9',
1085                           '9',
1086                           '10',
1087                           '10',
1088                           '11',
1089                           '11',
1090                           '12',
1091                           '12',
1092                           '13',
1093                           '13',
1094                           '14',
1095                           '14',
1096                           '15',
1097                           '15'
1098                         ], "check col4");
1100 is_deeply(@contents->[0]->[1]->{'cell'}->[5], [
1101                           undef,
1102                           undef,
1103                           undef,
1104                           undef,
1105                           undef,
1106                           undef,
1107                           undef,
1108                           'block_number',
1109                           '1',
1110                           '1',
1111                           '1',
1112                           '1',
1113                           '1',
1114                           '1',
1115                           '1',
1116                           '1',
1117                           '1',
1118                           '1',
1119                           '1',
1120                           '1',
1121                           '1',
1122                           '1',
1123                           '1',
1124                           '1',
1125                           '1',
1126                           '1',
1127                           '1',
1128                           '1',
1129                           '1',
1130                           '1',
1131                           '1',
1132                           '1',
1133                           '1',
1134                           '1',
1135                           '1',
1136                           '1',
1137                           '1',
1138                           '1'
1139                         ], "check col5");
1141 is_deeply(@contents->[0]->[1]->{'cell'}->[6], [
1142                           undef,
1143                           undef,
1144                           undef,
1145                           undef,
1146                           undef,
1147                           undef,
1148                           undef,
1149                           'is_a_control'
1150                         ], "check col6");
1152 is_deeply(@contents->[0]->[1]->{'cell'}->[7], [
1153                           undef,
1154                           undef,
1155                           undef,
1156                           undef,
1157                           undef,
1158                           undef,
1159                           undef,
1160                           'rep_number',
1161                           '1',
1162                           '1',
1163                           '1',
1164                           '1',
1165                           '1',
1166                           '1',
1167                           '2',
1168                           '2',
1169                           '1',
1170                           '1',
1171                           '2',
1172                           '2',
1173                           '2',
1174                           '2',
1175                           '2',
1176                           '2',
1177                           '1',
1178                           '1',
1179                           '3',
1180                           '3',
1181                           '3',
1182                           '3',
1183                           '3',
1184                           '3',
1185                           '2',
1186                           '2',
1187                           '3',
1188                           '3',
1189                           '3',
1190                           '3'
1191                         ], "check col7");
1193 is_deeply(@contents->[0]->[1]->{'cell'}->[8], [
1194                           undef,
1195                           undef,
1196                           undef,
1197                           undef,
1198                           undef,
1199                           undef,
1200                           undef,
1201                           'plant_age',
1202                           '2 weeks',
1203                           '2 weeks',
1204                           '2 weeks',
1205                           '2 weeks',
1206                           '2 weeks',
1207                           '2 weeks',
1208                           '2 weeks',
1209                           '2 weeks',
1210                           '2 weeks',
1211                           '2 weeks',
1212                           '2 weeks',
1213                           '2 weeks',
1214                           '2 weeks',
1215                           '2 weeks',
1216                           '2 weeks',
1217                           '2 weeks',
1218                           '2 weeks',
1219                           '2 weeks',
1220                           '2 weeks',
1221                           '2 weeks',
1222                           '2 weeks',
1223                           '2 weeks',
1224                           '2 weeks',
1225                           '2 weeks',
1226                           '2 weeks',
1227                           '2 weeks',
1228                           '2 weeks',
1229                           '2 weeks',
1230                           '2 weeks',
1231                           '2 weeks'
1232                         ], "check col8");
1234 is_deeply(@contents->[0]->[1]->{'cell'}->[9], [
1235                           undef,
1236                           undef,
1237                           undef,
1238                           undef,
1239                           undef,
1240                           undef,
1241                           undef,
1242                           'dry matter content percentage|CO_334:0000092'
1243                         ], "check col9");
1245 is_deeply(@contents->[0]->[1]->{'cell'}->[10], [
1246                           undef,
1247                           undef,
1248                           undef,
1249                           undef,
1250                           undef,
1251                           undef,
1252                           undef,
1253                           'fresh root weight|CO_334:0000012'
1254                         ], "check col10");
1256 done_testing();