| 1 | package LIMS::MT_Plate; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Exporter; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | our @ISA = qw( Exporter ); | |||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '1.2'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # Access the LIMS::MT_Plate::* packages via imported constants instead of top-level package names | ||||||||||||||||||||||||||||
| 11 | 1 | ▶ | sub import { | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 12 | 1 | my $pkg = caller; | |||||||||||||||||||||||||||
| 13 | 1 | eval "*$pkg\::$_ = sub(){'LIMS::MT_Plate::$_'}" for qw(plate tube mt_96 mt_384 mt_1536 mt_plate); | |||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | { | ||||||||||||||||||||||||||||
| 17 | package LIMS::MT_Plate::plate; | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use overload '<' => \<_format_comparison, | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | '>' => \>_format_comparison, | ||||||||||||||||||||||||||||
| 21 | '^' => \&eq_format_comparison, | ||||||||||||||||||||||||||||
| 22 | 1 | '""' => \&plate_contents; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | # The constructor | ||||||||||||||||||||||||||||
| 25 | 10 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 26 | 10 | my $class = shift; | |||||||||||||||||||||||||||
| 27 | 10 | my $self = { }; | |||||||||||||||||||||||||||
| 28 | 10 | bless $self, $class; | |||||||||||||||||||||||||||
| 29 | 10 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 10 | $self->barcode(shift); | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | # Without any wells, this plate is just a slab of plastic.... | ||||||||||||||||||||||||||||
| 34 | 10 | $self->make_wells; | |||||||||||||||||||||||||||
| 35 | 10 | return $self; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | 10 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 38 | 10 | my $self = shift; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | # getter and setter for the plate barcode | ||||||||||||||||||||||||||||
| 41 | 16 | ▶ | sub barcode { | ||||||||||||||||||||||||||
|
Subroutine
barcode: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||
| 42 | 16 | my $self = shift; | |||||||||||||||||||||||||||
| 43 | 16 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 44 | 10 | $self->{ _barcode } = shift; | |||||||||||||||||||||||||||
| 45 | } elsif ($self->{ _barcode }) { | ||||||||||||||||||||||||||||
| 46 | 6 | $self->{ _barcode }; | |||||||||||||||||||||||||||
| 47 | } else { | ||||||||||||||||||||||||||||
| 48 | 0 | 'not set'; | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | # the number of wells that have a sample in them | ||||||||||||||||||||||||||||
| 52 | # getter for _wells_filled | ||||||||||||||||||||||||||||
| 53 | # no setter - automated by count_filled_wells() | ||||||||||||||||||||||||||||
| 54 | 13 | ▶ | sub wells_filled { | ||||||||||||||||||||||||||
|
Subroutine
wells_filled: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||
| 55 | 13 | my $self = shift; | |||||||||||||||||||||||||||
| 56 | 13 | ▶ | unless (defined $self->{ _wells_filled }){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 0 | $self->count_filled_wells; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | 13 | $self->{ _wells_filled }; | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | 8 | ▶ | sub samples_in_rowcol { | ||||||||||||||||||||||||||
|
Subroutine
samples_in_rowcol: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 62 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 63 | 8 | my $rowcol = shift; | |||||||||||||||||||||||||||
| 64 | 8 | my $hRowCols_Filled = $self->rowcols_filled; | |||||||||||||||||||||||||||
| 65 | 8 | $hRowCols_Filled->{ $rowcol }; | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | 17 | ▶ | sub rowcol_autoincr { | ||||||||||||||||||||||||||
|
Subroutine
rowcol_autoincr: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 68 | 17 | my $self = shift; | |||||||||||||||||||||||||||
| 69 | 17 | my $hRowCols_Filled = $self->rowcols_filled; | |||||||||||||||||||||||||||
| 70 | 17 | ▶ | while (my $rowcol = shift){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | 34 | $hRowCols_Filled->{ $rowcol }++; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub add_to_rowcol { | ||||||||||||||||||||||||||
|
Subroutine
add_to_rowcol: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 75 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 76 | 0 | my $rowcol = shift; | |||||||||||||||||||||||||||
| 77 | 0 | my $hRowCols_Filled = $self->rowcols_filled; | |||||||||||||||||||||||||||
| 78 | 0 | $hRowCols_Filled->{ $rowcol } += shift; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub set_rowcol_count { | ||||||||||||||||||||||||||
|
Subroutine
set_rowcol_count: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 81 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 82 | 0 | my $rowcol = shift; | |||||||||||||||||||||||||||
| 83 | 0 | my $hRowCols_Filled = $self->rowcols_filled; | |||||||||||||||||||||||||||
| 84 | 0 | $hRowCols_Filled->{ $rowcol } = shift; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | # count of number of samples in each row or col | ||||||||||||||||||||||||||||
| 87 | 25 | ▶ | sub rowcols_filled { | ||||||||||||||||||||||||||
|
Subroutine
rowcols_filled: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 88 | 25 | my $self = shift; | |||||||||||||||||||||||||||
| 89 | 25 | ▶ | unless (defined $self->{ _rowcols_filled }){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 1 | $self->count_filled_wells; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | 25 | return $self->{ _rowcols_filled }; | |||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||
| 94 | # returns undef if there are samples in the rowcol, 1 if its empty | ||||||||||||||||||||||||||||
| 95 | 2 | ▶ | sub rowcol_is_empty { | ||||||||||||||||||||||||||
|
Subroutine
rowcol_is_empty: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 96 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 97 | 2 | ▶ | if ($self->samples_in_rowcol(shift)){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | 1 | return; | |||||||||||||||||||||||||||
| 99 | } else { | ||||||||||||||||||||||||||||
| 100 | 1 | return 1; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | 3 | ▶ | sub rowcol_well_counts { | ||||||||||||||||||||||||||
|
Subroutine
rowcol_well_counts: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||
| 104 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 105 | 3 | my $rowcol = shift; | |||||||||||||||||||||||||||
| 106 | 3 | my $wells_filled = $self->samples_in_rowcol($rowcol); | |||||||||||||||||||||||||||
| 107 | 3 | my $wells; | |||||||||||||||||||||||||||
| 108 | 3 | ▶ | if ($self->row_or_col($rowcol) eq 'row'){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 109 | 2 | $wells = $self->cols; # number of cols | |||||||||||||||||||||||||||
| 110 | } elsif ($self->row_or_col($rowcol) eq 'col'){ | ||||||||||||||||||||||||||||
| 111 | 1 | $wells = $self->rows; # number of rows | |||||||||||||||||||||||||||
| 112 | } else { | ||||||||||||||||||||||||||||
| 113 | 0 | die "LIMS::MT_Plate ERROR: $rowcol is not a row or column name\n"; | |||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | 3 | return ($wells,$wells_filled); | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | # returns the number of empty wells | ||||||||||||||||||||||||||||
| 118 | # can use as defined if not full, undef if full | ||||||||||||||||||||||||||||
| 119 | 1 | ▶ | sub rowcol_not_full { | ||||||||||||||||||||||||||
|
Subroutine
rowcol_not_full: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 120 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 121 | 1 | my ($wells,$wells_filled) = $self->rowcol_well_counts(shift); | |||||||||||||||||||||||||||
| 122 | 1 | return $wells - $wells_filled; | |||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | # returns 1 if full, undef otherwise | ||||||||||||||||||||||||||||
| 125 | 2 | ▶ | sub rowcol_is_full { | ||||||||||||||||||||||||||
|
Subroutine
rowcol_is_full: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 126 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 127 | 2 | my ($wells,$wells_filled) = $self->rowcol_well_counts(shift); | |||||||||||||||||||||||||||
| 128 | 2 | ▶ | if ($wells == $wells_filled){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | 1 | return 1; | |||||||||||||||||||||||||||
| 130 | } else { | ||||||||||||||||||||||||||||
| 131 | 1 | return; | |||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | 2 | ▶ | sub reset_rowcols_filled { | ||||||||||||||||||||||||||
|
Subroutine
reset_rowcols_filled: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 135 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 136 | 2 | $self->{ _rowcols_filled } = { }; | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | # this sub counts the number of wells containing a sample | ||||||||||||||||||||||||||||
| 139 | # and sets the _wells_filled value | ||||||||||||||||||||||||||||
| 140 | 2 | ▶ | sub count_filled_wells { | ||||||||||||||||||||||||||
|
Subroutine
count_filled_wells: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 141 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 142 | 2 | $self->reset_rowcols_filled; | |||||||||||||||||||||||||||
| 143 | 2 | my $aCols = $self->col_names; # array_ref of column names | |||||||||||||||||||||||||||
| 144 | 2 | my $aRows = $self->row_names; # array_ref of row names | |||||||||||||||||||||||||||
| 145 | 2 | my $wells_filled = 0; | |||||||||||||||||||||||||||
| 146 | 2 | for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 147 | 16 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 148 | 192 | ▶ | if ($self->well_referenced("$row$col") || ($self->get_sample_name("$row$col") ne 'empty')){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->well_referenced("$row$col") or $self->get_sample_name("$row$col") ne "empty"
MC/DC50%1/2
$self->well_referenced("$row$col") or $self->get_sample_name("$row$col") ne "empty"
$self->well_referenced("$row$col")
$self->get_sample_name("$row$col") ne "empty"
Truth table66%2/3
A or B
A= $self->well_referenced("$row$col")B= $self->get_sample_name("$row$col") ne "empty"
| |||||||||||||||||||||||||||||
| 149 | 17 | $wells_filled++; | |||||||||||||||||||||||||||
| 150 | 17 | $self->rowcol_autoincr($row,$col); | |||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | 2 | $self->set_filled_wells($wells_filled); # set _wells_filled | |||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||
| 156 | 709 | ▶ | sub incr_filled_wells { | ||||||||||||||||||||||||||
|
Subroutine
incr_filled_wells: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 157 | 709 | my $self = shift; | |||||||||||||||||||||||||||
| 158 | 709 | $self->{ _wells_filled }++; | |||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | 2 | ▶ | sub set_filled_wells { | ||||||||||||||||||||||||||
|
Subroutine
set_filled_wells: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 161 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 162 | 2 | $self->{ _wells_filled } = shift; | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub add_filled_wells { | ||||||||||||||||||||||||||
|
Subroutine
add_filled_wells: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 165 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 166 | 0 | $self->{ _wells_filled } += shift; | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | # wells are 'referenced' if marked as an 'offset' in the array_pipeline plate table | ||||||||||||||||||||||||||||
| 169 | # if referenced wells are 'blocked' it means it can't be used as an offset for that | ||||||||||||||||||||||||||||
| 170 | # plate again, and hence can't be 'filled' in a plate merge, even if its actually empty | ||||||||||||||||||||||||||||
| 171 | 0 | ▶ | sub well_is_referenced { | ||||||||||||||||||||||||||
|
Subroutine
well_is_referenced: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 172 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 173 | 0 | my $well = shift; | |||||||||||||||||||||||||||
| 174 | 0 | $self->{ "_$well"."_referenced" }++ | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | 192 | ▶ | sub well_referenced { | ||||||||||||||||||||||||||
|
Subroutine
well_referenced: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 177 | 192 | my $self = shift; | |||||||||||||||||||||||||||
| 178 | 192 | my $well = shift; | |||||||||||||||||||||||||||
| 179 | 192 | $self->{ "_$well"."_referenced" }; | |||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||
| 181 | # use this method to fill a single well only | ||||||||||||||||||||||||||||
| 182 | 712 | ▶ | sub fill_well { | ||||||||||||||||||||||||||
|
Subroutine
fill_well: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 183 | 712 | my $self = shift; | |||||||||||||||||||||||||||
| 184 | 712 | my $well = shift; | |||||||||||||||||||||||||||
| 185 | 712 | my $sample = shift; | |||||||||||||||||||||||||||
| 186 | 712 | ▶ | return if ($sample eq 'empty'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | 712 | ▶ | die "LIMS::MT_Plate ERROR: Incorrect usage of method 'fill_well()'\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | if (ref $sample); # sample must be a scalar | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | 712 | $well = $self->check_wells($well); #Êmake sure the user defined well is valid | |||||||||||||||||||||||||||
| 191 | 712 | ▶ | if ($self->get_sample_name($well) eq 'empty'){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 709 | $self->{ "_$well" } = $sample; # fill the well | |||||||||||||||||||||||||||
| 193 | 709 | $self->incr_filled_wells; # add to _wells_filled | |||||||||||||||||||||||||||
| 194 | } else { | ||||||||||||||||||||||||||||
| 195 | 3 | ▶ | if ($self->wells_are_replaced){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 196 | 2 | ▶ | if ($self->wells_are_replaced == 2){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 197 | 1 | my $contents = $self->get_sample_name($well); | |||||||||||||||||||||||||||
| 198 | 1 | warn "Not allowed to replace sample '$contents' of plate '".$self->barcode."'in well '$well' with sample '$sample'\n"; | |||||||||||||||||||||||||||
| 199 | 1 | return; | |||||||||||||||||||||||||||
| 200 | } else { | ||||||||||||||||||||||||||||
| 201 | 1 | $self->{ "_$well" } = $sample; # replace the contents of the well | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | } else { | ||||||||||||||||||||||||||||
| 204 | 1 | my $contents = $self->get_sample_name($well); | |||||||||||||||||||||||||||
| 205 | 1 | die "LIMS::MT_Plate ERROR: Not allowed to replace sample '$contents' of plate '".$self->barcode."' in well '$well' with sample '$sample'\n"; | |||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | 710 | ▶ | if (@_) { $self->sample_type($well,shift) } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | 1 | ▶ | sub empty_well { | ||||||||||||||||||||||||||
|
Subroutine
empty_well: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 211 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 212 | 1 | my $well = shift; | |||||||||||||||||||||||||||
| 213 | 1 | $well = $self->check_wells($well); #Êmake sure the user defined well is valid | |||||||||||||||||||||||||||
| 214 | 1 | my $sample = $self->get_sample_name($well); | |||||||||||||||||||||||||||
| 215 | 1 | $self->{ "_$well" } = 'empty'; | |||||||||||||||||||||||||||
| 216 | 1 | return $sample; | |||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | ## following three methods are second attempt at importing sample file | ||||||||||||||||||||||||||||
| 219 | # using the MT_Plate_File object | ||||||||||||||||||||||||||||
| 220 | # and a spreadsheet format describing well contents | ||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub mt_plate_file { | ||||||||||||||||||||||||||
|
Subroutine
mt_plate_file: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 222 | 0 | require LIMS::MT_Plate_File; | |||||||||||||||||||||||||||
| 223 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 224 | 0 | ▶ | if(@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 225 | 0 | my $file_type = shift; | |||||||||||||||||||||||||||
| 226 | 0 | $self->{ _sample_file } = $file_type->new(shift,shift); # file name, filehandle | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | 0 | $self->{ _sample_file }; | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | 0 | ▶ | sub import_mt_plate_file { | ||||||||||||||||||||||||||
|
Subroutine
import_mt_plate_file: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 231 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 232 | 0 | $self->mt_plate_file(shift,shift,shift); # shifting file type, file name/path, filehandle | |||||||||||||||||||||||||||
| 233 | 0 | $self->import_mt_file_data; | |||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||
| 235 | 0 | ▶ | sub import_mt_file_data { | ||||||||||||||||||||||||||
|
Subroutine
import_mt_file_data: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 236 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 237 | 0 | my $oSample_File = $self->mt_plate_file; | |||||||||||||||||||||||||||
| 238 | 0 | ▶ | die "LIMS::MT_Plate ERROR: The plate type described in the sample file does not match that of the MT_Plate object\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | unless ($oSample_File->plate_type eq ref $self); | ||||||||||||||||||||||||||||
| 240 | 0 | $self->fill_wells($oSample_File->get_all_wells,$oSample_File->get_all_samples,$oSample_File->get_all_sample_types); | |||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | # use this method to fill a range of wells with a number of samples | ||||||||||||||||||||||||||||
| 243 | # will either accept a range of wells, specified as a start and end well, or an array ref of well names | ||||||||||||||||||||||||||||
| 244 | 2 | ▶ | sub fill_wells { | ||||||||||||||||||||||||||
|
Subroutine
fill_wells: called CC=12 SCAR=30.2
| |||||||||||||||||||||||||||||
| 245 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 246 | 2 | my ($aWells,$aSamples,$aSample_Types); | |||||||||||||||||||||||||||
| 247 | 2 | ▶ | if (@_ == 1) { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 248 | 1 | $aWells = $self->well_names; | |||||||||||||||||||||||||||
| 249 | 1 | $aSamples = shift; | |||||||||||||||||||||||||||
| 250 | } elsif (@_ == 2) { | ||||||||||||||||||||||||||||
| 251 | 0 | $aWells = shift; | |||||||||||||||||||||||||||
| 252 | 0 | ▶ | die "LIMS::MT_Plate ERROR: Incorrect usage (A) of method 'fill_wells()'\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 253 | unless (ref $aWells); # list of well names must be an array reference | ||||||||||||||||||||||||||||
| 254 | 0 | $aSamples = shift; | |||||||||||||||||||||||||||
| 255 | } elsif (@_ == 3) { | ||||||||||||||||||||||||||||
| 256 | 1 | my $shifted = shift; | |||||||||||||||||||||||||||
| 257 | 1 | ▶ | if (ref $shifted){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | 0 | $aWells = $shifted; | |||||||||||||||||||||||||||
| 259 | 0 | $aSamples = shift; | |||||||||||||||||||||||||||
| 260 | 0 | $aSample_Types = shift; | |||||||||||||||||||||||||||
| 261 | } else { | ||||||||||||||||||||||||||||
| 262 | 1 | my $start_well = $shifted; | |||||||||||||||||||||||||||
| 263 | 1 | my $end_well = shift; | |||||||||||||||||||||||||||
| 264 | 1 | ▶ | die "LIMS::MT_Plate ERROR: Incorrect usage (B) of method 'fill_wells()'\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $start_well or ref $end_well
MC/DC0%0/2
ref $start_well or ref $end_well
ref $start_well
ref $end_well
Truth table33%1/3
A or B
A= ref $start_wellB= ref $end_well
| |||||||||||||||||||||||||||||
| 265 | if ( (ref $start_well)||(ref $end_well) ); # defined wells must be scalars | ||||||||||||||||||||||||||||
| 266 | 1 | $aWells = $self->get_range_wells($start_well,$end_well); # array_ref of well names in the specified range | |||||||||||||||||||||||||||
| 267 | 1 | $aSamples = shift; | |||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||
| 269 | } else { | ||||||||||||||||||||||||||||
| 270 | 0 | die "LIMS::MT_Plate ERROR: Incorrect usage (C) of method 'fill_wells()'\n"; | |||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||
| 272 | 2 | $aWells = $self->check_wells($aWells); | |||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | 2 | ▶ | die "LIMS::MT_Plate ERROR: Incorrect usage (D) of method 'fill_wells()'\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 275 | unless (ref $aSamples); # samples must be an array reference | ||||||||||||||||||||||||||||
| 276 | 2 | ▶ | die "LIMS::MT_Plate ERROR: Well number must be greater or equal to the sample number, in method 'fill_wells()'\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 277 | unless (@$aWells >= @$aSamples); # must have >= wells than samples | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | 2 | ▶ | for (my $i=0; $i<@$aSamples; $i++) { # scroll through the samples.... | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 280 | 192 | ▶ | if ($aSample_Types){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 281 | 0 | $self->fill_well($$aWells[$i],$$aSamples[$i],$$aSample_Types[$i]); # ...and fill a well with a sample | |||||||||||||||||||||||||||
| 282 | } else { | ||||||||||||||||||||||||||||
| 283 | 192 | $self->fill_well($$aWells[$i],$$aSamples[$i]); # ...and fill a well with a sample | |||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | #Êsplits the column number and the row letter | ||||||||||||||||||||||||||||
| 289 | 909 | ▶ | sub get_well_coords { | ||||||||||||||||||||||||||
|
Subroutine
get_well_coords: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 290 | 909 | my $well = shift; | |||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||
| 292 | 909 | my ($row,$col) = (uc $well, uc $well); | |||||||||||||||||||||||||||
| 293 | 909 | $row =~ s/\d//g; # remove numbers | |||||||||||||||||||||||||||
| 294 | 909 | $col =~ s/\D//g; # remove letters | |||||||||||||||||||||||||||
| 295 | 909 | $col =~ s/^0//; # remove leading zero | |||||||||||||||||||||||||||
| 296 | 909 | return ($row,$col); | |||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | # method that returns an array_ref containing the well names | ||||||||||||||||||||||||||||
| 300 | # in the same order as the well_format | ||||||||||||||||||||||||||||
| 301 | 9 | ▶ | sub well_names { | ||||||||||||||||||||||||||
|
Subroutine
well_names: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 302 | 9 | my $self = shift; | |||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||
| 304 | 9 | ▶ | if ($self->well_format eq 'row') { # scroll through rows, then columns | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 305 | 8 | return $self->well_names_xrow; | |||||||||||||||||||||||||||
| 306 | } else { # scroll through columns, then rows | ||||||||||||||||||||||||||||
| 307 | 1 | return $self->well_names_xcol; | |||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | # returns an array_ref containing all well names specified by a start/end range | ||||||||||||||||||||||||||||
| 312 | 1 | ▶ | sub get_range_wells { | ||||||||||||||||||||||||||
|
Subroutine
get_range_wells: called CC=18 SCAR=37.1
| |||||||||||||||||||||||||||||
| 313 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 314 | 1 | my $start_well = shift; | |||||||||||||||||||||||||||
| 315 | 1 | my $end_well = shift; | |||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | # determine the output format i.e. row-by-row, or col-by-col | ||||||||||||||||||||||||||||
| 318 | #my $format = sample_order_format($start_well,$end_well); | ||||||||||||||||||||||||||||
| 319 | 1 | my $format = $self->well_format; | |||||||||||||||||||||||||||
| 320 | 1 | my ($start_row,$start_col) = get_well_coords($start_well); | |||||||||||||||||||||||||||
| 321 | 1 | my ($end_row,$end_col) = get_well_coords($end_well); | |||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | # check the wells are valid | ||||||||||||||||||||||||||||
| 324 | 1 | $start_well = $self->check_wells($start_well); | |||||||||||||||||||||||||||
| 325 | 1 | $end_well = $self->check_wells($end_well); | |||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | 1 | my $aCols = $self->col_names; # array_ref of column names | |||||||||||||||||||||||||||
| 328 | 1 | my $aRows = $self->row_names; # array_ref of row names | |||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | 1 | my @aWells = (); | |||||||||||||||||||||||||||
| 331 | 1 | my $start = 0; | |||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | 1 | ▶ | if ($format eq 'row') { #Êscroll through rows, then columns | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 334 | 1 | ROW:for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 335 | 8 | ▶ | $start++ if ($row eq $start_row); # we're in the start row | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 336 | 8 | ▶ | next ROW if ($start == 0); # we haven't yet reached the start row | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 337 | 8 | COL:for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 338 | 96 | ▶ | $start++ if ($col == $start_col); # we're in the start column | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 339 | 96 | ▶ | next COL if ($start < 2); # not at the start column yet | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 340 | 96 | push(@aWells,"$row$col"); #Êif we get this far, its in the well range | |||||||||||||||||||||||||||
| 341 | 96 | ▶ | last ROW if (($col == $end_col)&&($row eq $end_row)); # reached the last well, so finish | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$col == $end_col and $row eq $end_row
MC/DC100%2/2
$col == $end_col and $row eq $end_row
$col == $end_col
$row eq $end_row
Truth table100%3/3
A and B
A= $col == $end_colB= $row eq $end_row
| |||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||
| 344 | } else { # scroll through columns, then rows | ||||||||||||||||||||||||||||
| 345 | 0 | COL:for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 346 | 0 | ▶ | $start++ if ($col == $start_col); # we're in the start column | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 347 | 0 | ▶ | next COL if ($start == 0); #Êwe haven't yet reached the start column | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 348 | 0 | ROW:for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 349 | 0 | ▶ | $start++ if ($row eq $start_row); # we're in the start row | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 350 | 0 | ▶ | next ROW if ($start < 2); # not at the start row yet | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 351 | 0 | push(@aWells,"$row$col"); #Êif we get this far, its in the well range | |||||||||||||||||||||||||||
| 352 | 0 | ▶ | last COL if (($row eq $end_row)&&($col == $end_col)); # reached the last well, so finish | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$row eq $end_row and $col == $end_col
MC/DC0%0/2
$row eq $end_row and $col == $end_col
$row eq $end_row
$col == $end_col
Truth table0%0/3
A and B
A= $row eq $end_rowB= $col == $end_col
| |||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||
| 356 | 1 | return \@aWells; | |||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | # checks that a well or well-range is compatible with the specified plate format | ||||||||||||||||||||||||||||
| 360 | 717 | ▶ | sub check_wells { | ||||||||||||||||||||||||||
|
Subroutine
check_wells: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||
| 361 | 717 | my $self = shift; | |||||||||||||||||||||||||||
| 362 | 717 | my $well = shift; | |||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | 717 | ▶ | if (ref $well) { #Êuser has passed a ref, so must be an array_ref of well names | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 365 | 2 | my @aWells; | |||||||||||||||||||||||||||
| 366 | 2 | for my $a_well (@$well) { # scroll through the wells | |||||||||||||||||||||||||||
| 367 | 192 | my ($row,$col) = get_well_coords($a_well); # split the well name | |||||||||||||||||||||||||||
| 368 | 192 | ▶ | if ($self->{ "_$row$col" }){ # the well exists | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 369 | 192 | push (@aWells, "$row$col"); # so add it to the return array | |||||||||||||||||||||||||||
| 370 | } else { #Êdie if the well doesn't exist | ||||||||||||||||||||||||||||
| 371 | 0 | die "LIMS::MT_Plate ERROR: Invalid well '$a_well'\n"; | |||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||
| 374 | 2 | return \@aWells; | |||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | 715 | my ($row,$col) = get_well_coords($well); # got this far, so $well is a scalar, single well | |||||||||||||||||||||||||||
| 378 | die "LIMS::MT_Plate ERROR: Invalid well '$well' in check wells()\n" | ||||||||||||||||||||||||||||
| 379 | 715 | ▶ | unless ($self->{ "_$row$col" }); #Êdie if the well doesn't exist | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | 715 | return "$row$col"; # return the correctly formatted well | |||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | # creates the hash keys for the plate wells and set their value to 'empty' | ||||||||||||||||||||||||||||
| 385 | # finishes by setting _wells_filled to 0 | ||||||||||||||||||||||||||||
| 386 | 10 | ▶ | sub make_wells { | ||||||||||||||||||||||||||
|
Subroutine
make_wells: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 387 | 10 | my $self = shift; | |||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | 10 | my $aCols = $self->col_names; # array_ref of column names | |||||||||||||||||||||||||||
| 390 | 10 | my $aRows = $self->row_names; # array_ref of row names | |||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | 10 | for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 393 | 105 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 394 | 2593 | $self->{ "_$row$col" } = 'empty'; | |||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||
| 397 | 10 | $self->{ _wells_filled } = 0; | |||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||
| 399 | #Êspecifies how the well order is defined - by row or by col | ||||||||||||||||||||||||||||
| 400 | 12 | ▶ | sub well_format { | ||||||||||||||||||||||||||
|
Subroutine
well_format: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||
| 401 | 12 | my $self = shift; | |||||||||||||||||||||||||||
| 402 | 12 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 403 | 2 | my $format = shift; | |||||||||||||||||||||||||||
| 404 | 2 | ▶ | die "LIMS::MT_Plate ERROR: Invalid well format specified\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$format eq "row" or $format eq "col"
MC/DC0%0/2
$format eq "row" or $format eq "col"
$format eq "row"
$format eq "col"
Truth table66%2/3
A or B
A= $format eq "row"B= $format eq "col"
| |||||||||||||||||||||||||||||
| 405 | unless (($format eq 'row') || | ||||||||||||||||||||||||||||
| 406 | ($format eq 'col')); | ||||||||||||||||||||||||||||
| 407 | 2 | $self->{ _well_format } = $format; | |||||||||||||||||||||||||||
| 408 | } else { | ||||||||||||||||||||||||||||
| 409 | 10 | ▶ | if (defined $self->{ _well_format }){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 410 | 3 | return $self->{ _well_format }; | |||||||||||||||||||||||||||
| 411 | } else { | ||||||||||||||||||||||||||||
| 412 | 7 | return 'row'; | |||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||
| 416 | 0 | ▶ | sub row_by_row { | ||||||||||||||||||||||||||
|
Subroutine
row_by_row: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 417 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 418 | 0 | $self->well_format('row'); | |||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||
| 420 | 0 | ▶ | sub col_by_col { | ||||||||||||||||||||||||||
|
Subroutine
col_by_col: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 421 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 422 | 0 | $self->well_format('col'); | |||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||
| 424 | # returns the sample name for a given well | ||||||||||||||||||||||||||||
| 425 | 1904 | ▶ | sub get_sample_name { | ||||||||||||||||||||||||||
|
Subroutine
get_sample_name: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 426 | 1904 | my $self = shift; | |||||||||||||||||||||||||||
| 427 | 1904 | my $well = uc shift; | |||||||||||||||||||||||||||
| 428 | die "LIMS::MT_Plate ERROR: Invalid well ($well), in method get_sample_name()\n" | ||||||||||||||||||||||||||||
| 429 | 1904 | ▶ | unless ($self->{ "_$well" }); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 430 | 1904 | return $self->{ "_$well" }; | |||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||
| 432 | 0 | ▶ | sub get_sample_names { | ||||||||||||||||||||||||||
|
Subroutine
get_sample_names: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 433 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 434 | 0 | my $aWells = shift; | |||||||||||||||||||||||||||
| 435 | 0 | my @aSamples = (); | |||||||||||||||||||||||||||
| 436 | 0 | for my $well (@$aWells){ | |||||||||||||||||||||||||||
| 437 | 0 | push (@aSamples,$self->get_sample_name($well)); | |||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||
| 439 | 0 | return \@aSamples; | |||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||
| 441 | # returns an array ref containing all sample names | ||||||||||||||||||||||||||||
| 442 | # will accept an argument specifying whether the order of wells | ||||||||||||||||||||||||||||
| 443 | # is row-by-row, or col-by-col. | ||||||||||||||||||||||||||||
| 444 | # If no argument, then row-by-row defaults | ||||||||||||||||||||||||||||
| 445 | 1 | ▶ | sub all_samples { | ||||||||||||||||||||||||||
|
Subroutine
all_samples: called CC=9 SCAR=25.5
| |||||||||||||||||||||||||||||
| 446 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | 1 | my $return_format; | |||||||||||||||||||||||||||
| 449 | my @aSamples; | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | 1 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 452 | 0 | $return_format = lc shift; | |||||||||||||||||||||||||||
| 453 | } else { | ||||||||||||||||||||||||||||
| 454 | 1 | $return_format = 'row'; | |||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||
| 456 | 1 | ▶ | die "LIMS::MT_Plate ERROR: Invalid sample format specified\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$return_format eq "row" or $return_format eq "col"
MC/DC0%0/2
$return_format eq "row" or $return_format eq "col"
$return_format eq "row"
$return_format eq "col"
Truth table33%1/3
A or B
A= $return_format eq "row"B= $return_format eq "col"
| |||||||||||||||||||||||||||||
| 457 | unless (($return_format eq 'row') || | ||||||||||||||||||||||||||||
| 458 | ($return_format eq 'col')); | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | 1 | my $aCols = $self->col_names; # array_ref of column names | |||||||||||||||||||||||||||
| 461 | 1 | my $aRows = $self->row_names; # array_ref of row names | |||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | 1 | ▶ | if ($return_format eq 'row') { # scroll through rows, then columns | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 464 | 1 | for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 465 | 8 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 466 | 96 | push (@aSamples, $self->get_sample_name("$row$col")); # add it to the return array | |||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||
| 469 | } else { # scroll through columns, then rows | ||||||||||||||||||||||||||||
| 470 | 0 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 471 | 0 | for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 472 | 0 | push (@aSamples, $self->get_sample_name("$row$col")); # add it to the return array | |||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||
| 476 | 1 | return \@aSamples; | |||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||
| 478 | # returns an array ref containing all empty wells | ||||||||||||||||||||||||||||
| 479 | # will accept an argument specifying whether the order of wells | ||||||||||||||||||||||||||||
| 480 | # is row-by-row, or col-by-col. | ||||||||||||||||||||||||||||
| 481 | # If no argument, then row-by-row defaults | ||||||||||||||||||||||||||||
| 482 | 1 | ▶ | sub wells_empty { | ||||||||||||||||||||||||||
|
Subroutine
wells_empty: called CC=11 SCAR=29.7
| |||||||||||||||||||||||||||||
| 483 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | 1 | my $return_format; | |||||||||||||||||||||||||||
| 486 | my @aEmpty_Wells; | ||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||
| 488 | 1 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 489 | 0 | $return_format = lc shift; | |||||||||||||||||||||||||||
| 490 | } else { | ||||||||||||||||||||||||||||
| 491 | 1 | $return_format = 'row'; | |||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||
| 493 | 1 | ▶ | die "LIMS::MT_Plate ERROR: Invalid sample format specified\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$return_format eq "row" or $return_format eq "col"
MC/DC0%0/2
$return_format eq "row" or $return_format eq "col"
$return_format eq "row"
$return_format eq "col"
Truth table33%1/3
A or B
A= $return_format eq "row"B= $return_format eq "col"
| |||||||||||||||||||||||||||||
| 494 | unless (($return_format eq 'row') || | ||||||||||||||||||||||||||||
| 495 | ($return_format eq 'col')); | ||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||
| 497 | 1 | my $aCols = $self->col_names; # array_ref of column names | |||||||||||||||||||||||||||
| 498 | 1 | my $aRows = $self->row_names; # array_ref of row names | |||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||
| 500 | 1 | ▶ | if ($return_format eq 'row') { # scroll through rows, then columns | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 501 | 1 | for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 502 | 8 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 503 | 96 | ▶ | push (@aEmpty_Wells, "$row$col") if ($self->get_sample_name("$row$col") eq 'empty'); # add it to the return array | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||
| 505 | } | ||||||||||||||||||||||||||||
| 506 | } else { # scroll through columns, then rows | ||||||||||||||||||||||||||||
| 507 | 0 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 508 | 0 | for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 509 | 0 | ▶ | push (@aEmpty_Wells, "$row$col") if ($self->get_sample_name("$row$col") eq 'empty'); # add it to the return array | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||
| 513 | 1 | return \@aEmpty_Wells; | |||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||
| 515 | # late in the day - getting very lazy | ||||||||||||||||||||||||||||
| 516 | # should re-write the previous method and this next one | ||||||||||||||||||||||||||||
| 517 | # but copy, paste, and change one line is quicker! | ||||||||||||||||||||||||||||
| 518 | 3 | ▶ | sub filled_wells { | ||||||||||||||||||||||||||
|
Subroutine
filled_wells: called CC=11 SCAR=28.7
| |||||||||||||||||||||||||||||
| 519 | 3 | my $self = shift; | |||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||
| 521 | 3 | my $return_format; | |||||||||||||||||||||||||||
| 522 | my @aFilled_Wells; | ||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||
| 524 | 3 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 525 | 0 | $return_format = lc shift; | |||||||||||||||||||||||||||
| 526 | } else { | ||||||||||||||||||||||||||||
| 527 | 3 | $return_format = 'row'; | |||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||
| 529 | 3 | ▶ | die "LIMS::MT_Plate ERROR: Invalid sample format specified\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$return_format eq "row" or $return_format eq "col"
MC/DC0%0/2
$return_format eq "row" or $return_format eq "col"
$return_format eq "row"
$return_format eq "col"
Truth table33%1/3
A or B
A= $return_format eq "row"B= $return_format eq "col"
| |||||||||||||||||||||||||||||
| 530 | unless (($return_format eq 'row') || | ||||||||||||||||||||||||||||
| 531 | ($return_format eq 'col')); | ||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | 3 | my $aCols = $self->col_names; # array_ref of column names | |||||||||||||||||||||||||||
| 534 | 3 | my $aRows = $self->row_names; # array_ref of row names | |||||||||||||||||||||||||||
| 535 | |||||||||||||||||||||||||||||
| 536 | 3 | ▶ | if ($return_format eq 'row') { # scroll through rows, then columns | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 537 | 3 | for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 538 | 24 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 539 | 288 | ▶ | push (@aFilled_Wells, "$row$col") unless ($self->get_sample_name("$row$col") eq 'empty'); # add it to the return array | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||
| 542 | } else { # scroll through columns, then rows | ||||||||||||||||||||||||||||
| 543 | 0 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 544 | 0 | for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 545 | 0 | ▶ | push (@aFilled_Wells, "$row$col") unless ($self->get_sample_name("$row$col") eq 'empty'); # add it to the return array | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 546 | } | ||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||
| 549 | 3 | return \@aFilled_Wells; | |||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||
| 551 | 808 | ▶ | sub sample_type { | ||||||||||||||||||||||||||
|
Subroutine
sample_type: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 552 | 808 | my $self = shift; | |||||||||||||||||||||||||||
| 553 | 808 | my $well = uc shift; | |||||||||||||||||||||||||||
| 554 | @_ ? $self->{ "_type_$well" } = shift | ||||||||||||||||||||||||||||
| 555 | 808 | ▶ | : $self->{ "_type_$well" }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||
| 557 | #Êget_set for sample types | ||||||||||||||||||||||||||||
| 558 | #Êif no arg passed, will return arrayref of all sample types | ||||||||||||||||||||||||||||
| 559 | # if scalar passed, sets all sample types to that type | ||||||||||||||||||||||||||||
| 560 | #Êif array passed, sets types to array item values, row by row | ||||||||||||||||||||||||||||
| 561 | 2 | ▶ | sub all_sample_types { | ||||||||||||||||||||||||||
|
Subroutine
all_sample_types: called CC=8 SCAR=21.4
| |||||||||||||||||||||||||||||
| 562 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 563 | 2 | my $samples_type; | |||||||||||||||||||||||||||
| 564 | my @aSample_Types; | ||||||||||||||||||||||||||||
| 565 | 2 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 566 | 2 | $samples_type = shift; | |||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||
| 568 | 2 | my $aCols = $self->col_names; # array_ref of column names | |||||||||||||||||||||||||||
| 569 | 2 | my $aRows = $self->row_names; # array_ref of row names | |||||||||||||||||||||||||||
| 570 | 2 | for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 571 | 16 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 572 | 192 | ▶ | if ($samples_type){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 573 | 192 | ▶ | if (ref $samples_type){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 574 | 96 | my $type = shift @$samples_type; | |||||||||||||||||||||||||||
| 575 | 96 | ▶ | $self->sample_type("$row$col",$type) if ($type); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 576 | } else { | ||||||||||||||||||||||||||||
| 577 | 96 | $self->sample_type("$row$col",$samples_type); | |||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||
| 579 | } else { | ||||||||||||||||||||||||||||
| 580 | 0 | push (@aSample_Types, $self->sample_type("$row$col")); # add it to the return array | |||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||
| 584 | 2 | ▶ | return \@aSample_Types unless ($samples_type); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 585 | } | ||||||||||||||||||||||||||||
| 586 | 0 | ▶ | sub get_sample_types { | ||||||||||||||||||||||||||
|
Subroutine
get_sample_types: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 587 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 588 | 0 | my $aWells = shift; | |||||||||||||||||||||||||||
| 589 | 0 | my @aSample_Types = (); | |||||||||||||||||||||||||||
| 590 | 0 | for my $well (@$aWells){ | |||||||||||||||||||||||||||
| 591 | 0 | my $sample_type = $self->sample_type($well); | |||||||||||||||||||||||||||
| 592 | 0 | push (@aSample_Types,$sample_type); | |||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||
| 594 | 0 | return \@aSample_Types; | |||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||
| 596 | #Êjoins a number of plates of one format into a plate of a larger format | ||||||||||||||||||||||||||||
| 597 | #Êwill currently only join by quadrants | ||||||||||||||||||||||||||||
| 598 | 0 | ▶ | sub join_plates { | ||||||||||||||||||||||||||
|
Subroutine
join_plates: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||
| 599 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 600 | 0 | my @aSamples = (); | |||||||||||||||||||||||||||
| 601 | 0 | my $plate_num = @_; # how many plates we're joining together | |||||||||||||||||||||||||||
| 602 | 0 | my $source_format = $_[0]->wells; # format of the first plate in the list | |||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||
| 604 | 0 | ▶ | die "LIMS::MT_Plate ERROR: Must join plates into a larger format!\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 605 | unless ($source_format < $self->wells); | ||||||||||||||||||||||||||||
| 606 | 0 | ▶ | die "LIMS::MT_Plate ERROR: Can't join plates - too many wells for the end format\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 607 | if (($plate_num * $source_format) > $self->wells); | ||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||
| 609 | 0 | my $aOffsets = $self->get_well_offsets($source_format); # correctly ordered well names, taking account of the offset between the plate formats | |||||||||||||||||||||||||||
| 610 | 0 | ▶ | while (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 611 | 0 | my $plate = shift; | |||||||||||||||||||||||||||
| 612 | 0 | ▶ | die "LIMS::MT_Plate ERROR: The source plates for a plate join must all be the same format\n" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 613 | unless ($source_format == $plate->wells); | ||||||||||||||||||||||||||||
| 614 | 0 | my $aSource_Wells = $plate->well_names; | |||||||||||||||||||||||||||
| 615 | 0 | for my $well (@$aSource_Wells) { | |||||||||||||||||||||||||||
| 616 | 0 | my $destination_well = shift @$aOffsets; | |||||||||||||||||||||||||||
| 617 | 0 | my $sample = $plate->get_sample_name($well); | |||||||||||||||||||||||||||
| 618 | 0 | ▶ | next if ($sample eq 'empty'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 619 | 0 | $self->fill_well($destination_well,$sample,$plate->sample_type($well)); | |||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||
| 624 | 4 | ▶ | sub add_plate { | ||||||||||||||||||||||||||
|
Subroutine
add_plate: called CC=10 SCAR=24.3
| |||||||||||||||||||||||||||||
| 625 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 626 | 4 | my $plate = shift; | |||||||||||||||||||||||||||
| 627 | 4 | my $offset = uc shift; | |||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||
| 629 | 4 | ▶ | if ($plate->wells == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 630 | 0 | $self->fill_well($offset,$plate->get_sample_name('A1'),$plate->sample_type('A1')); | |||||||||||||||||||||||||||
| 631 | 0 | return; | |||||||||||||||||||||||||||
| 632 | ▶ | } elsif ( ($self->wells == 384) && ($plate->wells == 96) ) { | |||||||||||||||||||||||||||
|
Condition33%1/3
$self->wells == 384 and $plate->wells == 96
MC/DC0%0/2
$self->wells == 384 and $plate->wells == 96
$self->wells == 384
$plate->wells == 96
Truth table33%1/3
A and B
A= $self->wells == 384B= $plate->wells == 96
| |||||||||||||||||||||||||||||
| 633 | 4 | my $aOffsets = $self->get_well_offsets($plate->wells); # correctly ordered well names, taking account of the offset between the plate formats | |||||||||||||||||||||||||||
| 634 | 4 | my @aSpliced_Offset; | |||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||
| 636 | 4 | ▶ | if ($offset eq 'A1') { | ||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||
| 637 | 1 | @aSpliced_Offset = splice @$aOffsets,0,96; | |||||||||||||||||||||||||||
| 638 | } elsif ($offset eq 'A2') { | ||||||||||||||||||||||||||||
| 639 | 1 | @aSpliced_Offset = splice @$aOffsets,96,96; | |||||||||||||||||||||||||||
| 640 | } elsif ($offset eq 'B1') { | ||||||||||||||||||||||||||||
| 641 | 1 | @aSpliced_Offset = splice @$aOffsets,192,96; | |||||||||||||||||||||||||||
| 642 | } elsif ($offset eq 'B2') { | ||||||||||||||||||||||||||||
| 643 | 1 | @aSpliced_Offset = splice @$aOffsets,288,96; | |||||||||||||||||||||||||||
| 644 | } else { | ||||||||||||||||||||||||||||
| 645 | 0 | die "LIMS::MT_Plate ERROR: Invalid offset ($offset) passed to method 'add_plate()'\n"; | |||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||
| 647 | 4 | my $aSource_Wells = $plate->well_names; | |||||||||||||||||||||||||||
| 648 | 4 | for my $well (@$aSource_Wells) { | |||||||||||||||||||||||||||
| 649 | 384 | my $destination_well = shift @aSpliced_Offset; | |||||||||||||||||||||||||||
| 650 | 384 | my $sample = $plate->get_sample_name($well); | |||||||||||||||||||||||||||
| 651 | 384 | ▶ | next if ($sample eq 'empty'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 652 | 296 | $self->fill_well($destination_well,$sample,$plate->sample_type($well)); | |||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||
| 654 | } else { | ||||||||||||||||||||||||||||
| 655 | 0 | die "LIMS::MT_Plate ERROR: MT_Plate currently only supports adding 96-well plates to 384-well plates\n"; | |||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||
| 658 | # no check of plate formats here - like for like wells are combined | ||||||||||||||||||||||||||||
| 659 | # can specify wells in 'self' that are to be combined with wells in second plate | ||||||||||||||||||||||||||||
| 660 | 1 | ▶ | sub combine_plates { | ||||||||||||||||||||||||||
|
Subroutine
combine_plates: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||
| 661 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 662 | 1 | my $plate = shift; | |||||||||||||||||||||||||||
| 663 | 1 | my $aWells; | |||||||||||||||||||||||||||
| 664 | 1 | ▶ | if (@_){ # specifying wells to be combined | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 665 | 0 | $aWells = shift; | |||||||||||||||||||||||||||
| 666 | } else { # assume all wells to be combined | ||||||||||||||||||||||||||||
| 667 | 1 | $aWells = $plate->well_names; | |||||||||||||||||||||||||||
| 668 | } | ||||||||||||||||||||||||||||
| 669 | 1 | for my $well (@$aWells){ | |||||||||||||||||||||||||||
| 670 | 96 | ▶ | next if ($plate->get_sample_name($well) eq 'empty'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 671 | 8 | $self->fill_well($well,$plate->get_sample_name($well)); | |||||||||||||||||||||||||||
| 672 | 8 | $self->sample_type($well,$plate->sample_type($well)); | |||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||
| 675 | # are we allowed to over-write the contents of a plate? | ||||||||||||||||||||||||||||
| 676 | 1 | ▶ | sub can_replace { | ||||||||||||||||||||||||||
|
Subroutine
can_replace: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 677 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 678 | 1 | $self->wells_are_replaced(1); | |||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||
| 680 | 0 | ▶ | sub dont_replace { | ||||||||||||||||||||||||||
|
Subroutine
dont_replace: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 681 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 682 | 0 | $self->wells_are_replaced(0); | |||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||
| 684 | 1 | ▶ | sub warn_dont_replace { | ||||||||||||||||||||||||||
|
Subroutine
warn_dont_replace: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 685 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 686 | 1 | $self->wells_are_replaced(2); | |||||||||||||||||||||||||||
| 687 | } | ||||||||||||||||||||||||||||
| 688 | 7 | ▶ | sub wells_are_replaced { | ||||||||||||||||||||||||||
|
Subroutine
wells_are_replaced: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 689 | 7 | my $self = shift; | |||||||||||||||||||||||||||
| 690 | @_ ? $self->{ _can_combine } = shift | ||||||||||||||||||||||||||||
| 691 | 7 | ▶ | : $self->{ _can_combine }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 692 | } | ||||||||||||||||||||||||||||
| 693 | 0 | ▶ | sub skip_filled_wells { | ||||||||||||||||||||||||||
|
Subroutine
skip_filled_wells: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 694 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 695 | @_ ? $self->{ _skip_filled_wells } = shift | ||||||||||||||||||||||||||||
| 696 | 0 | ▶ | : $self->{ _skip_filled_wells }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 697 | } | ||||||||||||||||||||||||||||
| 698 | 0 | ▶ | sub dont_skip_wells { | ||||||||||||||||||||||||||
|
Subroutine
dont_skip_wells: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 699 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 700 | 0 | $self->skip_filled_wells(0); | |||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||
| 702 | 0 | ▶ | sub can_skip_wells { | ||||||||||||||||||||||||||
|
Subroutine
can_skip_wells: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 703 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 704 | 0 | $self->skip_filled_wells(1); | |||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||
| 706 | # similar to combine_plates, but one row at a time | ||||||||||||||||||||||||||||
| 707 | 9 | ▶ | sub fill_row { | ||||||||||||||||||||||||||
|
Subroutine
fill_row: called CC=4 SCAR=14.3
| |||||||||||||||||||||||||||||
| 708 | 9 | my $self = shift; | |||||||||||||||||||||||||||
| 709 | 9 | my $row = shift; # row in self to be filled | |||||||||||||||||||||||||||
| 710 | 9 | my $aSamples = shift; # samples | |||||||||||||||||||||||||||
| 711 | 9 | my $aCols = $self->col_names; # array_ref of column names | |||||||||||||||||||||||||||
| 712 | 9 | for my $col (@$aCols){ | |||||||||||||||||||||||||||
| 713 | 108 | ▶ | if (my $sample = shift @$aSamples){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 714 | 108 | ▶ | next if ($sample eq 'empty'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 715 | 108 | $self->fill_well("$row$col",$sample); # add sample to this plate | |||||||||||||||||||||||||||
| 716 | } else { | ||||||||||||||||||||||||||||
| 717 | 0 | return; | |||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||
| 721 | # similar to combine_plates, but one col at a time | ||||||||||||||||||||||||||||
| 722 | 13 | ▶ | sub fill_col { | ||||||||||||||||||||||||||
|
Subroutine
fill_col: called CC=4 SCAR=14.3
| |||||||||||||||||||||||||||||
| 723 | 13 | my $self = shift; | |||||||||||||||||||||||||||
| 724 | 13 | my $col = shift; # col in self to be filled | |||||||||||||||||||||||||||
| 725 | 13 | my $aSamples = shift; # samples | |||||||||||||||||||||||||||
| 726 | 13 | my $aRows = $self->row_names; # array_ref of column names | |||||||||||||||||||||||||||
| 727 | 13 | for my $row (@$aRows){ | |||||||||||||||||||||||||||
| 728 | 104 | ▶ | if (my $sample = shift @$aSamples){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 729 | 104 | ▶ | next if ($sample eq 'empty'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 730 | 104 | $self->fill_well("$row$col",$sample); # add sample to this plate | |||||||||||||||||||||||||||
| 731 | } else { | ||||||||||||||||||||||||||||
| 732 | 0 | return; | |||||||||||||||||||||||||||
| 733 | } | ||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||
| 736 | 1 | ▶ | sub fill_rows { | ||||||||||||||||||||||||||
|
Subroutine
fill_rows: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 737 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 738 | 1 | my $aRows = shift; # rows in self to be filled | |||||||||||||||||||||||||||
| 739 | 1 | my $aSamples = shift; # samples | |||||||||||||||||||||||||||
| 740 | 1 | for my $row (@$aRows){ | |||||||||||||||||||||||||||
| 741 | 8 | $self->fill_row($row,$aSamples); | |||||||||||||||||||||||||||
| 742 | } | ||||||||||||||||||||||||||||
| 743 | } | ||||||||||||||||||||||||||||
| 744 | 1 | ▶ | sub fill_cols { | ||||||||||||||||||||||||||
|
Subroutine
fill_cols: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 745 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 746 | 1 | my $aCols = shift; # cols in self to be filled | |||||||||||||||||||||||||||
| 747 | 1 | my $aSamples = shift; # samples | |||||||||||||||||||||||||||
| 748 | 1 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 749 | 12 | $self->fill_col($col,$aSamples); | |||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||
| 751 | } | ||||||||||||||||||||||||||||
| 752 | # returns array ref of a row's contents | ||||||||||||||||||||||||||||
| 753 | 1 | ▶ | sub row_contents { | ||||||||||||||||||||||||||
|
Subroutine
row_contents: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 754 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 755 | 1 | my $row = shift; | |||||||||||||||||||||||||||
| 756 | 1 | my $aCols = $self->col_names; # array_ref of column names | |||||||||||||||||||||||||||
| 757 | 1 | my @aSamples; | |||||||||||||||||||||||||||
| 758 | 1 | for my $col (@$aCols){ | |||||||||||||||||||||||||||
| 759 | 12 | push (@aSamples, $self->get_sample_name("$row$col")); # add it to the return array | |||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||
| 761 | 1 | return \@aSamples; | |||||||||||||||||||||||||||
| 762 | } | ||||||||||||||||||||||||||||
| 763 | # returns an array ref of a col's contents | ||||||||||||||||||||||||||||
| 764 | 1 | ▶ | sub col_contents { | ||||||||||||||||||||||||||
|
Subroutine
col_contents: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 765 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 766 | 1 | my $col = shift; | |||||||||||||||||||||||||||
| 767 | 1 | my $aRows = $self->row_names; # array_ref of column names | |||||||||||||||||||||||||||
| 768 | 1 | my @aSamples; | |||||||||||||||||||||||||||
| 769 | 1 | for my $row (@$aRows){ | |||||||||||||||||||||||||||
| 770 | 8 | push (@aSamples, $self->get_sample_name("$row$col")); # add it to the return array | |||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||
| 772 | 1 | return \@aSamples; | |||||||||||||||||||||||||||
| 773 | } | ||||||||||||||||||||||||||||
| 774 | 0 | ▶ | sub rows_contents { | ||||||||||||||||||||||||||
|
Subroutine
rows_contents: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 775 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 776 | 0 | my $aRows = shift; | |||||||||||||||||||||||||||
| 777 | 0 | my @aSamples; | |||||||||||||||||||||||||||
| 778 | 0 | for my $row (@$aRows){ | |||||||||||||||||||||||||||
| 779 | 0 | my $aRow_Samples = $self->row_contents($row); | |||||||||||||||||||||||||||
| 780 | 0 | push (@aSamples,@$aRow_Samples); | |||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||
| 782 | 0 | return \@aSamples; | |||||||||||||||||||||||||||
| 783 | } | ||||||||||||||||||||||||||||
| 784 | 0 | ▶ | sub cols_contents { | ||||||||||||||||||||||||||
|
Subroutine
cols_contents: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 785 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 786 | 0 | my $aCols = shift; | |||||||||||||||||||||||||||
| 787 | 0 | my @aSamples; | |||||||||||||||||||||||||||
| 788 | 0 | for my $col (@$aCols){ | |||||||||||||||||||||||||||
| 789 | 0 | my $aCol_Samples = $self->col_contents($col); | |||||||||||||||||||||||||||
| 790 | 0 | push (@aSamples,@$aCol_Samples); | |||||||||||||||||||||||||||
| 791 | } | ||||||||||||||||||||||||||||
| 792 | 0 | return \@aSamples; | |||||||||||||||||||||||||||
| 793 | } | ||||||||||||||||||||||||||||
| 794 | 12 | ▶ | sub is_row { | ||||||||||||||||||||||||||
|
Subroutine
is_row: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 795 | 12 | my $self = shift; | |||||||||||||||||||||||||||
| 796 | 12 | my $row = shift; | |||||||||||||||||||||||||||
| 797 | 12 | my $hRow_Names = $self->row_names_hash; | |||||||||||||||||||||||||||
| 798 | 12 | return $hRow_Names->{ $row }; | |||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||
| 800 | 9 | ▶ | sub is_col { | ||||||||||||||||||||||||||
|
Subroutine
is_col: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 801 | 9 | my $self = shift; | |||||||||||||||||||||||||||
| 802 | 9 | my $col = shift; | |||||||||||||||||||||||||||
| 803 | 9 | my $hCol_Names = $self->col_names_hash; | |||||||||||||||||||||||||||
| 804 | 9 | return $hCol_Names->{ $col }; | |||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||
| 806 | 8 | ▶ | sub row_or_col { | ||||||||||||||||||||||||||
|
Subroutine
row_or_col: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 807 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 808 | 8 | my $rowcol = shift; | |||||||||||||||||||||||||||
| 809 | 8 | ▶ | if ($self->is_row($rowcol)){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 810 | 3 | return 'row'; | |||||||||||||||||||||||||||
| 811 | } elsif ($self->is_col($rowcol)){ | ||||||||||||||||||||||||||||
| 812 | 3 | return 'col'; | |||||||||||||||||||||||||||
| 813 | } else { | ||||||||||||||||||||||||||||
| 814 | 2 | return; | |||||||||||||||||||||||||||
| 815 | } | ||||||||||||||||||||||||||||
| 816 | } | ||||||||||||||||||||||||||||
| 817 | # produce the well name list for plates in a quadrant offset | ||||||||||||||||||||||||||||
| 818 | 4 | ▶ | sub get_well_offsets { | ||||||||||||||||||||||||||
|
Subroutine
get_well_offsets: called CC=9 SCAR=22.9
| |||||||||||||||||||||||||||||
| 819 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 820 | 4 | my $source_format = shift; | |||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||
| 822 | 4 | ▶ | if ($source_format == 1) { # samples from tubes will be transferred in linear order | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 823 | 0 | return $self->well_names_xrow; | |||||||||||||||||||||||||||
| 824 | } elsif ( $source_format == 96 ) { | ||||||||||||||||||||||||||||
| 825 | 4 | my $self_format = $self->wells; | |||||||||||||||||||||||||||
| 826 | 4 | my $aRows = $self->row_names; | |||||||||||||||||||||||||||
| 827 | 4 | my $aCols = $self->col_names; | |||||||||||||||||||||||||||
| 828 | 4 | my $offset; | |||||||||||||||||||||||||||
| 829 | 4 | my @aOffsets = (); | |||||||||||||||||||||||||||
| 830 | 4 | ▶ | if ( ($self->wells)/$source_format == 4 ) { # 96->384, or 384->1536 | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 831 | 4 | $offset = 2; | |||||||||||||||||||||||||||
| 832 | } elsif ( ($self->wells)/$source_format == 16 ) { # 96->1536 | ||||||||||||||||||||||||||||
| 833 | 0 | die "LIMS::MT_Plate ERROR: MT_Plate currently does not support 1536-well offsets\n"; | |||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||
| 835 | 4 | ▶ | ROW_OFFSET:for (my $i=0; $i<=1; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 836 | 8 | ▶ | COL_OFFSET:for (my $k=0; $k<=1; $k++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 837 | 16 | ▶ | ROW:for ( my $row=0+$i; $row<@$aRows; $row+=$offset ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 838 | 128 | ▶ | COL:for ( my $col=0+$k; $col<@$aCols; $col+=$offset ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 839 | 1536 | my $well = $$aRows[$row].$$aCols[$col]; | |||||||||||||||||||||||||||
| 840 | 1536 | push (@aOffsets,$well); | |||||||||||||||||||||||||||
| 841 | } | ||||||||||||||||||||||||||||
| 842 | } | ||||||||||||||||||||||||||||
| 843 | } | ||||||||||||||||||||||||||||
| 844 | } | ||||||||||||||||||||||||||||
| 845 | 4 | return \@aOffsets; | |||||||||||||||||||||||||||
| 846 | } else { # in case we add different format plates without adapting this method | ||||||||||||||||||||||||||||
| 847 | 0 | die "LIMS::MT_Plate ERROR: Can't make offsets for the specified plate formats\n"; | |||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||
| 851 | # returns ref to an array containing well names | ||||||||||||||||||||||||||||
| 852 | # ordered row-by-row | ||||||||||||||||||||||||||||
| 853 | 8 | ▶ | sub well_names_xrow { | ||||||||||||||||||||||||||
|
Subroutine
well_names_xrow: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 854 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 855 | |||||||||||||||||||||||||||||
| 856 | 8 | my $aRows = $self->row_names; | |||||||||||||||||||||||||||
| 857 | 8 | my $aCols = $self->col_names; | |||||||||||||||||||||||||||
| 858 | 8 | my @aWell_Names = (); | |||||||||||||||||||||||||||
| 859 | 8 | for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 860 | 64 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 861 | 768 | push (@aWell_Names, "$row$col"); | |||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||
| 863 | } | ||||||||||||||||||||||||||||
| 864 | 8 | return \@aWell_Names; | |||||||||||||||||||||||||||
| 865 | } | ||||||||||||||||||||||||||||
| 866 | |||||||||||||||||||||||||||||
| 867 | # returns ref to an array containing well names | ||||||||||||||||||||||||||||
| 868 | # ordered col-by-col | ||||||||||||||||||||||||||||
| 869 | 1 | ▶ | sub well_names_xcol { | ||||||||||||||||||||||||||
|
Subroutine
well_names_xcol: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 870 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||
| 872 | 1 | my $aRows = $self->row_names; | |||||||||||||||||||||||||||
| 873 | 1 | my $aCols = $self->col_names; | |||||||||||||||||||||||||||
| 874 | 1 | my @aWell_Names = (); | |||||||||||||||||||||||||||
| 875 | 1 | for my $col (@$aCols) { | |||||||||||||||||||||||||||
| 876 | 12 | for my $row (@$aRows) { | |||||||||||||||||||||||||||
| 877 | 96 | push (@aWell_Names, "$row$col"); | |||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||
| 879 | } | ||||||||||||||||||||||||||||
| 880 | 1 | return \@aWell_Names; | |||||||||||||||||||||||||||
| 881 | } | ||||||||||||||||||||||||||||
| 882 | 0 | ▶ | sub sort_plate_wells { | ||||||||||||||||||||||||||
|
Subroutine
sort_plate_wells: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 883 | 0 | my $a_row = $a; | |||||||||||||||||||||||||||
| 884 | 0 | $a_row =~ s/\d//; | |||||||||||||||||||||||||||
| 885 | 0 | my $a_col = $a; | |||||||||||||||||||||||||||
| 886 | 0 | $a_col =~ s/\D//; | |||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||
| 888 | 0 | my $b_row = $b; | |||||||||||||||||||||||||||
| 889 | 0 | $b_row =~ s/\d//; | |||||||||||||||||||||||||||
| 890 | 0 | my $b_col = $b; | |||||||||||||||||||||||||||
| 891 | 0 | $b_col =~ s/\D//; | |||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||
| 893 | 0 | ▶ | if ($a_row eq $b_row){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 894 | 0 | return ($a_col <=> $b_col); | |||||||||||||||||||||||||||
| 895 | } else { | ||||||||||||||||||||||||||||
| 896 | 0 | return ($a_row cmp $b_row); | |||||||||||||||||||||||||||
| 897 | } | ||||||||||||||||||||||||||||
| 898 | } | ||||||||||||||||||||||||||||
| 899 | # clone an object | ||||||||||||||||||||||||||||
| 900 | 0 | ▶ | sub clone_plate { | ||||||||||||||||||||||||||
|
Subroutine
clone_plate: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 901 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 902 | 0 | bless {%$self}, ref $self; | |||||||||||||||||||||||||||
| 903 | } | ||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||
| 906 | #### overload operators #### | ||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||
| 908 | # < operator compares plate formats | ||||||||||||||||||||||||||||
| 909 | 1 | ▶ | sub lt_format_comparison { | ||||||||||||||||||||||||||
|
Subroutine
lt_format_comparison: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 910 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 911 | 1 | my $plate = shift; | |||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||
| 913 | 1 | ($self->wells) < ($plate->wells); | |||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||
| 915 | # > operator compares plate formats | ||||||||||||||||||||||||||||
| 916 | 1 | ▶ | sub gt_format_comparison { | ||||||||||||||||||||||||||
|
Subroutine
gt_format_comparison: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 917 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 918 | 1 | my $plate = shift; | |||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||
| 920 | 1 | ($self->wells) > ($plate->wells); | |||||||||||||||||||||||||||
| 921 | } | ||||||||||||||||||||||||||||
| 922 | # == operator compares plate formats | ||||||||||||||||||||||||||||
| 923 | 1 | ▶ | sub eq_format_comparison { | ||||||||||||||||||||||||||
|
Subroutine
eq_format_comparison: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 924 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 925 | 1 | my $plate = shift; | |||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||
| 927 | 1 | ($self->wells) == ($plate->wells); | |||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||
| 929 | 0 | ▶ | sub plate_contents { | ||||||||||||||||||||||||||
|
Subroutine
plate_contents: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 930 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 931 | 0 | my $aWells = $self->well_names; | |||||||||||||||||||||||||||
| 932 | 0 | for my $well (@$aWells) { | |||||||||||||||||||||||||||
| 933 | 0 | print "$well; ",$self->get_sample_name($well),"\n"; | |||||||||||||||||||||||||||
| 934 | } | ||||||||||||||||||||||||||||
| 935 | } | ||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||
| 939 | # Class describing a single well tube | ||||||||||||||||||||||||||||
| 940 | { | ||||||||||||||||||||||||||||
| 941 | 1 | package LIMS::MT_Plate::tube; | |||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||
| 943 | 1 | our @ISA = qw( LIMS::MT_Plate::plate ); | |||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||
| 945 | 0 | ▶ | sub wells { | ||||||||||||||||||||||||||
|
Subroutine
wells: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 946 | 0 | 1 | |||||||||||||||||||||||||||
| 947 | } | ||||||||||||||||||||||||||||
| 948 | 0 | ▶ | sub rows { | ||||||||||||||||||||||||||
|
Subroutine
rows: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 949 | 0 | 1 | |||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||
| 951 | 0 | ▶ | sub cols { | ||||||||||||||||||||||||||
|
Subroutine
cols: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 952 | 0 | 1 | |||||||||||||||||||||||||||
| 953 | } | ||||||||||||||||||||||||||||
| 954 | 1 | ▶ | sub row_names { | ||||||||||||||||||||||||||
|
Subroutine
row_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 955 | 1 | ['A'] | |||||||||||||||||||||||||||
| 956 | } | ||||||||||||||||||||||||||||
| 957 | 1 | ▶ | sub col_names { | ||||||||||||||||||||||||||
|
Subroutine
col_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 958 | 1 | [1] | |||||||||||||||||||||||||||
| 959 | } | ||||||||||||||||||||||||||||
| 960 | 0 | ▶ | sub row_names_hash { | ||||||||||||||||||||||||||
|
Subroutine
row_names_hash: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 961 | 0 | {A=>1} | |||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||
| 963 | 0 | ▶ | sub col_names_hash { | ||||||||||||||||||||||||||
|
Subroutine
col_names_hash: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 964 | 0 | {1=>1} | |||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||
| 966 | } | ||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||
| 968 | # Class describing a 96-well plate | ||||||||||||||||||||||||||||
| 969 | { | ||||||||||||||||||||||||||||
| 970 | 1 | package LIMS::MT_Plate::mt_96; | |||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||
| 972 | 1 | our @ISA = qw( LIMS::MT_Plate::plate ); | |||||||||||||||||||||||||||
| 973 | |||||||||||||||||||||||||||||
| 974 | 16 | ▶ | sub wells { | ||||||||||||||||||||||||||
|
Subroutine
wells: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 975 | 16 | 96 | |||||||||||||||||||||||||||
| 976 | } | ||||||||||||||||||||||||||||
| 977 | 1 | ▶ | sub rows { | ||||||||||||||||||||||||||
|
Subroutine
rows: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 978 | 1 | 8 | |||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||
| 980 | 2 | ▶ | sub cols { | ||||||||||||||||||||||||||
|
Subroutine
cols: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 981 | 2 | 12 | |||||||||||||||||||||||||||
| 982 | } | ||||||||||||||||||||||||||||
| 983 | 40 | ▶ | sub row_names { | ||||||||||||||||||||||||||
|
Subroutine
row_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 984 | 40 | ['A' .. 'H'] | |||||||||||||||||||||||||||
| 985 | } | ||||||||||||||||||||||||||||
| 986 | 36 | ▶ | sub col_names { | ||||||||||||||||||||||||||
|
Subroutine
col_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 987 | 36 | [1 .. 12] | |||||||||||||||||||||||||||
| 988 | } | ||||||||||||||||||||||||||||
| 989 | 10 | ▶ | sub row_names_hash { | ||||||||||||||||||||||||||
|
Subroutine
row_names_hash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 990 | 10 | {A=>1,B=>1,C=>1,D=>1,E=>1,F=>1,G=>1,H=>1} | |||||||||||||||||||||||||||
| 991 | } | ||||||||||||||||||||||||||||
| 992 | 7 | ▶ | sub col_names_hash { | ||||||||||||||||||||||||||
|
Subroutine
col_names_hash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 993 | 7 | {1=>1,2=>1,3=>1,4=>1,5=>1,6=>1, | |||||||||||||||||||||||||||
| 994 | 7=>1,8=>1,9=>1,10=>1,11=>1,12=>1} | ||||||||||||||||||||||||||||
| 995 | } | ||||||||||||||||||||||||||||
| 996 | } | ||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||
| 998 | # Class describing a 384-well plate | ||||||||||||||||||||||||||||
| 999 | { | ||||||||||||||||||||||||||||
| 1000 | 1 | package LIMS::MT_Plate::mt_384; | |||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||
| 1002 | 1 | our @ISA = qw( LIMS::MT_Plate::plate ); | |||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||
| 1004 | 14 | ▶ | sub wells { | ||||||||||||||||||||||||||
|
Subroutine
wells: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 1005 | 14 | 384 | |||||||||||||||||||||||||||
| 1006 | } | ||||||||||||||||||||||||||||
| 1007 | 0 | ▶ | sub rows { | ||||||||||||||||||||||||||
|
Subroutine
rows: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 1008 | 0 | 16 | |||||||||||||||||||||||||||
| 1009 | } | ||||||||||||||||||||||||||||
| 1010 | 0 | ▶ | sub cols { | ||||||||||||||||||||||||||
|
Subroutine
cols: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 1011 | 0 | 24 | |||||||||||||||||||||||||||
| 1012 | } | ||||||||||||||||||||||||||||
| 1013 | 5 | ▶ | sub row_names { | ||||||||||||||||||||||||||
|
Subroutine
row_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 1014 | 5 | ['A' .. 'P'] | |||||||||||||||||||||||||||
| 1015 | } | ||||||||||||||||||||||||||||
| 1016 | 5 | ▶ | sub col_names { | ||||||||||||||||||||||||||
|
Subroutine
col_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 1017 | 5 | [1 .. 24] | |||||||||||||||||||||||||||
| 1018 | } | ||||||||||||||||||||||||||||
| 1019 | 2 | ▶ | sub row_names_hash { | ||||||||||||||||||||||||||
|
Subroutine
row_names_hash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 1020 | 2 | {A=>1,B=>1,C=>1,D=>1,E=>1,F=>1,G=>1,H=>1, | |||||||||||||||||||||||||||
| 1021 | I=>1,J=>1,K=>1,L=>1,M=>1,N=>1,O=>1,P=>1} | ||||||||||||||||||||||||||||
| 1022 | } | ||||||||||||||||||||||||||||
| 1023 | 2 | ▶ | sub col_names_hash { | ||||||||||||||||||||||||||
|
Subroutine
col_names_hash: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 1024 | 2 | {1=>1,2=>1,3=>1,4=>1,5=>1,6=>1,7=>1,8=>1, | |||||||||||||||||||||||||||
| 1025 | 9=>1,10=>1,11=>1,12=>1,13=>1,14=>1,15=>1,16=>1, | ||||||||||||||||||||||||||||
| 1026 | 17=>1,18=>1,19=>1,20=>1,21=>1,22=>1,23=>1,24=>1} | ||||||||||||||||||||||||||||
| 1027 | } | ||||||||||||||||||||||||||||
| 1028 | } | ||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||
| 1030 | # Class describing a 1536-well plate | ||||||||||||||||||||||||||||
| 1031 | { | ||||||||||||||||||||||||||||
| 1032 | 1 | package LIMS::MT_Plate::mt_1536; | |||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||
| 1034 | 1 | our @ISA = qw( LIMS::MT_Plate::plate ); | |||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||
| 1036 | 0 | ▶ | sub wells { | ||||||||||||||||||||||||||
|
Subroutine
wells: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 1037 | 0 | 1536 | |||||||||||||||||||||||||||
| 1038 | } | ||||||||||||||||||||||||||||
| 1039 | 0 | ▶ | sub rows { | ||||||||||||||||||||||||||
|
Subroutine
rows: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 1040 | 0 | 32 | |||||||||||||||||||||||||||
| 1041 | } | ||||||||||||||||||||||||||||
| 1042 | 0 | ▶ | sub cols { | ||||||||||||||||||||||||||
|
Subroutine
cols: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 1043 | 0 | 48 | |||||||||||||||||||||||||||
| 1044 | } | ||||||||||||||||||||||||||||
| 1045 | 1 | ▶ | sub row_names { | ||||||||||||||||||||||||||
|
Subroutine
row_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 1046 | 1 | ['A' .. 'Z','AA','AB','AC','AD','AE','AF'] | |||||||||||||||||||||||||||
| 1047 | } | ||||||||||||||||||||||||||||
| 1048 | 1 | ▶ | sub col_names { | ||||||||||||||||||||||||||
|
Subroutine
col_names: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 1049 | 1 | [1 .. 48] | |||||||||||||||||||||||||||
| 1050 | } | ||||||||||||||||||||||||||||
| 1051 | 0 | ▶ | sub row_names_hash { | ||||||||||||||||||||||||||
|
Subroutine
row_names_hash: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 1052 | 0 | {A=>1,B=>1,C=>1,D=>1,E=>1,F=>1,G=>1,H=>1, | |||||||||||||||||||||||||||
| 1053 | I=>1,J=>1,K=>1,L=>1,M=>1,N=>1,O=>1,P=>1, | ||||||||||||||||||||||||||||
| 1054 | Q=>1,R=>1,S=>1,T=>1,U=>1,V=>1,W=>1,X=>1, | ||||||||||||||||||||||||||||
| 1055 | Y=>1,Z=>1,AA=>1,AB=>1,AC=>1,AD=>1,AE=>1,AF=>1} | ||||||||||||||||||||||||||||
| 1056 | } | ||||||||||||||||||||||||||||
| 1057 | 0 | ▶ | sub col_names_hash { | ||||||||||||||||||||||||||
|
Subroutine
col_names_hash: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 1058 | 0 | {1=>1,2=>1,3=>1,4=>1,5=>1,6=>1,7=>1,8=>1, | |||||||||||||||||||||||||||
| 1059 | 9=>1,10=>1,11=>1,12=>1,13=>1,14=>1,15=>1,16=>1, | ||||||||||||||||||||||||||||
| 1060 | 17=>1,18=>1,19=>1,20=>1,21=>1,22=>1,23=>1,24=>1, | ||||||||||||||||||||||||||||
| 1061 | 25=>1,26=>1,27=>1,28=>1,29=>1,30=>1,31=>1,32=>1, | ||||||||||||||||||||||||||||
| 1062 | 33=>1,34=>1,35=>1,36=>1,37=>1,38=>1,39=>1,40=>1, | ||||||||||||||||||||||||||||
| 1063 | 41=>1,42=>1,43=>1,44=>1,45=>1,46=>1,47=>1,48=>1} | ||||||||||||||||||||||||||||
| 1064 | } | ||||||||||||||||||||||||||||
| 1065 | } | ||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||
| 1067 | { | ||||||||||||||||||||||||||||
| 1068 | 1 | package LIMS::MT_Plate::mt_plate; | |||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||
| 1070 | 1 | our @ISA = qw ( LIMS::MT_Plate::plate ); | |||||||||||||||||||||||||||
| 1071 | |||||||||||||||||||||||||||||
| 1072 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=14.5
| |||||||||||||||||||||||||||||
| 1073 | 1 | my $class = shift; | |||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||
| 1075 | 1 | my ($barcode,$wells); | |||||||||||||||||||||||||||
| 1076 | 1 | ▶ | if (@_ == 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1077 | 1 | $barcode = shift; | |||||||||||||||||||||||||||
| 1078 | } | ||||||||||||||||||||||||||||
| 1079 | 1 | $wells = shift; | |||||||||||||||||||||||||||
| 1080 | 1 | ▶ | die "LIMS::MT_Plate ERROR: No plate type defined for plate '$barcode'\nin method 'mt_plate->new()'\n" unless $wells; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1081 | 1 | ▶ | if ($wells == 1){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 1082 | 0 | $class = 'LIMS::MT_Plate::tube'; | |||||||||||||||||||||||||||
| 1083 | } else { | ||||||||||||||||||||||||||||
| 1084 | 1 | $class = "LIMS::MT_Plate::mt_$wells"; | |||||||||||||||||||||||||||
| 1085 | } | ||||||||||||||||||||||||||||
| 1086 | 1 | $class->new($barcode); | |||||||||||||||||||||||||||
| 1087 | } | ||||||||||||||||||||||||||||
| 1088 | } | ||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||
| 1090 | 1 | 1; | |||||||||||||||||||||||||||
| 1091 | __END__ | ||||||||||||||||||||||||||||