Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'devel' of github.com:htgt/LIMS2-WebApp into copy_plate

Conflicts:
	lib/LIMS2/WebApp/Controller/User/PlateCopy.pm
  • Loading branch information...
commit 96622b1548267a240eaaa446cc8cf470c2b4e6ab 2 parents e8f54ef + f87159b
@dparrysmith dparrysmith authored
View
8 Changes
@@ -1,5 +1,13 @@
{{$NEXT}}
+0.056 2013-03-11 16:08:02 Europe/London
+
+ Releasing Copy Plate, Genotyping and Final Pick functionality
+
+0.055 2013-03-04 12:02:22 Europe/London
+
+ Amended GenotypingQc upload and automated the appending of the dre recombination to cre wells based on Puro pass.
+
0.054 2013-02-28 10:45:42 Europe/London
Added DesignVectors report
View
5 ddl/templates/versions/25/fixtures.sql
@@ -0,0 +1,5 @@
+INSERT INTO schema_versions(version)
+VALUES (25);
+
+INSERT INTO process_types ( id, description )
+VALUES( 'legacy_gateway', 'Legacy gateway process from HTGT' );
View
1  ddl/templates/versions/25/up.sql
@@ -0,0 +1 @@
+ALTER TABLE designs ALTER COLUMN phase DROP NOT NULL;
View
5 lib/LIMS2/Model/Constants.pm
@@ -26,6 +26,7 @@ const our %PROCESS_PLATE_TYPES => (
cre_bac_recom => [qw( INT )],
'2w_gateway' => [qw( POSTINT FINAL )],
'3w_gateway' => [qw( POSTINT FINAL )],
+ legacy_gateway => [qw( FINAL_PICK )],
final_pick => [qw( FINAL_PICK )],
dna_prep => [qw( DNA )],
recombinase => [qw( FINAL XEP POSTINT )],
@@ -76,6 +77,10 @@ const our %PROCESS_INPUT_WELL_CHECK => (
type => [qw( INT )],
number => 1,
},
+ legacy_gateway => {
+ type => [qw( INT )],
+ number => 1,
+ },
final_pick => {
type => [qw( FINAL FINAL_PICK )],
number => 1,
View
2  lib/LIMS2/Model/Plugin/Design.pm
@@ -45,7 +45,7 @@ sub pspec_create_design {
type => { validate => 'existing_design_type', rename => 'design_type_id' },
created_at => { validate => 'date_time', post_filter => 'parse_date_time', optional => 1 },
created_by => { validate => 'existing_user', post_filter => 'user_id_for' },
- phase => { validate => 'phase' },
+ phase => { validate => 'phase', optional => 1 },
validated_by_annotation => { validate => 'validated_by_annotation', default => 'not done' },
name => { validate => 'alphanumeric_string', optional => 1 },
target_transcript => { optional => 1, validate => 'ensembl_transcript_id' },
View
83 lib/LIMS2/Model/Plugin/GenotypingQC.pm
@@ -399,6 +399,21 @@ my $saved_id = -1;
my $datum;
my $gene_cache;
+# Extract the well_ids from $sql_result and send them to create_well_cache to generate
+# a cache of well objects as a hashref. Squeeze out the duplicates along the way.
+my @well_id_list;
+my %seen;
+foreach my $row ( @{$sql_result} ) {
+ my $well_id = $row->{'Well ID'};
+ if ( !$seen{$well_id} ) {
+ push @well_id_list, $well_id;
+ $seen{$well_id} = 1;
+ }
+}
+
+my $design_well_cache = $self->create_design_well_cache( \@well_id_list );
+
+
$self->log->debug ('SQL query brought back ' . @{$sql_result} . ' rows.' );
foreach my $row ( @{$sql_result} ) {
if ( $row->{'Well ID'} != $saved_id ) {
@@ -423,20 +438,24 @@ foreach my $row ( @{$sql_result} ) {
$datum->{$row->{'Primer band type'}} = ($row->{'Primer pass?'} ? 'true' : 'false') // '-' ;
}
- my $well = $self->retrieve_well( { id => $datum->{id} } );
- my ($design) = $well->designs;
+ # simply lookup the source well id in the design_well_cache
+ my $design_well = $design_well_cache->{$datum->{'id'}}->{'design_well_ref'};
+ my $design = $design_well_cache->{$datum->{'id'}}->{'design_ref'};
$datum->{gene_id} = '-';
$datum->{gene_id} = $design->genes->first->gene_id if $design;
+ $datum->{gene_name} = '-';
# If we have already seen this gene_id don't go searching for it again
if ( $gene_cache->{$datum->{gene_id} } ) {
$datum->{gene_name} = $gene_cache->{ $datum->{gene_id} };
}
else {
- $datum->{gene_name} = $self->get_gene_symbol_for_accession( $well, $species);
- $gene_cache->{$datum->{gene_id}} = $datum->{gene_name};
+ if ( $design_well ) {
+ $datum->{gene_name} = $self->get_gene_symbol_for_accession( $design_well, $species);
+ $gene_cache->{$datum->{gene_id}} = $datum->{gene_name};
+ }
}
$datum->{design_id} = '-';
- $datum->{design_id} = $design->id if $design;
+ $datum->{design_id} = $design_well->id if $design_well;
# get the generic assay data for this row
if ( $row->{'genotyping_result_type_id'}) {
$datum->{$row->{'genotyping_result_type_id'} . '#' . 'call'} = $row->{'call'} // '-';
@@ -478,14 +497,14 @@ sub pspec_get_gene_symbol_for_accession {
# This will return a '/' separated list of symbols for a given accession and species.
# TODO: send in a list of accessions and return a list of gene symbols thus mimimising the overhead of calls to search_genes.
sub get_gene_symbol_for_accession{
- my ($self, $well, $species, $params) = @_;
+ my ($self, $design_well, $species, $params) = @_;
my $genes;
my $gene_symbols;
my @gene_symbols;
- my ($design) = $well->designs;
- if ( $design) {
+ my ($design) = $design_well->designs;
+ if ( $design ) {
my @gene_ids = uniq map { $_->gene_id } $design->genes;
foreach my $gene_id ( @gene_ids ) {
$genes = $self->search_genes(
@@ -497,4 +516,52 @@ sub get_gene_symbol_for_accession{
return $gene_symbols;
}
+
+# We need a design well cache so that we can call methods on the design well itself
+#
+sub create_design_well_cache {
+ my $self = shift;
+ my $well_id_list_ref = shift;
+
+ # Use a ProcessTree method to get the list of design wells.
+ my $design_well_hash = $self->get_design_wells_for_well_id_list( $well_id_list_ref );
+
+ # create a list of wells to fetch
+ # also keep a record of design_id => source_well_id for later use
+ my @design_well_id_list;
+ my %seen;
+ foreach my $well_id ( keys %{$design_well_hash} ) {
+ my $design_well_id = $design_well_hash->{$well_id}->{'design_well_id'};
+ if ( !$seen{$design_well_id} ) {
+ push @design_well_id_list, $design_well_id;
+ $seen{$design_well_id} = 1;
+ }
+ }
+ my $design_well_rs = $self->schema->resultset( 'Well' );
+ my @design_wells = $design_well_rs->search(
+ {
+ 'me.id' => { '-in' => \@design_well_id_list }
+ },
+ );
+ # Get the designs for each design well and cache them ...
+ my $designs_hash_ref;
+
+ foreach my $design_well ( @design_wells ) {
+ ($designs_hash_ref->{$design_well->id}) = $design_well->designs;
+ }
+
+ # save a reference to the design well in the appropriate key/value
+ foreach my $well_id ( keys %{$design_well_hash} ) {
+ # match up the design_well_id
+ my $design_well_id = $design_well_hash->{$well_id}->{'design_well_id'};
+ MATCH_DESIGN_WELL: foreach my $design_well ( @design_wells ) {
+ if ( $design_well->id == $design_well_id ) {
+ $design_well_hash->{$well_id}->{'design_well_ref'} = $design_well;
+ $design_well_hash->{$well_id}->{'design_ref'} = $designs_hash_ref->{$design_well->id};
+ last MATCH_DESIGN_WELL;
+ }
+ }
+ }
+ return $design_well_hash;
+}
1;
View
2  lib/LIMS2/Model/Plugin/Plate.pm
@@ -325,7 +325,7 @@ sub plate_help_info {
my %plate_info;
for my $process ( keys %PROCESS_PLATE_TYPES ) {
- next if $process eq 'create_di';
+ next if $process =~ /create_di|legacy_gateway/;
$plate_info{$process}{plate_types} = $PROCESS_PLATE_TYPES{$process};
$plate_info{$process}{data}
= exists $PROCESS_SPECIFIC_FIELDS{$process} ? $PROCESS_SPECIFIC_FIELDS{$process} : [];
View
148 lib/LIMS2/Model/Plugin/ProcessTree.pm
@@ -93,7 +93,7 @@ WHERE w.process_id = pd.process_id
GROUP BY w.process_id, w.input_well_id, w.output_well_id, pd.design_id,"original_well", w.path;
QUERY_END
-my $QUERY_ANCESTORS_BY_WELL_ID = << 'QUERY_END';
+my $QUERY_ANCESTORS_BY_WELL_ID_WITH_PATHS = << 'QUERY_END';
WITH RECURSIVE well_hierarchy(process_id, input_well_id, output_well_id, path) AS (
-- Non-recursive term
SELECT pr.id, pr_in.well_id, pr_out.well_id, ARRAY[pr_out.well_id]
@@ -116,6 +116,29 @@ WHERE w.process_id = pd.process_id
GROUP BY w.process_id, w.input_well_id, w.output_well_id, pd.design_id,"original_well", w.path;
QUERY_END
+my $QUERY_ANCESTORS_BY_WELL_ID = << 'QUERY_END';
+WITH RECURSIVE well_hierarchy(process_id, input_well_id, output_well_id, path) AS (
+-- Non-recursive term
+ SELECT pr.id, pr_in.well_id, pr_out.well_id, ARRAY[pr_out.well_id]
+ FROM processes pr
+ LEFT OUTER JOIN process_input_well pr_in ON pr_in.process_id = pr.id
+ JOIN process_output_well pr_out ON pr_out.process_id = pr.id
+ WHERE pr_out.well_id = ?
+ UNION ALL
+-- Recursive term
+ SELECT pr.id, pr_in.well_id, pr_out.well_id, path || pr_out.well_id
+ FROM processes pr
+ LEFT OUTER JOIN process_input_well pr_in ON pr_in.process_id = pr.id
+ JOIN process_output_well pr_out ON pr_out.process_id = pr.id
+ JOIN well_hierarchy ON well_hierarchy.input_well_id = pr_out.well_id
+)
+SELECT w.output_well_id, pd.design_id, w.path[1] "original_well"
+FROM well_hierarchy w, process_design pd
+WHERE w.process_id = pd.process_id
+--ORDER BY pd.design_id;
+GROUP BY w.output_well_id, pd.design_id, "original_well";
+QUERY_END
+
sub pspec_paths_for_well_id_depth_first {
return {
well_id => { validate => 'integer', },
@@ -123,6 +146,11 @@ sub pspec_paths_for_well_id_depth_first {
};
}
+=heading1 get_paths_for_well_id_depth_first
+
+returns paths as well_ids
+=cut
+
sub get_paths_for_well_id_depth_first {
my $self = shift;
my ($params) = @_;
@@ -153,14 +181,124 @@ sub get_paths_for_well_id_depth_first {
return \@paths;
}
-sub pspec_designs_for_plate {
+=heading1 get_well_paths_for_well_id
+
+Returns well objects.
+=cut
+
+#TODO:
+=head
+ my $rs = $self->schema->resultset( 'Well' )->search(
+ {
+ 'me.id' => { '-in' => \@well_ids }
+ },
+ {
+ prefetch => [ 'plate' ]
+ }
+ );
+=cut
+
+sub pspec_design_wells_for_well_id {
return {
- plate_name =>{ validate => 'string', },
- direction => { validate => 'boolean', optional=> 1 },
+ well_id => { validate => 'integer', },
};
}
-sub get_designs_for_plate {
+=heading1 get_design_wells_for_well_id
+
+=cut
+
+sub get_design_wells_for_well_id {
+ my $self = shift;
+ my ($params) = @_;
+
+ my $validated_params = $self->check_params( $params, $self->pspec_design_wells_for_well_id);
+
+ my $sql_query = $QUERY_ANCESTORS_BY_WELL_ID;
+ my $sql_result = $self->schema->storage->dbh_do(
+ sub {
+ my ( $storage, $dbh ) = @_;
+ my $sth = $dbh->prepare_cached( $sql_query );
+ $sth->execute( $validated_params->{'well_id'} );
+ $sth->fetchall_arrayref();
+ }
+ );
+ my $result_hash;
+
+ foreach my $result ( @{$sql_result} ) {
+ $result_hash->{$result->[2]} = {
+ 'design_well_id' => $result->[0],
+ 'design_id' => $result->[1],
+ }
+ }
+
+ return $result_hash;
+}
+
+
+sub pspec_design_wells_for_well_id_list {
+ return {
+ 'wells' ,
+ };
+}
+
+sub get_design_wells_for_well_id_list {
+ my $self = shift;
+ my $wells = shift;
+# my ($params) = @_;
+
+# my $validated_params = $self->check_params( $params, $self->pspec_design_wells_for_well_id_list);
+
+ my $well_list = join q{,}, @{$wells};
+
+my $QUERY_ANCESTORS_BY_WELL_LIST = << "QUERY_END";
+WITH RECURSIVE well_hierarchy(process_id, input_well_id, output_well_id, path) AS (
+-- Non-recursive term
+ SELECT pr.id, pr_in.well_id, pr_out.well_id, ARRAY[pr_out.well_id]
+ FROM processes pr
+ LEFT OUTER JOIN process_input_well pr_in ON pr_in.process_id = pr.id
+ JOIN process_output_well pr_out ON pr_out.process_id = pr.id
+ WHERE pr_out.well_id IN (
+ $well_list
+ )
+ UNION ALL
+-- Recursive term
+ SELECT pr.id, pr_in.well_id, pr_out.well_id, path || pr_out.well_id
+ FROM processes pr
+ LEFT OUTER JOIN process_input_well pr_in ON pr_in.process_id = pr.id
+ JOIN process_output_well pr_out ON pr_out.process_id = pr.id
+ JOIN well_hierarchy ON well_hierarchy.input_well_id = pr_out.well_id
+)
+SELECT w.output_well_id, pd.design_id, w.path[1] "original_well"
+FROM well_hierarchy w, process_design pd
+WHERE w.process_id = pd.process_id
+--ORDER BY pd.design_id;
+GROUP BY w.output_well_id, pd.design_id,"original_well";
+QUERY_END
+
+ my $sql_query = $QUERY_ANCESTORS_BY_WELL_LIST;
+ my $sql_result = $self->schema->storage->dbh_do(
+ sub {
+ my ( $storage, $dbh ) = @_;
+ my $sth = $dbh->prepare_cached( $sql_query );
+ $sth->execute();
+ $sth->fetchall_arrayref();
+ }
+ );
+
+ my $result_hash;
+
+ foreach my $result ( @{$sql_result} ) {
+ $result_hash->{$result->[2]} = {
+ 'design_well_id' => $result->[0],
+ 'design_id' => $result->[1],
+ }
+ }
+ # The format of the resulting hash is:
+ # well_id => {
+ # design_well_id => integer_id,
+ # design_id => integer_id }
+ return $result_hash;
}
1;
View
24 lib/LIMS2/Model/Plugin/QC.pm
@@ -784,6 +784,7 @@ sub list_templates {
return ( [ $resultset->all ], $resultset->pager );
}
+# acs 11/03/13 - added optional process type for use with type FINAL_PICK
sub pspec_create_plates_from_qc{
return {
qc_run_id => { validate => 'uuid' },
@@ -791,6 +792,7 @@ sub pspec_create_plates_from_qc{
created_by => { validate => 'existing_user' },
rename_plate => { validate => 'hashref', optional => 1 },
view_uri => { validate => 'absolute_url' },
+ process_type => { validate => 'existing_process_type', optional => 1 },
};
}
@@ -819,7 +821,7 @@ sub create_plates_from_qc{
$new_name = ($rename and $rename->{$old_name}) ? $rename->{$old_name}
: $old_name;
- my $plate = $self->create_plate_from_qc({
+ my $plate_from_qc = {
plate_name => $new_name,
orig_name => $old_name,
results_by_well => \%results_by_well,
@@ -828,14 +830,21 @@ sub create_plates_from_qc{
created_by => $validated_params->{created_by},
view_uri => $validated_params->{view_uri},
qc_run_id => $validated_params->{qc_run_id},
- },
- );
+ };
+
+ # acs 11/03/13 - if plate type is Final_Pick add process type to final_pick
+ if($plate_from_qc->{'plate_type'} eq 'FINAL_PICK') {
+ $plate_from_qc->{'process_type'} = $validated_params->{process_type};
+ }
+
+ my $plate = $self->create_plate_from_qc($plate_from_qc,);
push @created_plates, $plate;
}
return @created_plates;
}
+# acs 11/03/13 - added optional process type for use with type FINAL_PICK
sub pspec_create_plate_from_qc{
return {
plate_name => { validate => 'non_empty_string' },
@@ -846,6 +855,7 @@ sub pspec_create_plate_from_qc{
created_by => { validate => 'existing_user'},
view_uri => { validate => 'absolute_url'},
qc_run_id => { validate => 'uuid'},
+ process_type => { validate => 'existing_process_type', optional => 1 },
};
}
@@ -904,7 +914,13 @@ sub create_plate_from_qc{
$well_params{recombinase} = [ map { $_->recombinase_id } @recombinases ];
}
- $well_params{process_type} = infer_qc_process_type(\%well_params);
+ # If process_type has been passed in, use it, otherwise infer it
+ if (exists $params->{process_type}) {
+ $well_params{process_type} = $params->{process_type};
+ }
+ else {
+ $well_params{process_type} = infer_qc_process_type(\%well_params);
+ }
push @new_wells, \%well_params;
}
View
46 lib/LIMS2/Model/Util/CreateProcess.pm
@@ -127,6 +127,7 @@ my %process_check_well = (
int_recom => \&_check_wells_int_recom,
'2w_gateway' => \&_check_wells_2w_gateway,
'3w_gateway' => \&_check_wells_3w_gateway,
+ legacy_gateway => \&_check_wells_legacy_gateway,
final_pick => \&_check_wells_final_pick,
recombinase => \&_check_wells_recombinase,
cre_bac_recom => \&_check_wells_cre_bac_recom,
@@ -251,6 +252,16 @@ sub _check_wells_3w_gateway {
## use critic
## no critic(Subroutines::ProhibitUnusedPrivateSubroutine)
+sub _check_wells_legacy_gateway {
+ my ( $model, $process ) = @_;
+
+ check_input_wells( $model, $process);
+ check_output_wells( $model, $process);
+ return;
+}
+## use critic
+
+## no critic(Subroutines::ProhibitUnusedPrivateSubroutine)
sub _check_wells_final_pick {
my ( $model, $process ) = @_;
@@ -384,6 +395,7 @@ my %process_aux_data = (
int_recom => \&_create_process_aux_data_int_recom,
'2w_gateway' => \&_create_process_aux_data_2w_gateway,
'3w_gateway' => \&_create_process_aux_data_3w_gateway,
+ legacy_gateway => \&_create_process_aux_data_legacy_gateway,
final_pick => \&_create_process_aux_data_final_pick,
recombinase => \&create_process_aux_data_recombinase,
cre_bac_recom => \&_create_process_aux_data_cre_bac_recom,
@@ -538,6 +550,40 @@ sub _create_process_aux_data_3w_gateway {
}
## use critic
+sub pspec__create_process_aux_data_legacy_gateway {
+ return {
+ cassette => { validate => 'existing_final_cassette', optional => 1 },
+ backbone => { validate => 'existing_backbone', optional => 1 },
+ recombinase => { optional => 1 },
+ REQUIRE_SOME => { cassette_or_backbone => [ 1, qw( cassette backbone ) ], },
+ };
+}
+
+## no critic(Subroutines::ProhibitUnusedPrivateSubroutine)
+# legacy_gateway is like a gateway process but goes from INT to FINAL_PICK
+# also it can have eith cassette or backbone, or both
+sub _create_process_aux_data_legacy_gateway {
+ my ( $model, $params, $process ) = @_;
+
+ my $validated_params
+ = $model->check_params( $params, pspec__create_process_aux_data_legacy_gateway );
+
+ $process->create_related( process_cassette =>
+ { cassette_id => _cassette_id_for( $model, $validated_params->{cassette} ) } )
+ if $validated_params->{cassette};
+ $process->create_related( process_backbone =>
+ { backbone_id => _backbone_id_for( $model, $validated_params->{backbone} ) } )
+ if $validated_params->{backbone};
+
+ if ( $validated_params->{recombinase} ) {
+ create_process_aux_data_recombinase( $model,
+ { recombinase => $validated_params->{recombinase} }, $process );
+ }
+
+ return;
+}
+## use critic
+
sub pspec_create_process_aux_data_recombinase {
return { recombinase => { validate => 'existing_recombinase' }, };
}
View
4 lib/LIMS2/WebApp/Controller/User/PlateUpload.pm
@@ -27,10 +27,10 @@ sub begin :Private {
sub plate_upload_step1 :Path( '/user/plate_upload_step1' ) :Args(0) {
my ( $self, $c ) = @_;
- my @process_types = map{ $_->id } @{ $c->model('Golgi')->list_process_types };
+ my @process_types = map { $_->id } @{ $c->model('Golgi')->list_process_types };
$c->stash(
- process_types => [ grep{ !/create_di/ } @process_types ],
+ process_types => [ grep{ !/create_di|legacy_gateway/ } @process_types ],
plate_help => $c->model('Golgi')->plate_help_info,
);
return;
View
21 lib/LIMS2/WebApp/Controller/User/QC.pm
@@ -565,18 +565,25 @@ sub create_plates :Path('/user/create_plates') :Args(0){
# if creation of any individual plate fails
my @new_plates;
+ my $plate_from_qc = {
+ qc_run_id => $run_id,
+ plate_type => $c->req->param('plate_type'),
+ rename_plate => $rename_plate,
+ created_by => $c->user->name,
+ view_uri => $c->uri_for("/user/view_qc_result"),
+ };
+
+ # acs 11/03/13 - if plate type is Final_Pick add process type to final_pick
+ if($plate_from_qc->{'plate_type'} eq 'FINAL_PICK') {
+ $plate_from_qc->{'process_type'} = 'final_pick';
+ }
+
$c->model('Golgi')->txn_do(
sub{
try{
# The view_uri is needed to create path to results view
# which is entered in the well_qc_sequencing_result
- @new_plates = $c->model('Golgi')->create_plates_from_qc({
- qc_run_id => $run_id,
- plate_type => $c->req->param('plate_type'),
- rename_plate => $rename_plate,
- created_by => $c->user->name,
- view_uri => $c->uri_for("/user/view_qc_result"),
- });
+ @new_plates = $c->model('Golgi')->create_plates_from_qc($plate_from_qc);
}
catch{
$c->stash->{error_msg} = "Plate creation failed with error: $_";
View
12 root/site/user/welldata/show_genotyping_qc_data.tt
@@ -8,8 +8,18 @@
<div class="span6 offset3" align="center">
<form method="GET" action="[% c.uri_for( '/user/genotyping_qc_data' ) %]" class="form well">
<label>Plate Name</label>
- <input type="text" name="plate_name" placeholder="Plate Name" value="[% plate_name %]">
+ <input type="text" id="plate_name" name="plate_name" placeholder="Plate Name" value="[% plate_name %]" autocomplete="off">
<br/>
<button name="search" id="search" type="submit" value="search" class="btn"><i class="icon-list-alt"></i>Search</button>
</form>
</div>
+
+<script type="text/javascript">
+
+$("#plate_name").autocomplete({
+ source: "[% c.uri_for( '/api/autocomplete/plate_names' ) %]",
+ minLength: 2,
+});
+
+</script>
+
View
51 t/50-model-plugin-process.t
@@ -22,6 +22,7 @@ note("Testing process types and fields creation");
int_recom
2w_gateway
3w_gateway
+ legacy_gateway
final_pick
rearray
dna_prep
@@ -185,6 +186,56 @@ throws_ok {
my $process = model->create_process( $process_data_2w_gateway->{invalid_output_well} );
} qr/2w_gateway process output well should be type (FINAL|,|POSTINT)+ \(got DESIGN\)/;
+##
+
+note( "Testing legacy_gateway process creation" );
+my $process_data_legacy_gateway= test_data( 'legacy_gateway_process.yaml' );
+
+{
+ ok my $process = model->create_process( $process_data_legacy_gateway->{valid_input} ),
+ 'create_process for type legacy_gateway should succeed';
+ isa_ok $process, 'LIMS2::Model::Schema::Result::Process';
+ is $process->type->id, 'legacy_gateway',
+ 'process is of correct type';
+
+ ok my $process_cassette = $process->process_cassette, 'process has a process_cassette';
+ is $process_cassette->cassette->name, 'L1L2_Bact_P', 'process_cassette has correct cassette';
+
+ ok my $process_backbone = $process->process_backbone, 'process has a process_backbone';
+ is $process_backbone->backbone->name, 'L3L4_pZero_kan', 'process_backbone has correct backbone';
+
+ ok my $input_wells = $process->input_wells, 'process can return input wells resultset';
+ is $input_wells->count, 1, 'only one input well';
+ my $input_well = $input_wells->next;
+ is $input_well->name, 'G02', 'input well has correct name';
+ is $input_well->plate->name, 'PCS00177_A', '..and is on correct plate';
+
+ ok my $output_wells = $process->output_wells, 'process can return output wells resultset';
+ is $output_wells->count, 1, 'only one output well';
+ my $output_well = $output_wells->next;
+ is $output_well->name, 'A01', 'output well has correct name';
+ is $output_well->plate->name, 'FP1008', '..and is on correct plate';
+
+ ok my $process_recombinases = $process->process_recombinases, 'process has process_recombinases';
+ is $process_recombinases->count, 1, 'has 1 recombinase';
+ is $process_recombinases->next->recombinase->id, 'Cre', 'is Cre recombinase';
+
+ lives_ok { model->delete_process( { id => $process->id } ) } 'can delete process';
+}
+
+throws_ok {
+ model->create_process( $process_data_legacy_gateway->{require_cassette_or_backbone} );
+} qr/cassette_or_backbone, is missing/;
+
+throws_ok {
+ model->create_process( $process_data_legacy_gateway->{invalid_input_well} );
+} qr/legacy_gateway process input well should be type INT \(got DESIGN\)/;
+
+throws_ok {
+ model->create_process( $process_data_legacy_gateway->{invalid_output_well} );
+} qr/legacy_gateway process output well should be type FINAL_PICK \(got FINAL\)/;
+
+##
note( "Testing 3w_gateway process creation" );
my $process_data_3w_gateway= test_data( '3w_gateway_process.yaml' );
View
2  t/70-controller-api-platewell.t
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
View
2  t/80-dna_status_upload.t
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl -d
+#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
View
39 t/data/legacy_gateway_process.yaml
@@ -0,0 +1,39 @@
+---
+valid_input:
+ type: legacy_gateway
+ cassette: L1L2_Bact_P
+ backbone: L3L4_pZero_kan
+ output_wells:
+ - plate_name: FP1008
+ well_name: A01
+ input_wells:
+ - plate_name: PCS00177_A
+ well_name: G02
+ recombinase:
+ - Cre
+require_cassette_or_backbone:
+ type: legacy_gateway
+ output_wells:
+ - plate_name: FP1008
+ well_name: A01
+ input_wells:
+ - plate_name: PCS00177_A
+ well_name: G02
+invalid_input_well:
+ type: legacy_gateway
+ cassette: L1L2_Bact_P
+ output_wells:
+ - plate_name: FP1008
+ well_name: A01
+ input_wells:
+ - plate_name: 100
+ well_name: F06
+invalid_output_well:
+ type: legacy_gateway
+ cassette: L1L2_Bact_P
+ output_wells:
+ - plate_name: MOHSAS0001_A
+ well_name: I04
+ input_wells:
+ - plate_name: PCS00177_A
+ well_name: G02
View
1  t/fixtures/10-load-fixture-data.sql
@@ -4743,6 +4743,7 @@ INSERT INTO process_types VALUES ('cre_bac_recom', 'Cre/BAC recombineering');
INSERT INTO process_types VALUES ('int_recom', 'Intermediate recombineering');
INSERT INTO process_types VALUES ('2w_gateway', 'Two-way gateway');
INSERT INTO process_types VALUES ('3w_gateway', 'Three-way gateway');
+INSERT INTO process_types VALUES ('legacy_gateway', 'Legacy gateway, model old data from HTGT');
INSERT INTO process_types VALUES ('rearray', 'rearray wells');
INSERT INTO process_types VALUES ('dna_prep', 'dna prep');
INSERT INTO process_types VALUES ('recombinase', 'apply recombinase');

0 comments on commit 96622b1

Please sign in to comment.
Something went wrong with that request. Please try again.