1 package CXGN
::Trial
::TrialLayout
;
5 CXGN::Trial::TrialLayout - Module to get layout information about a trial
9 This object has been converted to a factory object that will produce different classes
10 based on the experiment_type. The usage has been kept the same for backwards compatibility,
11 but a cleaner factory object implementation should be adopted in the future.
13 my $trial_layout = CXGN::Trial::TrialLayout->new({
15 trial_id => $trial_id,
16 experiment_type => $experiment_type #Either 'field_layout' or 'genotyping_layout'
18 my $tl = $trial_layout->get_design();
20 This module handles both retrieval of field_layout and genotyping_layout experiments.
22 If experiment_type is field_layout, get_design returns a hash representing
23 all the plots, with their design info and plant info and samples info. The return is
24 a HashRef of HashRef where the keys are the plot_number such as:
28 "plot_name" => "plot1",
29 "plot_number" => 1001,
31 "accession_name" => "accession1",
32 "accession_id" => 2345,
38 "seedlot_name" => "seedlot1",
39 "seedlot_stock_id" => 3456,
40 "num_seed_per_plot" => 12,
41 "seed_transaction_operator" => "janedoe",
42 "plant_names" => ["plant1", "plant2"],
43 "plant_ids" => [3456, 3457],
48 If experiment_type is genotyping_layout, get_design returns a hash representing
49 all wells in a plate, with the tissue_sample name in each well and its accession.
50 The return is a HashRef of HashRef where the keys are the well number such as:
54 "plot_name" => "mytissuesample_A01",
55 "stock_name" => "accession1",
56 "plot_number" => "A01",
60 "concentration" => "2",
62 "dna_person" => "nmorales",
63 "acquisition_date" => "2018/01/09",
64 "tissue_type" => "leaf",
65 "extraction" => "ctab",
66 "ncbi_taxonomy_id" => "1001",
67 "source_observation_unit_name" => "plant1",
68 "source_observation_unit_id" => "9091"
72 By using get_design(), this module attempts to get the design from a
73 projectprop called 'trial_layout_json', but if it cannot be found it calls
74 generate_and_cache_layout() to generate the design, return it, and store it
75 using that projectprop.
77 --------------------------------------------------------------------------
79 This can also be used the verify that a layout has a physical map covering all
80 plots, as well as verifying that the relationships between entities are valid
83 my $trial_layout = CXGN::Trial::TrialLayout->new({
85 trial_id => $c->stash->{trial_id},
86 experiment_type => $experiment_type, #Either 'field_layout' or 'genotyping_layout'
88 verify_physical_map=>1
90 my $trial_errors = $trial_layout->generate_and_cache_layout();
92 If there are errors, $trial_errors is a HashRef like:
97 "layout_errors" => [ "the accession between plot 1 and seedlot 1 is out of sync", "the accession between plot 1 and plant 1 is out of sync" ],
98 "seedlot_errors" => [ "plot1 does not have a seedlot linked" ],
99 "physical_map_errors" => [ "plot 1 does not have a row_number", "plot 1 does not have a col_number"]
108 Jeremy D. Edwards (jde22@cornell.edu)
114 # use MooseX::FollowPBP;
115 # use Moose::Util::TypeConstraints;
117 # use CXGN::Stock::StockLookup;
118 # use CXGN::Location::LocationLookup;
120 # use SGN::Model::Cvterm;
121 # use CXGN::Chado::Stock;
124 use CXGN
::Trial
::TrialLayoutFactory
;
129 # isa => 'DBIx::Class::Schema',
133 # has 'trial_id' => (
136 # predicate => 'has_trial_id',
137 # trigger => \&_lookup_trial_id,
141 # has 'experiment_type' => (
143 # isa => 'Str', #field_layout or genotyping_layout
155 my $factory = CXGN
::Trial
::TrialLayoutFactory
->new();
157 my $object = $factory->create( $args );