require
5.005_02;
use
vars
qw(@ISA @EXPORT %EXPORT_TAGS @EXPORT_OK $VERSION)
;
@ISA
=
qw(Exporter)
;
%EXPORT_TAGS
= (
'all'
=> [
qw()
] );
@EXPORT_OK
= ( @{
$EXPORT_TAGS
{
'all'
} } );
@EXPORT
=
qw()
;
$VERSION
=
'1.4'
;
my
%defaults
;
{
%defaults
= (
machine
=>
'IAS'
,
x_pin
=> 2,
y_pin
=> 6,
x_spacing
=> 24,
y_spacing
=> 25,
x_repeat
=> 1,
y_repeat
=> 1,
x_pitch
=> 0,
y_pitch
=> 0,
num_spots
=> 0);
}
sub
new {
my
$class
=
shift
;
my
%args
= (
%defaults
,
@_
);
my
$self
=
bless
{
_x_pin
=>
int
(
$args
{x_pin}),
_y_pin
=>
int
(
$args
{y_pin}),
_xspacing
=>
int
(
$args
{x_spacing}),
_yspacing
=>
int
(
$args
{y_spacing}),
_x_pitch
=>
int
(
$args
{x_pitch}),
_y_pitch
=>
int
(
$args
{y_pitch}),
_max_plate_row
=> 0,
_max_plate_col
=> 0,
_max_xpass
=> 0,
_max_ypass
=> 0,
_pass_plate
=> 0,
_num_wells
=> 0,
_num_spots
=>
int
(
$args
{num_spots}),,
_max_row
=> 0,
_max_col
=> 0,
_num_plates
=> 0,
_plates
=> [],
_format
=> 1,
_repeat
=> 0,
_x_repeat
=>
int
(
$args
{x_repeat}),
_y_repeat
=>
int
(
$args
{y_repeat}),
_print_dir
=> 0,
_nocomplement
=> 0,
_machine
=>
$args
{machine},
_map
=> [],
_paramA
=> 0,
_paramB
=> 0,
_convert_well
=> {},
_convert_spot
=> {},
_test
=>
$args
{test}
},
$class
;
if
(
$args
{machine} eq
'MD3'
) {
$self
->{_format} = 2;
$self
->{_print_dir} = 1;
$self
->{_x_repeat} = 2;
$self
->{_x_repeat} = 1;
$self
->{_xspacing} = 32;
$self
->{_x_pin} = 1;
$self
->{_y_pin} = 12;
$self
->{_nocomplement} = 1;
if
(
$self
->{_yspacing} > 12) {
$self
->{_yspacing} = 12; }
}
elsif
(
$args
{machine} eq
'Lucidia'
) {
$self
->{_format} = 2;
$self
->{_print_dir} = 1;
$self
->{_x_pin} = 2;
$self
->{_y_pin} = 12;
}
elsif
(
$args
{machine} eq
'Stanford'
) {
$self
->{_format} = 2;
$self
->{_print_dir} = 0;
$self
->{_x_pin} = 4;
$self
->{_y_pin} = 4;
$self
->{_nocomplement} = 0;
}
elsif
(
$args
{machine} eq
'MD'
) {
$self
->{_x_repeat} = 2;
$self
->{_x_repeat} = 1;
$self
->{_yspacing} = 16;
$self
->{_x_pin} = 1;
$self
->{_y_pin} = 6;
$self
->{_nocomplement} = 1;
if
(
$self
->{_xspacing} > 16) {
$self
->{_yspacing} = 16; }
}
elsif
(
$args
{machine} eq
'IAS'
) {
}
else
{
$self
->{_format} = 1;
$self
->{_print_dir} = 0;
$self
->{_x_repeat} = 1;
$self
->{_x_repeat} = 1;
$self
->{_nocomplement} = 0;
}
&initialize
(
$self
);
return
$self
;
}
sub
initialize {
my
$self
=
shift
;
my
$flag
=
shift
|| 0;
if
(
$self
->{_xspacing} < 1 ||
$self
->{_xspacing} eq
''
) {
die
"x_spacing value not set\n"
; }
if
(
$self
->{_yspacing} < 1 ||
$self
->{_yspacing} eq
''
) {
die
"y_spacing value not set\n"
; }
if
(
$self
->{_x_repeat} < 1 ||
$self
->{_x_repeat} > 4) {
die
"x_repeat must be an integer between 1 and 4.\n"
; }
if
(
$self
->{_y_repeat} < 1 ||
$self
->{_y_repeat} > 4) {
die
"x_repeat must be an integer between 1 and 4.\n"
; }
if
(
$self
->{_format} == 2) {
$self
->{_max_plate_row} = 16;
$self
->{_max_plate_col} = 24;
$self
->{_max_xpass} = 16 /
$self
->{_x_pin};
$self
->{_max_ypass} = 24 /
$self
->{_y_pin};
}
else
{
$self
->{_max_plate_row} = 8;
$self
->{_max_plate_col} = 12;
$self
->{_max_xpass} = 8 /
$self
->{_x_pin};
$self
->{_max_ypass} = 12 /
$self
->{_y_pin};
}
if
(
$self
->{_x_pin} >
$self
->{_max_plate_row}) {
die
"x_pin must be an even integer <= plate row dimension\n"
; }
if
(
$self
->{_y_pin} >
$self
->{_max_plate_col}) {
die
"y_pin must be an even integer <= plate column dimension\n"
; }
$self
->{_num_wells} =
$self
->{_max_plate_row}
*
$self
->{_max_plate_col};
$self
->{_pass_plate} =
$self
->{_max_xpass}
*
$self
->{_max_ypass};
$self
->{_max_row} =
$self
->{_yspacing} *
$self
->{_y_pin}
*
$self
->{_y_repeat};
$self
->{_max_col} =
$self
->{_xspacing} *
$self
->{_x_pin}
*
$self
->{_x_repeat};
$self
->{_num_spots} =
$self
->{_max_row} *
$self
->{_max_col};
$self
->{_num_plates} =
int
((
$self
->{_num_spots} - 1)/
(
$self
->{_x_repeat} *
$self
->{_y_repeat}
*
$self
->{_num_wells})) + 1;
if
(!
$flag
) {
@{
$self
->{_plates} } = ( 1 ..
$self
->{_num_plates} );
}
$self
->{_paramA} =
$self
->{_max_plate_row}/(2 *
$self
->{_x_pin});
$self
->{_paramB} = 2 *
$self
->{_x_pin};
my
$code1
=
&make_convert_well
(
$self
);
$self
->{_convert_well} =
eval
"sub { $code1 }"
or
die
$!;
my
$code2
=
&make_convert_spot
(
$self
);
$self
->{_convert_spot} =
eval
"sub { $code2 }"
or
die
$!;
}
sub
fill_map {
my
$self
=
shift
;
for
my
$i
(1 ..
$self
->{_max_row}) {
for
my
$j
(1 ..
$self
->{_max_col}) {
my
$spot
= ((
$i
- 1) *
$self
->{_max_col}) +
$j
;
my
(
$plate
,
$well
) =
&convert_spot
(
$self
,
$i
,
$j
);
my
$current_plate
=
$self
->{_plates}->[
$plate
- 1];
$self
->{_map}->[
$spot
] = [
$i
,
$j
,
$current_plate
,
$well
];
}
}
return
$self
->{_map};
}
sub
diagnostics {
my
(
$self
) =
shift
;
print
"machine: $self->{_machine}\n"
;
print
"x_pin: $self->{_x_pin}\ty_pin: $self->{_y_pin}\txspacing:"
.
" $self->{_xspacing}\t"
;
print
"yspacing: $self->{_yspacing}\n"
;
print
"x_repeat: $self->{_x_repeat}\ty_repeat: $self->{_y_repeat}\n"
;
if
(
$self
->{_machine} eq
'Lucidia'
) {
print
"paramA: $self->{_paramA}\tparamB: $self->{_paramB}\n"
;
}
print
"max_xpass: $self->{_max_xpass}\tmax_ypass: "
.
"$self->{_max_ypass}\t"
;
print
"pass_plate: $self->{_pass_plate}\n"
;
print
"max_row: $self->{_max_row}\tmax_col: $self->{_max_col}"
.
"\tnum_wells: "
;
print
"$self->{_num_wells}: \tnum_spots: $self->{_num_spots}\n"
;
print
"format: $self->{_format}\tprint_dir: $self->{_print_dir}\n"
;
print
"nocomplement: $self->{_nocomplement}\trepeat mode: "
.
"$self->{_repeat}\n"
;
print
"num_plates: $self->{_num_plates}\n"
;
print
"plate_order: @{ $self->{_plates} }\n"
;
}
sub
print_spots {
my
$self
=
shift
;
my
$w
=
shift
|| 0;
for
my
$y
(1 ..
$self
->{_max_row}) {
for
my
$x
(1 ..
$self
->{_max_col}) {
my
$array_row
=
$y
;
my
$array_col
=
$x
;
my
$meta_row
=
int
((
$array_row
- 1)
/
$self
->{_yspacing}) + 1;
my
$meta_col
=
int
((
$array_col
- 1)
/
$self
->{_xspacing}) + 1;
my
(
$plate_num
,
$well
,
$plate_row
,
$plate_col
)
=
&convert_spot
(
$self
,
$array_row
,
$array_col
);
my
$block
= (((
$meta_row
) - 1) *
$self
->{_x_pin})
+
$meta_col
;
if
(
length
(
$plate_num
) == 1) {
$plate_num
=
"00"
.
$plate_num
;
}
elsif
(
length
(
$plate_num
) == 2) {
$plate_num
=
"0"
.
$plate_num
;
}
if
(
$w
== 1) {
if
(
length
(
$well
) == 1) {
$well
=
"00"
.
$well
;
}
elsif
(
length
(
$well
) == 2) {
$well
=
"0"
.
$well
;
}
print
"$array_row\t$array_col\t$plate_num\t"
.
"$well\n"
;
}
else
{
my
$rowstr
=
substr
(
"ABCDEFGHIJKLMNOP"
,
$plate_row
- 1, 1);
if
(
length
(
$plate_col
) == 1) {
$plate_col
=
"0"
.
$plate_col
;
}
print
"$array_row\t$array_col\t$plate_num\t"
.
"$rowstr$plate_col\n"
;
}
}
}
}
sub
print_wells {
my
$self
=
shift
;
my
$w
=
shift
|| 0;
foreach
my
$plate_num
(@{
$self
->{_plates} }) {
foreach
my
$well
(1 ..
$self
->{_num_wells}) {
my
$row
=
int
((
$well
- 1) /
$self
->{_max_plate_col}) + 1;
my
$col
=
int
((
$well
- 1) %
$self
->{_max_plate_col}) + 1;
my
@data_refs
=
&convert_well
(
$self
,
$plate_num
,
$well
);
foreach
my
$ref
(
@data_refs
) {
my
(
$array_row
,
$array_col
,
$meta_row
,
$meta_col
,
$sub_row
,
$sub_col
) =
@$ref
;
my
$plate_str
;
if
(
length
(
$plate_num
) == 1) {
$plate_str
=
"00"
.
$plate_num
;
}
elsif
(
length
(
$plate_num
) == 2) {
$plate_str
=
"0"
.
$plate_num
;
}
else
{
$plate_str
=
$plate_num
;
}
if
(
$w
== 1) {
if
(
length
(
$well
) == 1) {
$well
=
"00"
.
$well
;
}
elsif
(
length
(
$well
) == 2) {
$well
=
"0"
.
$well
;
}
print
"$plate_str\t$well\t$array_row\t$array_col\n"
;
}
else
{
my
$rowstr
=
substr
(
"ABCDEFGHIJKLMNOP"
,
$row
- 1, 1);
my
$plate_col
;
if
(
length
(
$col
) == 1) {
$plate_col
=
"0"
.
$col
;
}
else
{
$plate_col
=
$col
;
}
print
"$plate_str\t$rowstr$plate_col\t$array_row\t"
.
"$array_col\n"
;
}
}
}
}
}
sub
convert_well {
my
$self
=
$_
[0];
my
@data
=
$self
->{_convert_well}->(
@_
);
return
@data
;
}
sub
convert_spot {
my
$self
=
$_
[0];
my
@data
=
$self
->{_convert_spot}->(
@_
);
return
@data
;
}
sub
get_meta {
my
(
$self
,
$_array_row
,
$_array_col
) =
@_
;
my
$_meta_row
=
int
((
$_array_row
- 1) /
$self
->{_yspacing}) + 1;
my
$_meta_col
=
int
((
$_array_col
- 1) /
$self
->{_xspacing}) + 1;
my
$_sub_row
=
$_array_row
- ((
$_meta_row
- 1) *
$self
->{_yspacing});
my
$_sub_col
=
$_array_col
- ((
$_meta_col
- 1) *
$self
->{_xspacing});
return
(
$_meta_row
,
$_meta_col
,
$_sub_row
,
$_sub_col
);
}
sub
setFormat {
my
(
$self
,
$informat
) =
@_
;
if
(
$informat
== 1 ||
$informat
== 2) {
$self
->{_format} =
$informat
;
&initialize
(
$self
);
}
else
{
print
"Format error: 1 = 96-well, 2 = 384-well\n"
;
}
return
$self
->{_format};
}
sub
setPrintDirection {
my
(
$self
,
$dir
) =
@_
;
if
(
$dir
== 0 ||
$dir
== 1) {
$self
->{_print_dir} =
$dir
;
}
else
{
print
"Print Direction error: '0' => top->bottom, "
.
"'1' => left->right\n"
;
}
return
$self
->{_print_dir};
}
sub
setNoComplement {
my
(
$self
,
$nocomp
) =
@_
;
if
(
$nocomp
== 0 ||
$nocomp
== 1) {
$self
->{_nocomplement} =
$nocomp
;
}
else
{
print
"Complement error: '0' => complemented, "
.
"'1' => NOT complemented\n"
;
}
return
$self
->{_nocomplement};
}
sub
setRepeatMode {
my
(
$self
,
$mode
) =
@_
;
if
(
$mode
== 1) {
$self
->{_repeat} =
$mode
;
if
(
$self
->{_machine} eq
'MD'
||
$self
->{_machine} eq
'MD3'
) {
$self
->{_x_repeat} = 1;
$self
->{_y_repeat} = 1;
$self
->{_print_dir} = 0;
if
(
$self
->{_machine} eq
'MD3'
) {
$self
->{_xspacing} = 32;
$self
->{_yspacing} = 12;
}
else
{
$self
->{_xspacing} = 16;
$self
->{_yspacing} = 16;
}
}
}
elsif
(
$mode
== 0) {
$self
->{_repeat} =
$mode
;
if
(
$self
->{_machine} eq
'MD'
||
$self
->{_machine} eq
'MD3'
) {
$self
->{_x_repeat} = 2;
$self
->{_y_repeat} = 1;
if
(
$self
->{_machine} eq
'MD3'
) {
$self
->{_print_dir} = 1;
}
else
{
$self
->{_print_dir} = 0;
}
}
}
else
{
print
"Repeat error: '0' => normal mode, '1' => repeat"
.
"mode\n"
;
}
return
$self
->{_repeat};
}
sub
setRepeats {
my
(
$self
,
$xrep
,
$yrep
) =
@_
;
if
(
$xrep
> 0 &&
$xrep
< 5) {
$self
->{_x_repeat} =
$xrep
;
}
else
{
print
"Repeat error: '1' => NO repeat, '2','3','4' "
.
"repeats in x dimension\n"
;
}
if
(
$yrep
> 0 &&
$yrep
< 5) {
$self
->{_y_repeat} =
$yrep
;
}
else
{
print
"Repeat error: '1' => NO repeat, '2','3','4' "
.
"repeats in y dimension\n"
;
}
return
$self
->{_x_repeat},
$self
->{_y_repeat};
}
sub
setPlateOrder {
my
$self
=
shift
;
my
$order_string
=
shift
;
my
@tmp
=
split
(/\W+/,
$order_string
);
if
(
$order_string
eq
''
) {
@{
$self
->{_plates} } = (1 ..
$self
->{_num_plates});
}
else
{
@{
$self
->{_plates} } =
@tmp
;
}
&initialize
(
$self
,1);
return
$self
->{_plates};
}
sub
setPrintHead {
my
(
$self
,
$x
,
$y
) =
@_
;
if
(
$x
> 0 &&
$y
> 0) {
$self
->{_x_pin} =
int
(
$x
);
$self
->{_y_pin} =
int
(
$y
);
&initialize
(
$self
);
}
else
{
print
"Print head dimensions must be non-zero integers.\n"
;
}
return
$self
->{_x_pin},
$self
->{_y_pin};
}
sub
setBlockDimensions {
my
(
$self
,
$xs
,
$ys
) =
@_
;
if
(
$xs
> 0 &&
$ys
> 0) {
$self
->{_xspacing} =
int
(
$xs
);
$self
->{_yspacing} =
int
(
$ys
);
&initialize
(
$self
);
}
else
{
print
"Block dimensions must be non-zero integers.\n"
;
}
return
;
}
sub
setMachine {
my
(
$self
,
$machine
) =
@_
;
$self
->{_machine} =
$machine
;
if
(
$machine
eq
'MD3'
) {
$self
->{_format} = 2;
$self
->{_print_dir} = 1;
$self
->{_x_repeat} = 2;
$self
->{_y_repeat} = 1;
$self
->{_xspacing} = 32;
$self
->{_x_pin} = 1;
$self
->{_y_pin} = 12;
$self
->{_nocomplement} = 1;
}
elsif
(
$machine
eq
'Lucidia'
) {
$self
->{_format} = 2;
$self
->{_print_dir} = 1;
$self
->{_x_repeat} = 1;
$self
->{_y_repeat} = 1;
$self
->{_nocomplement} = 0;
$self
->{_x_pin} = 2;
$self
->{_y_pin} = 12;
}
elsif
(
$machine
eq
'Stanford'
) {
$self
->{_format} = 2;
$self
->{_print_dir} = 0;
$self
->{_x_pin} = 4;
$self
->{_y_pin} = 4;
$self
->{_x_repeat} = 1;
$self
->{_y_repeat} = 1;
$self
->{_nocomplement} = 0;
}
elsif
(
$machine
eq
'MD'
) {
$self
->{_format} = 1;
$self
->{_print_dir} = 1;
$self
->{_x_repeat} = 2;
$self
->{_y_repeat} = 1;
$self
->{_yspacing} = 16;
$self
->{_x_pin} = 1;
$self
->{_y_pin} = 6;
$self
->{_nocomplement} = 1;
}
elsif
(
$machine
eq
'IAS'
) {
$self
->{_format} = 1;
$self
->{_print_dir} = 0;
$self
->{_x_repeat} = 1;
$self
->{_y_repeat} = 1;
$self
->{_nocomplement} = 0;
}
else
{
$self
->{_format} = 1;
$self
->{_print_dir} = 0;
$self
->{_x_repeat} = 1;
$self
->{_y_repeat} = 1;
$self
->{_nocomplement} = 0;
}
$self
->initialize;
}
sub
getFormat {
return
$_
[0]->{_format}; }
sub
getPrintDirection {
return
$_
[0]->{_print_dir}; }
sub
getNoComplement {
return
$_
[0]->{_nocomplement}; }
sub
getRepeats {
return
$_
[0]->{_x_repeat},
$_
[0]->{_y_repeat}; }
sub
getRepeatMode {
return
$_
[0]->{_repeat}; }
sub
getPrintHead {
return
$_
[0]->{_x_pin},
$_
[0]->{_y_pin}; }
sub
getBlockDimensions {
return
$_
[0]->{_xspacing},
$_
[0]->{_yspacing}; }
sub
getMachine {
return
$_
[0]->{_machine}; }
sub
getPlateOrder {
return
$_
[0]->{_plates}; }
sub
getMap {
return
$_
[0]->{_map}; }
sub
getArrayDimensions {
return
$_
[0]->{_max_row},
$_
[0]->{_max_col}; }
sub
getPitch {
return
$_
[0]->{_x_pitch},
$_
[0]->{_y_pitch}; }
sub
getNumSpots {
return
$_
[0]->{_num_spots}; }
sub
showConvertWell {
print
"\nconvert_well:\n"
,
&make_convert_well
(
$_
[0]); }
sub
showConvertSpot {
print
"\nconvert_spot:\n"
,
&make_convert_spot
(
$_
[0]); }
sub
make_convert_spot {
my
$self
=
shift
;
my
$code
= '
my
(
$self
,
$_array_row
,
$_array_col
) =
@_
;
';
$code
.= '
my
$_meta_row
=
int
((
$_array_row
- 1) /
$self
->{_yspacing}) + 1;
my
$_meta_col
=
int
((
$_array_col
- 1) /
$self
->{_xspacing}) + 1;
';
$code
.= '
my
$_curr_ypin
=
int
((
$_meta_row
- 1) /
$self
->{_y_repeat}) + 1;
my
$_curr_xpin
=
int
((
$_meta_col
- 1) /
$self
->{_x_repeat}) + 1;
';
$code
.= '
my
$_spot_row
=
$_array_row
- ((
$_meta_row
- 1) *
$self
->{_yspacing});
my
$_spot_col
=
$_array_col
- ((
$_meta_col
- 1) *
$self
->{_xspacing});
';
if
(
$self
->{_machine} eq
'Stanford'
) {
$code
.= '
$_spot_col
= (
$self
->{_xspacing} + 1 -
$_spot_col
);
';
}
$code
.= '
my
$_sub_row
=
$_spot_row
;
my
$_sub_col
=
$_spot_col
;
';
if
(
$self
->{_print_dir} == 1) {
$code
.= '
my
$_cum_pass
= ((
$_spot_row
- 1) *
$self
->{_xspacing}) +
$_spot_col
;
';
}
else
{
$code
.= '
my
$_cum_pass
= ((
$_spot_col
- 1) *
$self
->{_yspacing}) +
$_spot_row
;
';
}
$code
.= '
my
$_plate_num
=
int
((
$_cum_pass
- 1) /
$self
->{_pass_plate}) + 1;
';
$code
.= '
my
$_curr_pass
=
int
((
$_cum_pass
- 1) %
$self
->{_pass_plate}) + 1;
';
if
(
$self
->{_machine} eq
'Stanford'
) {
$code
.= '
my
$_x_pass
=
int
((
$_curr_pass
- 1) /
$self
->{_max_ypass}) + 1;
my
$_y_pass
=
int
((
$_curr_pass
- 1) %
$self
->{_max_ypass}) + 1;
';
}
else
{
$code
.= '
my
$_y_pass
=
int
((
$_curr_pass
- 1) /
$self
->{_max_xpass}) + 1;
my
$_x_pass
=
int
((
$_curr_pass
- 1) %
$self
->{_max_xpass}) + 1;
';
}
if
(
$self
->{_machine} eq
'Lucidia'
&&
$self
->{_nocomplement} == 1) {
$code
.= '
my
$_plate_row
= ((
$_x_pass
- 1) %
$self
->{_paramA})
*
$self
->{_paramA} +
int
((
$_x_pass
- 1) /
$self
->{_paramB})
+ 2 * (
$_curr_xpin
) - 1;
';
}
elsif
(
$self
->{_machine} eq
'Lucidia'
) {
$code
.= '
my
$_plate_row
= ((
$_x_pass
- 1) %
$self
->{_paramA})
*
$self
->{_paramA} +
int
((
$_x_pass
- 1) /
$self
->{_paramB})
+ 2 * (1 -
$_curr_xpin
+
$self
->{_x_pin}) - 1;
';
}
elsif
(
$self
->{_nocomplement} == 1) {
$code
.= '
my
$_plate_row
= ((
$_x_pass
- 1) *
$self
->{_x_pin}) +
$_curr_xpin
;
';
}
else
{
$code
.= '
my
$_plate_row
= ((
$_x_pass
- 1) *
$self
->{_x_pin})
+ (1 -
$_curr_xpin
+
$self
->{_x_pin});
';
}
$code
.= '
my
$_plate_col
= ((
$_y_pass
- 1) *
$self
->{_y_pin}) +
$_curr_ypin
;
';
$code
.= '
my
$_well
= ((
$_plate_row
- 1) *
$self
->{_max_plate_col}) +
$_plate_col
;
return
(
$_plate_num
,
$_well
,
$_plate_row
,
$_plate_col
);
';
return
$code
;
}
sub
make_convert_well {
my
(
$self
) =
shift
;
my
$code
= '
my
(
$self
,
$_plate_num
,
$_well
) =
@_
;
';
$code
.= '
my
$_row
=
int
((
$_well
- 1) /
$self
->{_max_plate_col}) + 1;
my
$_col
=
int
((
$_well
- 1) %
$self
->{_max_plate_col}) + 1;
';
if
(
$self
->{_machine} eq
'Lucidia'
) {
$code
.= '
my
$_curr_xpin
=
$self
->{_x_pin} - (
int
((
$_row
- 1)/2) %
$self
->{_x_pin});
';
}
elsif
(
$self
->{_nocomplement} == 1) {
$code
.= '
my
$_curr_xpin
= ((
$_row
- 1) %
$self
->{_x_pin}) + 1;
';
}
else
{
$code
.= '
my
$_curr_xpin
=
$self
->{_x_pin} - ((
$_row
- 1) %
$self
->{_x_pin});
';
}
$code
.= '
my
$_curr_ypin
= ((
$_col
- 1) %
$self
->{_y_pin}) + 1;
';
if
(
$self
->{_machine} eq
'Lucidia'
) {
$code
.= '
my
$_xpass
= (((
$_row
- 1) % 2) *
$self
->{_paramA})
+
int
((
$_row
- 1) /
$self
->{_paramB}) + 1;
';
}
else
{
$code
.= '
my
$_xpass
=
int
((
$_row
- 1) /
$self
->{_x_pin}) + 1;
';
}
$code
.= '
my
$_ypass
=
int
((
$_col
- 1) /
$self
->{_y_pin}) + 1;
';
if
(
$self
->{_machine} eq
'Stanford'
) {
$code
.= '
my
$_cum_pass
= ((
$_plate_num
- 1) *
$self
->{_pass_plate})
+ ((
$_xpass
- 1) *
$self
->{_max_ypass}) +
$_ypass
;
';
}
else
{
$code
.= '
my
$_cum_pass
= ((
$_plate_num
- 1) *
$self
->{_pass_plate})
+ ((
$_ypass
- 1) *
$self
->{_max_xpass}) +
$_xpass
;
';
}
if
(
$self
->{_print_dir} == 1) {
$code
.= '
my
$_spot_row
=
int
((
$_cum_pass
- 1) /
$self
->{_xspacing}) + 1;
my
$_spot_col
=
int
((
$_cum_pass
- 1) %
$self
->{_xspacing}) + 1;
';
}
else
{
$code
.= '
my
$_spot_row
=
int
((
$_cum_pass
- 1) %
$self
->{_yspacing}) + 1;
my
$_spot_col
=
int
((
$_cum_pass
- 1) /
$self
->{_yspacing}) + 1;
';
}
if
(
$self
->{_machine} eq
'Stanford'
) {
$code
.= '
$_spot_col
= (
$self
->{_xspacing} + 1 -
$_spot_col
);
';
}
$code
.= '
my
$_sub_row
=
$_spot_row
;
my
$_sub_col
=
$_spot_col
;
';
$code
.= '
my
(
$_array_row
,
$_array_col
,
$_meta_row
,
$_meta_col
);
my
@data
;
for
my
$j
(1 ..
$self
->{_y_repeat}) {
$_meta_row
=
$j
+ (
$_curr_ypin
- 1) *
$self
->{_y_repeat};
$_array_row
=
$_spot_row
+ (
$_meta_row
- 1) *
$self
->{_yspacing};
for
my
$i
(1 ..
$self
->{_x_repeat}) {
$_meta_col
=
$i
+ (
$_curr_xpin
- 1) *
$self
->{_x_repeat};
$_array_col
=
$_spot_col
+ (
$_meta_col
- 1) *
$self
->{_xspacing};
push
@data
, [
$_array_row
,
$_array_col
,
$_meta_row
,
$_meta_col
,
$_sub_row
,
$_sub_col
];
}
}
return
@data
;
';
return
$code
;
}
1;