1 package CXGN
::BrAPI
::v2
::Plates
;
5 use SGN
::Model
::Cvterm
;
6 use CXGN
::Genotype
::Search
;
8 use CXGN
::BrAPI
::FileResponse
;
9 use CXGN
::BrAPI
::Pagination
;
10 use CXGN
::BrAPI
::JSONResponse
;
12 extends
'CXGN::BrAPI::v2::Common';
17 my $c = $self->context;
18 my $page_size = $self->page_size;
19 my $page = $self->page;
20 my $status = $self->status;
22 my $plates_arrayref = $params->{plateDbId
} || ($params->{plateDbIds
} || ());
23 my $program_id_list = $params->{programDbId
} || ($params->{programDbIds
} || ());
24 my $program_list = $params->{programName
} || ($params->{programNames
} || ());
25 my $trial_name_list = $params->{plateName
} || ($params->{plateNames
} || ());
26 my $folder_id_list = $params->{studyDbId
} || ($params->{studyDbIds
} || ());
27 my $folder_name_list = $params->{studyName
} || ($params->{studyNames
} || ());
29 my $sp_person_id = $c->user() ?
$c->user->get_object()->get_sp_person_id() : undef;
30 my $bcs_schema = $c->dbic_schema('Bio::Chado::Schema', 'sgn_chado', $sp_person_id);
33 if ($plates_arrayref){
34 push @trial_ids, @
{$plates_arrayref};
37 my $trial_search = CXGN
::Trial
::Search
->new({
38 bcs_schema
=>$bcs_schema,
39 trial_design_list
=>['genotyping_plate'],
40 trial_id_list
=> \
@trial_ids,
41 program_list
=> $program_list,
42 program_id_list
=> $program_id_list,
43 trial_name_list
=> $trial_name_list,
44 folder_id_list
=> $folder_id_list,
45 folder_name_list
=> $folder_name_list,
46 # location_list => $location_list,
47 # location_id_list => $location_id_list,
48 # year_list => $year_list,
49 # trial_type_list => $trial_type_list,
50 # trial_design_list => $trial_design_list,
51 # trial_name_is_exact => $trial_name_is_exact,
52 # accession_list => $accession_list,
53 # accession_name_list => $accession_name_list,
54 # trait_list => $trait_list,
57 my ($data, $total_count) = $trial_search->search();
64 externalReferences
=> [],
65 plateBarcode
=> undef,
66 plateFormat
=> $_->{genotyping_plate_format
},
67 plateName
=> $_->{trial_name
},
68 programDbId
=> qq|$_->{breeding_program_id
}|,
69 sampleType
=> $_->{genotyping_plate_sample_type
},
70 studyDbId
=> qq|$_->{trial_id
}|,
71 trialDbId
=> qq|$_->{trial_id
}|,
72 plateDbId
=> qq|$_->{trial_id
}|,
76 my %result = (data
=>\
@data);
78 my $pagination = CXGN
::BrAPI
::Pagination
->pagination_response($total_count,$page_size,$page);
79 return CXGN
::BrAPI
::JSONResponse
->return_success(\
%result, $pagination, \
@data_files, $status, 'Plates result constructed');
85 my $c = $self->context;
86 my $page_size = $self->page_size;
87 my $page = $self->page;
88 my $status = $self->status;
90 my $sp_person_id = $c->user() ?
$c->user->get_object()->get_sp_person_id() : undef;
91 my $bcs_schema = $c->dbic_schema('Bio::Chado::Schema', 'sgn_chado', $sp_person_id);
93 my $trial_search = CXGN
::Trial
::Search
->new({
94 bcs_schema
=>$bcs_schema,
95 trial_design_list
=>['genotyping_plate'],
96 trial_id_list
=> [$plate_id]
99 my ($data, $total_count) = $trial_search->search();
105 additionalInfo
=> {},
106 externalReferences
=> [],
107 plateBarcode
=> undef,
108 plateFormat
=> $_->{genotyping_plate_format
},
109 plateName
=> $_->{trial_name
},
110 programDbId
=> qq|$_->{breeding_program_id
}|,
111 sampleType
=> $_->{genotyping_plate_sample_type
},
112 studyDbId
=> qq|$_->{trial_id
}|,
113 trialDbId
=> qq|$_->{trial_id
}|,
114 plateDbId
=> qq|$_->{trial_id
}|,
119 my $pagination = CXGN
::BrAPI
::Pagination
->pagination_response($total_count,$page_size,$page);
120 return CXGN
::BrAPI
::JSONResponse
->return_success(@data, $pagination, \
@data_files, $status, 'Plates result constructed');