Skip to content

Commit

Permalink
Merge branch 'master' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrego committed Aug 21, 2015
2 parents afc07fe + a1267a2 commit d9413d6
Show file tree
Hide file tree
Showing 8 changed files with 326 additions and 24 deletions.
32 changes: 28 additions & 4 deletions Changes
@@ -1,8 +1,32 @@
{{$NEXT}}
Improved genoverse views
Fixed bug in crispr damage QC view
Added primer generation to crispr import
QC run summary changed to handle similar designs

0.334 2015-08-21 11:32:40 Europe/London
Search crisprs by sequence feature added
Crispr primer validation checks added to public reports

0.333 2015-08-12 14:15:23 Europe/London

Front page report wide view update
Extra methods to check region around primers

0.332 2015-08-10 16:50:10 Europe/London

Het summary update

0.331 2015-08-05 14:26:27 Europe/London

Het summary report added
Vector QC plasmid maps added to result view
Assembly plate QC verified status flag added

0.330 2015-07-30 14:07:01 Europe/London

0.329 2015-07-30 13:30:02 Europe/London

Improved genoverse views
Fixed bug in crispr damage QC view
Added primer generation to crispr import
QC run summary changed to handle similar designs

0.329 2015-07-22 10:45:33 Europe/London

Expand Down
37 changes: 29 additions & 8 deletions lib/LIMS2/WebApp/Controller/PublicReports.pm
Expand Up @@ -5,8 +5,10 @@ use Try::Tiny;
use Data::Printer;
use LIMS2::Model::Util::EngSeqParams qw( generate_well_eng_seq_params );
use LIMS2::Model::Util::CrisprESQCView qw(crispr_damage_type_for_ep_pick);
use LIMS2::Model::Util::Crisprs qw( crisprs_for_design );
use List::MoreUtils qw( uniq );
use namespace::autoclean;
use feature 'switch';

BEGIN { extends 'Catalyst::Controller'; }

Expand Down Expand Up @@ -48,7 +50,7 @@ sub cre_knockin_project_status : Path( '/public_reports/cre_knockin_project_stat
$c->stash(
template => 'publicreports/await_report.tt',
report_name => 'Cre_KnockIn_Project_Status',
report_id => $report_id
report_id => $report_id,
);

return;
Expand Down Expand Up @@ -115,9 +117,6 @@ sub allele_dump : Path( '/public_reports/allele_dump' ) : Args(0) {
return;
}




=head2 index
=cut
Expand Down Expand Up @@ -545,18 +544,31 @@ sub _stash_well_genotyping_info {
}
$data->{child_barcodes} = $well->distributable_child_barcodes;
my @crispr_data;

my @crisprs = $well->parent_crispr_wells;
foreach my $crispr_well ( @crisprs ) {
my $process_crispr = $crispr_well->process_output_wells->first->process->process_crispr;
if ( $process_crispr ) {
my $crispr_data_hash = $process_crispr->crispr->as_hash;

$crispr_data_hash->{crispr_well} = $crispr_well->as_string;
push @crispr_data, $crispr_data_hash;
}
}

$c->stash( data => $data, crispr_data => \@crispr_data );
my @crispr_pair_schema = $c->model('Golgi')->schema->resultset('CrisprPair')->search({ left_crispr_id => $crispr_data[0]->{id}})->all;
my $crispr_pair = $c->model('Golgi')->retrieve_crispr_pair( { id => $crispr_pair_schema[0]->{_column_data}->{id} } );
$crispr_pair = $crispr_pair->as_hash;

my $crispr_primers = $data->{primers}->{crispr_primers};
my $match;
foreach my $set (values %$crispr_primers)
{
foreach my $primer(@$set){
$match = search_primers($primer->{seq}, $crispr_pair->{crispr_primers});
$primer->{is_validated} = $match->{is_validated};
$primer->{is_rejected} = $match->{is_rejected};
}
}
$c->stash( data => $data, crispr_data => \@crispr_data);
}
catch {
#get string representation if its a lims2::exception
Expand All @@ -565,7 +577,16 @@ sub _stash_well_genotyping_info {

return;
}

sub search_primers {
my ($seq, $validation_primers) = @_;
foreach my $valid_primer(@$validation_primers)
{
if ($seq eq $valid_primer->{primer_seq}){
return $valid_primer;
}
}
return;
}
=head2 public_gene_report
Public gene report, only show targeted clone details:
Expand Down
51 changes: 46 additions & 5 deletions lib/LIMS2/WebApp/Controller/User/Crisprs.pm
Expand Up @@ -49,7 +49,6 @@ sub search_crisprs : Path( '/user/search_crisprs' ) : Args(0) {
$c->stash->{$item} = $value;
}
}

