1 package CXGN
::Trial
::TrialLayoutDownload
::SamplingTrialLayout
;
5 CXGN::Trial::TrialLayoutDownload::SamplingTrialLayout - an object to handle downloading a sampling trial layout. this should only be called from CXGN::Trial::TrialLayoutDownload
9 my $plate_layout = CXGN::Trial::TrialLayoutDownload::SamplingTrialLayout->new({
11 trial_id => $trial_id,
12 data_level => $data_level,
13 selected_columns => \%selected_cols,
15 trial => $selected_trial,
17 my $result = $plate_layout->retrieve();
21 Will output an array of arrays, where each row is a tissue sample in the sampling trial. the columns are based on the supplied selected_cols. this should only be called from CXGN::Trial::TrialLayoutDownload
32 use SGN
::Model
::Cvterm
;
34 use CXGN
::Stock
::Accession
;
36 extends
'CXGN::Trial::TrialLayoutDownload';
40 my $schema = $self->schema();
41 my %selected_cols = %{$self->selected_columns};
42 my %design = %{$self->design};
43 my $trial = $self->trial;
46 my @possible_cols = ('trial_name', 'year', 'location', 'sampling_facility', 'sampling_trial_sample_type', 'acquisition_date', 'tissue_sample_name', 'plot_number', 'rep_number', 'source_observation_unit_name', 'accession_name', 'synonyms', 'dna_person', 'notes', 'tissue_type', 'extraction', 'concentration', 'volume');
49 foreach (@possible_cols){
50 if ($selected_cols{$_}){
54 push @output, \
@header;
56 my $trial_name = $trial->get_name ?
$trial->get_name : '';
57 my $location_name = $trial->get_location ?
$trial->get_location->[1] : '';
58 my $trial_year = $trial->get_year ?
$trial->get_year : '';
59 my $sampling_facility_cvterm_id = SGN
::Model
::Cvterm
->get_cvterm_row($schema, 'sampling_facility', 'project_property')->cvterm_id();
60 my $sampling_trial_sample_type_cvterm_id = SGN
::Model
::Cvterm
->get_cvterm_row($schema, 'sampling_trial_sample_type', 'project_property')->cvterm_id();
61 my $sampling_facility = $schema->resultset("Project::Projectprop")->search({ project_id
=> $trial->get_trial_id(), type_id
=> $sampling_facility_cvterm_id } )->first->value();
62 my $sampling_type = $schema->resultset("Project::Projectprop")->search({ project_id
=> $trial->get_trial_id(), type_id
=> $sampling_trial_sample_type_cvterm_id } )->first->value();
64 my $pedigree_strings = $self->_get_all_pedigrees(\
%design);
66 foreach my $key (sort { $a cmp $b} keys %design) {
67 my $design_info = $design{$key};
69 foreach (@possible_cols){
70 if ($selected_cols{$_}){
71 if ($_ eq 'trial_name'){
72 push @
$line, $trial_name;
73 } elsif ($_ eq 'year'){
74 push @
$line, $trial_year;
75 } elsif ($_ eq 'location'){
76 push @
$line, $location_name;
77 } elsif ($_ eq 'sampling_facility'){
78 push @
$line, $sampling_facility;
79 } elsif ($_ eq 'sampling_trial_sample_type'){
80 push @
$line, $sampling_type;
81 } elsif ($_ eq 'tissue_sample_name'){
82 push @
$line, $design_info->{'plot_name'};
83 } elsif ($_ eq 'synonyms'){
84 my $accession = CXGN
::Stock
::Accession
->new({schema
=>$schema, stock_id
=>$design_info->{"accession_id"}});
85 push @
$line, join ',', @
{$accession->synonyms}
86 } elsif ($_ eq 'pedigree'){
87 push @
$line, $pedigree_strings->{$design_info->{"accession_name"}};
89 push @
$line, $design_info->{$_};