Skip to content

Commit

Permalink
Ae 347 mm coordinate system (#38)
Browse files Browse the repository at this point in the history
fix: coordinate system for mm block in tecan has no J column
  • Loading branch information
fischerl authored Oct 8, 2024
1 parent e142060 commit 26c520a
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ See [GitHub releases](https://github.com/mll-lab/php-utils/releases).

## Unreleased

## v5.5.2

### Fixed

- Changed coordinate system for `MLL\Utils\Tecan\Rack\MasterMixRack`

## v5.5.1

### Fixed
Expand Down
20 changes: 20 additions & 0 deletions src/Microplate/CoordinateSystem2x16NoJ.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php declare(strict_types=1);

namespace MLL\Utils\Microplate;

class CoordinateSystem2x16NoJ extends CoordinateSystem
{
/** Duplicates @see CoordinateSystem::positionsCount() for static contexts. */
public const POSITIONS_COUNT = 32;

/** The Tecan MM block has no J on its rows */
public function rows(): array
{
return [...range('A', 'I'), ...range('K', 'Q')];
}

public function columns(): array
{
return range(1, 2);
}
}
15 changes: 15 additions & 0 deletions src/Microplate/Scalars/Row16NoJ.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php declare(strict_types=1);

namespace MLL\Utils\Microplate\Scalars;

use MLL\GraphQLScalars\Regex;

class Row16NoJ extends Regex
{
public ?string $description = 'Represents a row in a coordinate system with 16 rows without the letter J';

public static function regex(): string
{
return '/^[A-IK-Q]$/';
}
}
4 changes: 2 additions & 2 deletions src/Tecan/Rack/MasterMixRack.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace MLL\Utils\Tecan\Rack;

use MLL\Utils\Microplate\CoordinateSystem2x16;
use MLL\Utils\Microplate\CoordinateSystem2x16NoJ;

/**
* @template TContent
Expand All @@ -13,7 +13,7 @@ class MasterMixRack extends BaseRack
{
public function __construct()
{
parent::__construct(new CoordinateSystem2x16());
parent::__construct(new CoordinateSystem2x16NoJ());
}

public function type(): string
Expand Down
3 changes: 3 additions & 0 deletions tests/Microplate/CoordinateSystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use MLL\Utils\Microplate\CoordinateSystem12x8;
use MLL\Utils\Microplate\CoordinateSystem1x1;
use MLL\Utils\Microplate\CoordinateSystem2x16;
use MLL\Utils\Microplate\CoordinateSystem2x16NoJ;
use MLL\Utils\Microplate\CoordinateSystem4x3;
use MLL\Utils\Microplate\CoordinateSystem6x4;
use MLL\Utils\Microplate\CoordinateSystem6x8;
Expand Down Expand Up @@ -33,6 +34,7 @@ public static function firstLast(): iterable
{
yield '1x1' => [new CoordinateSystem1x1(), 'A1', 'A1'];
yield '2x16' => [new CoordinateSystem2x16(), 'A1', 'P2'];
yield '2x16NoJ' => [new CoordinateSystem2x16NoJ(), 'A1', 'Q2'];
yield '4x3' => [new CoordinateSystem4x3(), 'A1', 'C4'];
yield '6x4' => [new CoordinateSystem6x4(), 'A1', 'D6'];
yield '6x8' => [new CoordinateSystem6x8(), 'A1', 'H6'];
Expand All @@ -44,6 +46,7 @@ public function testPositionsCount(): void
{
self::assertSame(CoordinateSystem1x1::POSITIONS_COUNT, (new CoordinateSystem1x1())->positionsCount());
self::assertSame(CoordinateSystem2x16::POSITIONS_COUNT, (new CoordinateSystem2x16())->positionsCount());
self::assertSame(CoordinateSystem2x16NoJ::POSITIONS_COUNT, (new CoordinateSystem2x16NoJ())->positionsCount());
self::assertSame(CoordinateSystem4x3::POSITIONS_COUNT, (new CoordinateSystem4x3())->positionsCount());
self::assertSame(CoordinateSystem6x4::POSITIONS_COUNT, (new CoordinateSystem6x4())->positionsCount());
self::assertSame(CoordinateSystem6x8::POSITIONS_COUNT, (new CoordinateSystem6x8())->positionsCount());
Expand Down
44 changes: 44 additions & 0 deletions tests/Microplate/CoordinatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use MLL\Utils\Microplate\CoordinateSystem;
use MLL\Utils\Microplate\CoordinateSystem12x8;
use MLL\Utils\Microplate\CoordinateSystem2x16;
use MLL\Utils\Microplate\CoordinateSystem2x16NoJ;
use MLL\Utils\Microplate\CoordinateSystem4x3;
use MLL\Utils\Microplate\CoordinateSystem6x8;
use MLL\Utils\Microplate\CoordinateSystem8x6;
Expand Down Expand Up @@ -213,6 +214,7 @@ public static function dataProviderPaddedWells(): iterable
public static function dataProviderWells(): iterable
{
yield '2x16' => [new CoordinateSystem2x16(), self::data2x16()];
yield '2x16NoJ' => [new CoordinateSystem2x16NoJ(), self::data2x16NoJ()];
yield '4x3' => [new CoordinateSystem4x3(), self::data4x3()];
yield '8x6' => [new CoordinateSystem8x6(), self::data8x6()];
yield '12x8' => [new CoordinateSystem12x8(), self::data12x8()];
Expand All @@ -236,6 +238,7 @@ public function testThrowsOnInvalidRowsOrColumns(CoordinateSystem $coordinateSys
public static function invalidRowsOrColumns(): iterable
{
yield '2x16' => [new CoordinateSystem2x16(), [['X', 2], ['B', 0], ['B', 3], ['B', -1], ['B', 1000], ['rolf', 2]]];
yield '2x16NoJ' => [new CoordinateSystem2x16NoJ(), [['J', 1], ['J', 2]]];
yield '4x3' => [new CoordinateSystem4x3(), [['X', 2], ['B', 0], ['B', 4], ['B', -1], ['B', 1000], ['rolf', 2], ['D', 1]]];
yield '8x6' => [new CoordinateSystem8x6(), [['X', 2], ['B', 0], ['B', 4], ['B', -1], ['B', 1000], ['rolf', 2], ['G', 1]]];
yield '12x8' => [new CoordinateSystem12x8(), [['X', 2], ['B', 0], ['B', 13], ['B', -1], ['B', 1000], ['rolf', 2]]];
Expand All @@ -259,6 +262,7 @@ public function testThrowsOnInvalidPositions(CoordinateSystem $coordinateSystem,
public static function invalidPositions(): iterable
{
yield '2x16' => [new CoordinateSystem2x16(), [0, -1, 33, 10000]];
yield '2x16NoJ' => [new CoordinateSystem2x16NoJ(), [0, -1, 33, 10000]];
yield '4x3' => [new CoordinateSystem4x3(), [0, -1, 13, 10000]];
yield '8x6' => [new CoordinateSystem8x6(), [0, -1, 49, 10000]];
yield '12x8' => [new CoordinateSystem12x8(), [0, -1, 97, 10000]];
Expand All @@ -282,6 +286,7 @@ public function testThrowsOnInvalidCoordinates(CoordinateSystem $coordinateSyste
public static function invalidCoordinates(): iterable
{
yield '2x16' => [new CoordinateSystem2x16(), ['A0', 'A01', 'D3', 'C5', 'X3', 'rolf', 'a1']];
yield '2x16NoJ' => [new CoordinateSystem2x16NoJ(), ['J1', 'J2']];
yield '8x6' => [new CoordinateSystem8x6(), ['A0', 'A01', 'G3', 'C9', 'rolf', 'a1']];
yield '12x8' => [new CoordinateSystem12x8(), ['A0', 'A001', 'X3', 'rolf', 'a1']];
}
Expand Down Expand Up @@ -325,6 +330,45 @@ public static function data2x16(): array
];
}

/** @return array<WellData> */
public static function data2x16NoJ(): array
{
return [
['row' => 'A', 'column' => 1, 'rowFlowPosition' => 1, 'columnFlowPosition' => 1],
['row' => 'B', 'column' => 1, 'rowFlowPosition' => 3, 'columnFlowPosition' => 2],
['row' => 'C', 'column' => 1, 'rowFlowPosition' => 5, 'columnFlowPosition' => 3],
['row' => 'D', 'column' => 1, 'rowFlowPosition' => 7, 'columnFlowPosition' => 4],
['row' => 'E', 'column' => 1, 'rowFlowPosition' => 9, 'columnFlowPosition' => 5],
['row' => 'F', 'column' => 1, 'rowFlowPosition' => 11, 'columnFlowPosition' => 6],
['row' => 'G', 'column' => 1, 'rowFlowPosition' => 13, 'columnFlowPosition' => 7],
['row' => 'H', 'column' => 1, 'rowFlowPosition' => 15, 'columnFlowPosition' => 8],
['row' => 'I', 'column' => 1, 'rowFlowPosition' => 17, 'columnFlowPosition' => 9],
['row' => 'K', 'column' => 1, 'rowFlowPosition' => 19, 'columnFlowPosition' => 10],
['row' => 'L', 'column' => 1, 'rowFlowPosition' => 21, 'columnFlowPosition' => 11],
['row' => 'M', 'column' => 1, 'rowFlowPosition' => 23, 'columnFlowPosition' => 12],
['row' => 'N', 'column' => 1, 'rowFlowPosition' => 25, 'columnFlowPosition' => 13],
['row' => 'O', 'column' => 1, 'rowFlowPosition' => 27, 'columnFlowPosition' => 14],
['row' => 'P', 'column' => 1, 'rowFlowPosition' => 29, 'columnFlowPosition' => 15],
['row' => 'Q', 'column' => 1, 'rowFlowPosition' => 31, 'columnFlowPosition' => 16],
['row' => 'A', 'column' => 2, 'rowFlowPosition' => 2, 'columnFlowPosition' => 17],
['row' => 'B', 'column' => 2, 'rowFlowPosition' => 4, 'columnFlowPosition' => 18],
['row' => 'C', 'column' => 2, 'rowFlowPosition' => 6, 'columnFlowPosition' => 19],
['row' => 'D', 'column' => 2, 'rowFlowPosition' => 8, 'columnFlowPosition' => 20],
['row' => 'E', 'column' => 2, 'rowFlowPosition' => 10, 'columnFlowPosition' => 21],
['row' => 'F', 'column' => 2, 'rowFlowPosition' => 12, 'columnFlowPosition' => 22],
['row' => 'G', 'column' => 2, 'rowFlowPosition' => 14, 'columnFlowPosition' => 23],
['row' => 'H', 'column' => 2, 'rowFlowPosition' => 16, 'columnFlowPosition' => 24],
['row' => 'I', 'column' => 2, 'rowFlowPosition' => 18, 'columnFlowPosition' => 25],
['row' => 'K', 'column' => 2, 'rowFlowPosition' => 20, 'columnFlowPosition' => 26],
['row' => 'L', 'column' => 2, 'rowFlowPosition' => 22, 'columnFlowPosition' => 27],
['row' => 'M', 'column' => 2, 'rowFlowPosition' => 24, 'columnFlowPosition' => 28],
['row' => 'N', 'column' => 2, 'rowFlowPosition' => 26, 'columnFlowPosition' => 29],
['row' => 'O', 'column' => 2, 'rowFlowPosition' => 28, 'columnFlowPosition' => 30],
['row' => 'P', 'column' => 2, 'rowFlowPosition' => 30, 'columnFlowPosition' => 31],
['row' => 'Q', 'column' => 2, 'rowFlowPosition' => 32, 'columnFlowPosition' => 32],
];
}

/** @return array<WellData> */
public static function data4x3(): array
{
Expand Down

0 comments on commit 26c520a

Please sign in to comment.