8 use SGN::Test::Fixture;
10 use CXGN::Dataset::File;
11 use CXGN::Dataset::Cache;
13 my $t = SGN::Test::Fixture->new();
15 $t->dbh()->begin_work();
17 my $cache_root_dir = $t->config->{cache_file_path};
18 my $cluster_shared_tempdir_config = $t->config->{cluster_shared_tempdir};
19 my $backend_config = $t->config->{backend};
20 my $cluster_host_config = $t->config->{cluster_host};
21 my $web_cluster_queue_config = $t->config->{'web_cluster_queue'};
22 my $basepath_config = $t->config->{basepath};
25 my $ds = CXGN::Dataset->new( people_schema => $t->people_schema(), schema => $t->bcs_schema());
26 $ds->accessions( [ 38913, 38914, 38915 ]);
27 $ds->years(['2012', '2013']);
28 $ds->traits([ 70666, 70741 ]);
29 $ds->trials([ 139, 144 ]);
30 $ds->plots( [ 40034, 40035 ]);
32 $ds->description("test description");
35 $ds->description("test description");
36 $ds->sp_person_id(41);
38 my $sp_dataset_id = $ds->store();
40 print STDERR "Dataset_id = $sp_dataset_id\n";
42 my $new_ds = CXGN::Dataset->new( people_schema => $t->people_schema(), schema => $t->bcs_schema(), sp_dataset_id => $sp_dataset_id);
44 is_deeply($new_ds->accessions(), $ds->accessions(), "accession store");
45 is_deeply($new_ds->years(), $ds->years(), "years store");
46 is_deeply($new_ds->traits(), $ds->traits(), "traits store");
47 is_deeply($new_ds->plots(), $ds->plots(), "plots store");
49 is($new_ds->name(), $ds->name(), "name store");
50 is($new_ds->description(), $ds->description(), "desc store");
51 is($new_ds->sp_person_id(), 41, "dataset owner");
54 CXGN::Dataset->new( people_schema => $t->people_schema(), schema => $t->bcs_schema()),
55 CXGN::Dataset::File->new( people_schema => $t->people_schema(), schema => $t->bcs_schema()),
56 CXGN::Dataset::Cache->new( people_schema => $t->people_schema(), schema => $t->bcs_schema(), cache_root => '/tmp/dataset_cache_root'),
59 foreach my $ds (@datasets) {
60 if ($ds->can("cache")) { $ds->cache->clear(); }
62 $ds->description("test description");
64 $ds->accessions( [ 38913, 38914, 38915 ] );
66 my $sp_dataset_id = $ds->store();
68 my $trials = $ds->retrieve_trials();
84 , "trial retrieve test");
86 if ($ds->isa("CXGN::Dataset::File")) {
87 ok(-e $ds->file_name()."_trials.txt", "trial file exists");
90 my $traits = $ds->retrieve_traits();
92 print STDERR Dumper($traits);
97 'dry matter content percentage|CO_334:0000092'
101 'fresh root weight|CO_334:0000012'
105 'fresh shoot weight measurement in kg|CO_334:0000016'
109 'harvest index variable|CO_334:0000015'
114 my $phenotypes = $ds->retrieve_phenotypes();
116 if ($ds->isa("CXGN::Dataset::File")) {
117 my$geno_filename = $ds->file_name()."_genotype.txt";
118 my $genotypes = $ds->retrieve_genotypes(1,$geno_filename,$cache_root_dir,$cluster_shared_tempdir_config,$backend_config,$cluster_host_config,$web_cluster_queue_config,$basepath_config,$forbid_cache);
120 my $genotypes = $ds->retrieve_genotypes(1);
123 my $years = $ds->retrieve_years();
134 ], "Year retrieve test");
136 my $plots = $ds->retrieve_plots();
197 'UG120036_block:2_plot:TP36_2012_NaCRRI'
201 'UG120037_block:2_plot:TP37_2012_NaCRRI'
205 'UG120038_block:2_plot:TP38_2012_NaCRRI'
207 ], "plot retrieve test");
213 print STDERR "DATA = ".$ds->data()."\n";