Skip to content

Commit bb90d32

Browse files
authored
Racks are connected to a CoordinateSystem
1 parent 41ddc52 commit bb90d32

13 files changed

+117
-46
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ See [GitHub releases](https://github.com/mll-lab/php-utils/releases).
99

1010
## Unreleased
1111

12+
## v5.1.0
13+
14+
### Added
15+
16+
- Racks are connected to a `CoordinateSystem`
17+
1218
## v5.0.0
1319

1420
### Added
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace MLL\Utils\Microplate;
4+
5+
class CoordinateSystem1x1 extends CoordinateSystem
6+
{
7+
/** Duplicates @see CoordinateSystem::positionsCount() for static contexts. */
8+
public const POSITIONS_COUNT = 1;
9+
10+
public function rows(): array
11+
{
12+
return ['A'];
13+
}
14+
15+
public function columns(): array
16+
{
17+
return [1];
18+
}
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace MLL\Utils\Microplate;
4+
5+
class CoordinateSystem6x4 extends CoordinateSystem
6+
{
7+
/** Duplicates @see CoordinateSystem::positionsCount() for static contexts. */
8+
public const POSITIONS_COUNT = 24;
9+
10+
public function rows(): array
11+
{
12+
return range('A', 'D');
13+
}
14+
15+
public function columns(): array
16+
{
17+
return range(1, 6);
18+
}
19+
}

src/Tecan/Rack/AlublockA.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
use MLL\Utils\Microplate\CoordinateSystem6x4;
6+
57
/**
68
* @template TContent
79
*
810
* @extends BaseRack<TContent>
911
*/
1012
class AlublockA extends BaseRack
1113
{
14+
public function __construct()
15+
{
16+
parent::__construct(new CoordinateSystem6x4());
17+
}
18+
1219
public function type(): string
1320
{
1421
return 'Eppis 24x0.5 ml Cooled';
@@ -18,9 +25,4 @@ public function name(): string
1825
{
1926
return 'A';
2027
}
21-
22-
public function positionCount(): int
23-
{
24-
return 24;
25-
}
2628
}

src/Tecan/Rack/BaseRack.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace MLL\Utils\Tecan\Rack;
44

55
use Illuminate\Support\Collection;
6+
use MLL\Utils\Microplate\CoordinateSystem;
67

78
/** @template TContent */
89
abstract class BaseRack implements Rack
@@ -12,8 +13,11 @@ abstract class BaseRack implements Rack
1213
/** @var Collection<int, TContent|null> */
1314
public Collection $positions;
1415

15-
public function __construct()
16+
public CoordinateSystem $coordinateSystem;
17+
18+
public function __construct(CoordinateSystem $coordinateSystem)
1619
{
20+
$this->coordinateSystem = $coordinateSystem;
1721
$this->positions = Collection::times($this->positionCount(), fn () => self::EMPTY_POSITION)
1822
->mapWithKeys(fn ($content, int $position): array => [$position + 1 => $content]);
1923
}
@@ -83,4 +87,9 @@ public function assignPosition($content, int $position): int
8387

8488
return $position;
8589
}
90+
91+
public function positionCount(): int
92+
{
93+
return $this->coordinateSystem->positionsCount();
94+
}
8695
}

src/Tecan/Rack/DestLC.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
use MLL\Utils\Microplate\CoordinateSystem96Well;
6+
57
/**
68
* @template TContent
79
*
810
* @extends BaseRack<TContent>
911
*/
1012
class DestLC extends BaseRack
1113
{
14+
public function __construct()
15+
{
16+
parent::__construct(new CoordinateSystem96Well());
17+
}
18+
1219
public function type(): string
1320
{
1421
return '96 Well MP LightCycler480';
@@ -18,9 +25,4 @@ public function name(): string
1825
{
1926
return 'DestLC';
2027
}
21-
22-
public function positionCount(): int
23-
{
24-
return 96;
25-
}
2628
}

src/Tecan/Rack/DestPCR.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
use MLL\Utils\Microplate\CoordinateSystem96Well;
6+
57
/**
68
* @template TContent
79
*
810
* @extends BaseRack<TContent>
911
*/
1012
class DestPCR extends BaseRack
1113
{
14+
public function __construct()
15+
{
16+
parent::__construct(new CoordinateSystem96Well());
17+
}
18+
1219
public function type(): string
1320
{
1421
return '96 Well PCR ABI semi-skirted';
@@ -18,9 +25,4 @@ public function name(): string
1825
{
1926
return 'DestPCR';
2027
}
21-
22-
public function positionCount(): int
23-
{
24-
return 96;
25-
}
2628
}

src/Tecan/Rack/DestTaqMan.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
use MLL\Utils\Microplate\CoordinateSystem96Well;
6+
57
/**
68
* @template TContent
79
*
810
* @extends BaseRack<TContent>
911
*/
1012
class DestTaqMan extends BaseRack
1113
{
14+
public function __construct()
15+
{
16+
parent::__construct(new CoordinateSystem96Well());
17+
}
18+
1219
public function type(): string
1320
{
1421
return '96 Well PCR TaqMan';
@@ -18,9 +25,4 @@ public function name(): string
1825
{
1926
return 'DestTaqMan';
2027
}
21-
22-
public function positionCount(): int
23-
{
24-
return 96;
25-
}
2628
}

src/Tecan/Rack/FluidXRack.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
use MLL\Utils\Microplate\CoordinateSystem96Well;
6+
57
/**
68
* @template TContent
79
*
810
* @extends BaseRack<TContent>
911
*/
1012
class FluidXRack extends BaseRack implements ScannedRack
1113
{
14+
public function __construct()
15+
{
16+
parent::__construct(new CoordinateSystem96Well());
17+
}
18+
1219
public function type(): string
1320
{
1421
return '96FluidX';
@@ -18,9 +25,4 @@ public function name(): string
1825
{
1926
return 'FluidX';
2027
}
21-
22-
public function positionCount(): int
23-
{
24-
return 96;
25-
}
2628
}

src/Tecan/Rack/MPCDNA.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22

33
namespace MLL\Utils\Tecan\Rack;
44

5+
use MLL\Utils\Microplate\CoordinateSystem96Well;
6+
57
/**
68
* @template TContent
79
*
810
* @extends BaseRack<TContent>
911
*/
1012
class MPCDNA extends BaseRack
1113
{
14+
public function __construct()
15+
{
16+
parent::__construct(new CoordinateSystem96Well());
17+
}
18+
1219
public function type(): string
1320
{
1421
return 'MP cDNA';
@@ -18,9 +25,4 @@ public function name(): string
1825
{
1926
return 'MPCDNA';
2027
}
21-
22-
public function positionCount(): int
23-
{
24-
return 96;
25-
}
2628
}

0 commit comments

Comments
 (0)