Skip to content

Commit

Permalink
David's last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dparrysmith committed Jun 1, 2015
1 parent 8a71351 commit 3835032
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/LIMS2/Model/Plugin/AssemblyWellQc.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package LIMS2::Model::Plugin::AssemblyWellQc;

use strict;
use warnings FATAL => 'all';
use Moose::Role;
use Hash::MoreUtils qw( slice_def );
use Try::Tiny;

requires qw( schema check_params throw retrieve log trace );

=head
A Catalyst plugin that provides methods for updating well_assembly_qc values
=cut



1;

__END__
8 changes: 8 additions & 0 deletions lib/LIMS2/Report/AssemblyPlate.pm
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ override _build_columns => sub {
return [
'Well Name', 'Design ID', 'Gene ID', 'Gene Symbol', 'Gene Sponsors',
'Crispr ID', 'Crispr Design', 'Genoverse View', 'Genbank File',
'Crispr Left QC', 'Crispr Right QC', 'Vector QC',
'Cassette', 'Cassette Resistance', 'Cassette Type', 'Backbone', #'Recombinases',
'Crispr Vector Well(s)', 'Final Pick Well',
'DNA Quality EGel Pass?','Sequencing QC Pass',
Expand Down Expand Up @@ -154,6 +155,7 @@ override iterator => sub {
my $crispr_primers = $self->get_primers( $crispr, $genotyping_primers->{ $well_data->{design_id} } );
my @crispr_vectors = map{ $_->{plate_name} . '_' . $_->{well_name} } @{ $well_data->{crispr_wells}{crispr_vectors} };
my ( $genoverse_button, $crispr_designs );
my ( $crispr_left_qc_combo, $crispr_right_qc_combo, $vector_qc_combo );
if ( $crispr ) {
$genoverse_button = $self->create_button_json(
{ 'design_id' => $well_data->{design_id},
Expand All @@ -169,6 +171,9 @@ override iterator => sub {
}
);
$crispr_designs = join( "/", map{ $_->design_id } $crispr->crispr_designs->all );
$crispr_left_qc_combo = $self->create_combo_json();
$crispr_right_qc_combo = $self->create_combo_json();
$vector_qc_combo = $self->create_combo_json();
}

# build string reporting individual crispr details
Expand All @@ -191,6 +196,9 @@ override iterator => sub {
$crispr_designs,
$genoverse_button,
$self->catalyst ? $self->catalyst->uri_for( '/public_reports/well_eng_seq', $well_data->{well_id} ) : '-',
$crispr_left_qc_combo,
$crispr_right_qc_combo,
$vector_qc_combo,
$well_data->{cassette},
$well_data->{cassette_resistance},
$well_data->{cassette_promoter},
Expand Down
8 changes: 8 additions & 0 deletions lib/LIMS2/ReportGenerator/Plate.pm
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,14 @@ sub create_button_json {
return $json_text;
}

sub create_combo_json {
my $self = shift;
my $params = shift;

my $json_text = 'Placeholder text';
return $json_text;
}

sub well_primer_bands_data {
my ( $self, $well ) = @_;

Expand Down
76 changes: 76 additions & 0 deletions lib/LIMS2/WebApp/Controller/API/AssemblyQc.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package LIMS2::WebApp::Controller::API::AssemblyQc;
use Moose;
use namespace::autoclean;
use Try::Tiny;

BEGIN {extends 'LIMS2::Catalyst::Controller::REST'; }

=head1 NAME
LIMS2::WebApp::Controller::API::AssemblyQc - Catalyst Controller
=head1 DESCRIPTION
API methods dealing with assembly well qc
=cut

sub update_assembly_qc_well :Path('/api/update_qc_well') :Args(0) :ActionClass('REST') {
}

sub update_assembly_qc_well_POST {
my ( $self, $c ) = @_;

$c->assert_user_roles('edit');

try{
my $qc_well = $c->model('Golgi')->txn_do(
sub {
shift->update_assembly_qc_well( $c->request->params );
}
);
$self->status_ok( $c, entity => { success => 1 } );
}
catch {
$c->log->error( "Error updating assembly qc well value: $_" );
$self->status_bad_request( $c, message => "Error: $_" );
};

return
}

sub crispr_es_qc_run : Path( '/api/crispr_es_qc_run' ) : Args(0) :ActionClass( 'REST' ) {
}

=head2 GET /api/crispr_es_qc_run
Retrieve a crispr es qc run by id
=cut

sub crispr_es_qc_run_GET {
my ( $self, $c ) = @_;

$c->assert_user_roles('read');

my $crispr_es_qc_run = $c->model( 'Golgi' )->txn_do(
sub {
shift->retrieve_crispr_es_qc_run( { id => $c->request->param( 'id' ) } );
}
);

return $self->status_ok( $c, entity => $crispr_es_qc_run );
}

=head2 POST
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut

__PACKAGE__->meta->make_immutable;

1;
39 changes: 39 additions & 0 deletions root/site/user/report/generic_report_grid.tt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,35 @@
"id" = 1
"well id" = 1
} %]

var assembly_qc_store = Ext.create('Ext.data.store',{
fields: ['call_type'],
data: [
{"call_type":"-"}
[%- FOREACH call_type IN call_types %]
,{"call_type":"[% call_type %]"}
[%- END %]
]
});

var assembly_qc_combo = Ext.create('Ext.form.ComboBox', {
typeAhead: true,
triggerAction: 'all',
editable: true,
store: assembly_qc_store,
displayField: 'assembly_qc',
listeners: {
change: function (field, newValue, oldValue) {
console.log('assembly qc listener');
var record = grid.getSelectionMode().getSelection()[0];

console.log("Updating " + record.data.id + " with value " + field.getValue());
var newRecord = field.findRecordByValue(newValue);

$.getJSON( "[% c.iri_for('/api/assembly_well_qc') %]", {id:record.data.id, assembly_qc:field.getValue()}, function(){record.commit();});
}
}
});

var recovery_class_store = Ext.create('Ext.data.Store',{
fields: ['recovery_class'],
Expand Down Expand Up @@ -225,6 +254,16 @@
}
},
[%- END %]

[%- IF col.match( 'Crispr_.*_qc' ) %]
width: 120,
editor: assembly_qc_combo,
[%- END %]

[%- IF col.match( 'Vector_qc') %]
width: 120,
editor: assembly_qc_combo,
[%- END %]


dataIndex: '[%- col %]'
Expand Down

0 comments on commit 3835032

Please sign in to comment.