Skip to content

Commit

Permalink
Racks are connected to a CoordinateSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
fischerl authored Sep 12, 2024
1 parent 41ddc52 commit bb90d32
Show file tree
Hide file tree
Showing 13 changed files with 117 additions and 46 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.1.0

### Added

- Racks are connected to a `CoordinateSystem`

## v5.0.0

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

namespace MLL\Utils\Microplate;

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

public function rows(): array
{
return ['A'];
}

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

namespace MLL\Utils\Microplate;

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

public function rows(): array
{
return range('A', 'D');
}

public function columns(): array
{
return range(1, 6);
}
}
12 changes: 7 additions & 5 deletions src/Tecan/Rack/AlublockA.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

namespace MLL\Utils\Tecan\Rack;

use MLL\Utils\Microplate\CoordinateSystem6x4;

/**
* @template TContent
*
* @extends BaseRack<TContent>
*/
class AlublockA extends BaseRack
{
public function __construct()
{
parent::__construct(new CoordinateSystem6x4());
}

public function type(): string
{
return 'Eppis 24x0.5 ml Cooled';
Expand All @@ -18,9 +25,4 @@ public function name(): string
{
return 'A';
}

public function positionCount(): int
{
return 24;
}
}
11 changes: 10 additions & 1 deletion src/Tecan/Rack/BaseRack.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace MLL\Utils\Tecan\Rack;

use Illuminate\Support\Collection;
use MLL\Utils\Microplate\CoordinateSystem;

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

public function __construct()
public CoordinateSystem $coordinateSystem;

public function __construct(CoordinateSystem $coordinateSystem)
{
$this->coordinateSystem = $coordinateSystem;
$this->positions = Collection::times($this->positionCount(), fn () => self::EMPTY_POSITION)
->mapWithKeys(fn ($content, int $position): array => [$position + 1 => $content]);
}
Expand Down Expand Up @@ -83,4 +87,9 @@ public function assignPosition($content, int $position): int

return $position;
}

public function positionCount(): int
{
return $this->coordinateSystem->positionsCount();
}
}
12 changes: 7 additions & 5 deletions src/Tecan/Rack/DestLC.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

namespace MLL\Utils\Tecan\Rack;

use MLL\Utils\Microplate\CoordinateSystem96Well;

/**
* @template TContent
*
* @extends BaseRack<TContent>
*/
class DestLC extends BaseRack
{
public function __construct()
{
parent::__construct(new CoordinateSystem96Well());
}

public function type(): string
{
return '96 Well MP LightCycler480';
Expand All @@ -18,9 +25,4 @@ public function name(): string
{
return 'DestLC';
}

public function positionCount(): int
{
return 96;
}
}
12 changes: 7 additions & 5 deletions src/Tecan/Rack/DestPCR.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

namespace MLL\Utils\Tecan\Rack;

use MLL\Utils\Microplate\CoordinateSystem96Well;

/**
* @template TContent
*
* @extends BaseRack<TContent>
*/
class DestPCR extends BaseRack
{
public function __construct()
{
parent::__construct(new CoordinateSystem96Well());
}

public function type(): string
{
return '96 Well PCR ABI semi-skirted';
Expand All @@ -18,9 +25,4 @@ public function name(): string
{
return 'DestPCR';
}

public function positionCount(): int
{
return 96;
}
}
12 changes: 7 additions & 5 deletions src/Tecan/Rack/DestTaqMan.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

namespace MLL\Utils\Tecan\Rack;

use MLL\Utils\Microplate\CoordinateSystem96Well;

/**
* @template TContent
*
* @extends BaseRack<TContent>
*/
class DestTaqMan extends BaseRack
{
public function __construct()
{
parent::__construct(new CoordinateSystem96Well());
}

public function type(): string
{
return '96 Well PCR TaqMan';
Expand All @@ -18,9 +25,4 @@ public function name(): string
{
return 'DestTaqMan';
}

public function positionCount(): int
{
return 96;
}
}
12 changes: 7 additions & 5 deletions src/Tecan/Rack/FluidXRack.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

namespace MLL\Utils\Tecan\Rack;

use MLL\Utils\Microplate\CoordinateSystem96Well;

/**
* @template TContent
*
* @extends BaseRack<TContent>
*/
class FluidXRack extends BaseRack implements ScannedRack
{
public function __construct()
{
parent::__construct(new CoordinateSystem96Well());
}

public function type(): string
{
return '96FluidX';
Expand All @@ -18,9 +25,4 @@ public function name(): string
{
return 'FluidX';
}

public function positionCount(): int
{
return 96;
}
}
12 changes: 7 additions & 5 deletions src/Tecan/Rack/MPCDNA.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

namespace MLL\Utils\Tecan\Rack;

use MLL\Utils\Microplate\CoordinateSystem96Well;

/**
* @template TContent
*
* @extends BaseRack<TContent>
*/
class MPCDNA extends BaseRack
{
public function __construct()
{
parent::__construct(new CoordinateSystem96Well());
}

public function type(): string
{
return 'MP cDNA';
Expand All @@ -18,9 +25,4 @@ public function name(): string
{
return 'MPCDNA';
}

public function positionCount(): int
{
return 96;
}
}
12 changes: 7 additions & 5 deletions src/Tecan/Rack/MPSample.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

namespace MLL\Utils\Tecan\Rack;

use MLL\Utils\Microplate\CoordinateSystem96Well;

/**
* @template TContent
*
* @extends BaseRack<TContent>
*/
class MPSample extends BaseRack
{
public function __construct()
{
parent::__construct(new CoordinateSystem96Well());
}

public function type(): string
{
return 'MP Microplate';
Expand All @@ -18,9 +25,4 @@ public function name(): string
{
return 'MPSample';
}

public function positionCount(): int
{
return 96;
}
}
12 changes: 7 additions & 5 deletions src/Tecan/Rack/MPWater.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

namespace MLL\Utils\Tecan\Rack;

use MLL\Utils\Microplate\CoordinateSystem1x1;

/**
* @template TContent
*
* @extends BaseRack<TContent>
*/
class MPWater extends BaseRack
{
public function __construct()
{
parent::__construct(new CoordinateSystem1x1());
}

public function type(): string
{
return 'Trough 300ml MCA Portrait';
Expand All @@ -18,9 +25,4 @@ public function name(): string
{
return 'MPWasser';
}

public function positionCount(): int
{
return 1;
}
}
12 changes: 7 additions & 5 deletions src/Tecan/Rack/MasterMixRack.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@

namespace MLL\Utils\Tecan\Rack;

use MLL\Utils\Microplate\CoordinateSystem2x16;

/**
* @template TContent
*
* @extends BaseRack<TContent>
*/
class MasterMixRack extends BaseRack
{
public function __construct()
{
parent::__construct(new CoordinateSystem2x16());
}

public function type(): string
{
return 'Eppis 32x1.5 ml Cooled';
Expand All @@ -18,9 +25,4 @@ public function name(): string
{
return 'MM';
}

public function positionCount(): int
{
return 32;
}
}

0 comments on commit bb90d32

Please sign in to comment.