my $crispr_entity;
if($c->req->param('search_by_lims2_id')){
my $params = {
Expand All @@ -74,7 +73,9 @@ sub search_crisprs : Path( '/user/search_crisprs' ) : Args(0) {
$c->stash->{error_msg} = "Failed to find WGE crispr in LIMS2: $e";
}
}

elsif($c->req->param('search_by_sequence')){
sequence_search($self, $c);
}
if($crispr_entity){
my $redirect_path = _path_for_crispr_entity($crispr_entity);
$c->res->redirect( $c->uri_for($redirect_path) );
Expand Down Expand Up @@ -235,7 +236,6 @@ sub crispr_ucsc_blat : PathPart('blat') Chained('crispr') : Args(0) {
=cut
sub crispr_pair : PathPart('user/crispr_pair') Chained('/') CaptureArgs(1) {
my ( $self, $c, $crispr_pair_id ) = @_;

$c->assert_user_roles( 'read' );

my $species_id = $c->request->param('species') || $c->session->{selected_species};
Expand Down Expand Up @@ -276,7 +276,6 @@ sub crispr_pair : PathPart('user/crispr_pair') Chained('/') CaptureArgs(1) {
=cut
sub view_crispr_pair : PathPart('view') Chained('crispr_pair') Args(0) {
my ( $self, $c ) = @_;

my $crispr_pair = $c->stash->{cp};
my $off_target_summary = Load( $crispr_pair->off_target_summary );
my $cp_data = $crispr_pair->as_hash;
Expand Down Expand Up @@ -463,7 +462,6 @@ sub wge_crispr_importer :Path( '/user/wge_crispr_importer' ) : Args(0) {
$c->stash( success_msg => "Successfully imported the following WGE ids:\n"
. join ', ', map { $_->{wge_id} } @output );
}

$c->stash(
crispr => \@output,
);
Expand Down Expand Up @@ -693,6 +691,49 @@ sub generate_on_import {
return;
}

sub sequence_search {
my ($self, $c) = @_;
my $sequence = $c->req->param('sequence');
$sequence = uc $sequence;
my $count = length($sequence);
if ( $count > 23) {
$c->stash->{info_msg} = "Please provide 23 or less base sequence, you provided ". $count;
return;
}
elsif ( $sequence =~ qr/^[ACTG]+$/ ){
my $species = $c->session->{selected_species};

my @crisprs = $c->model('Golgi')->schema->resultset('Crispr')->search({
seq => {'like', "%".$sequence."%"},
species_id => $species,
},
{
distinct => 1,
columns => [qw/
id
seq
species_id
/],
}
);
if (@crisprs){
$c->stash(
crispr => \@crisprs,
original => $sequence,
);
}
else {
$c->stash->{info_msg} = "No crispr were found with the sequence pattern: ". $sequence;
}
return
}
else {
$c->stash->{info_msg} = "Not a valid sequence, please check for invalid bases.";
return;
}

}

__PACKAGE__->meta->make_immutable;

1;
2 changes: 1 addition & 1 deletion root/lib/navigation.tt
Expand Up @@ -82,7 +82,7 @@
</li>
<li class="divider"></li>
<li>
<a href="[% c.uri_for( '/user/search_crisprs' ) %]">Find Crisprs by ID</a>
<a href="[% c.uri_for( '/user/search_crisprs' ) %]">Find Crisprs</a>
</li>
</ul>
</li>
Expand Down
29 changes: 29 additions & 0 deletions root/site/publicreports/well_genotyping_info.tt
Expand Up @@ -205,6 +205,10 @@
<tr>
<th>[% primer.name %]</th>
<td class="alignment">[% primer.seq %]</td>
<td class="validation-state-cell"
data-validated="[% primer.is_validated %]"
data-rejected="[% primer.is_rejected %]"
</td>
</tr>
[% END %]
[% END %]
Expand Down Expand Up @@ -266,3 +270,28 @@
</div>

<br/>

<script language="javascript" type="text/javascript" src="[% c.uri_for( '/static/js/primer_validation_state.js' ) %]"></script>
<script type="text/javascript">
var valid_label = '<span class="label label-success validation-status pull-right">Validated</span>';
var not_valid_label = '<span class="label label-default validation-status pull-right">Not Validated</span>';
var rejected_label = '<span class="label label-important pull-right">Rejected</span>';



$(document).ready(function() {
$(".validation-state-cell").each(function(){
if($(this).data('rejected')){
$(this).append(rejected_label);
}
else{
if($(this).data('validated')){
$(this).append(valid_label);
}
else{
$(this).append(not_valid_label);
}
}
});
})
</script>

0 comments on commit d9413d6

Please sign in to comment.