generated from spawnia/php-package-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
343 additions
and
45 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace MLL\Utils\Tecan\CustomCommands; | ||
|
||
use MLL\Utils\Tecan\BasicCommands\Command; | ||
use MLL\Utils\Tecan\BasicCommands\ReagentDistribution; | ||
use MLL\Utils\Tecan\LiquidClass\LiquidClass; | ||
use MLL\Utils\Tecan\ReagentDistribution\ReagentDistributionDirection; | ||
|
||
final class MLLReagentDistribution extends Command | ||
{ | ||
public const NUMBER_OF_DITI_REUSES = 6; | ||
public const NUMBER_OF_MULTI_DISP = 1; | ||
|
||
private AspirateParameters $source; | ||
|
||
private DispenseParameters $target; | ||
|
||
private float $volume; | ||
|
||
private LiquidClass $liquidClass; | ||
|
||
public function __construct( | ||
AspirateParameters $source, | ||
DispenseParameters $target, | ||
float $dispenseVolume, | ||
LiquidClass $liquidClass | ||
) { | ||
$this->source = $source; | ||
$this->target = $target; | ||
$this->volume = $dispenseVolume; | ||
$this->liquidClass = $liquidClass; | ||
} | ||
|
||
public function toString(): string | ||
{ | ||
$reagentDistribution = new ReagentDistribution( | ||
$this->source->formatToAspirateAndDispenseParameters(), | ||
$this->target->formatToAspirateAndDispenseParameters(), | ||
$this->volume, | ||
$this->liquidClass, | ||
self::NUMBER_OF_DITI_REUSES, | ||
self::NUMBER_OF_MULTI_DISP, | ||
ReagentDistributionDirection::LEFT_TO_RIGHT(), | ||
$this->excludedWells(), | ||
); | ||
|
||
return $reagentDistribution->toString(); | ||
} | ||
|
||
/** @return array<int, int> */ | ||
private function excludedWells(): array | ||
{ | ||
$min = min($this->target->dispensePositions); | ||
$max = max($this->target->dispensePositions); | ||
|
||
$allWellsFromStartToEnd = range($min, $max); | ||
|
||
return array_diff($allWellsFromStartToEnd, $this->target->dispensePositions); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace MLL\Utils\Tecan\LiquidClass; | ||
|
||
class MLLLiquidClass implements LiquidClass | ||
{ | ||
public const DNA_DILUTION = 'DNA_Dilution'; | ||
public const DNA_DILUTION_WATER = 'DNA_Dilution_Water'; | ||
public const TRANSFER_PCR_PRODUKT = 'Transfer_PCR_Produkt'; | ||
public const TRANSFER_MASTERMIX_MP = 'Transfer_Mastermix_MP'; | ||
public const TRANSFER_TEMPLATE = 'Transfer_Template'; // DNA-templates and BUFFER! | ||
|
||
public string $value; | ||
|
||
public function __construct(string $value) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
public static function DNA_DILUTION(): self | ||
{ | ||
return new self(self::DNA_DILUTION); | ||
} | ||
|
||
public static function DNA_DILUTION_WATER(): self | ||
{ | ||
return new self(self::DNA_DILUTION_WATER); | ||
} | ||
|
||
public static function TRANSFER_PCR_PRODUKT(): self | ||
{ | ||
return new self(self::TRANSFER_PCR_PRODUKT); | ||
} | ||
|
||
public static function TRANSFER_MASTERMIX_MP(): self | ||
{ | ||
return new self(self::TRANSFER_MASTERMIX_MP); | ||
} | ||
|
||
public static function TRANSFER_TEMPLATE(): self | ||
{ | ||
return new self(self::TRANSFER_TEMPLATE); | ||
} | ||
|
||
public function name(): string | ||
{ | ||
return $this->value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace MLL\Utils\Tecan\Rack; | ||
|
||
class MLLLabWareRack implements Rack | ||
{ | ||
public const A = 'A'; | ||
public const MP_CDNA = 'MPCDNA'; | ||
public const MP_SAMPLE = 'MPSample'; | ||
public const MP_WATER = 'MPWasser'; | ||
public const FLUID_X = 'FluidX'; | ||
public const MM = 'MM'; | ||
public const DEST_LC = 'DestLC'; | ||
public const DEST_PCR = 'DestPCR'; | ||
public const DEST_TAQMAN = 'DestTaqMan'; | ||
|
||
public string $value; | ||
|
||
public function __construct(string $value) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
public static function A(): self | ||
{ | ||
return new self(self::A); | ||
} | ||
|
||
public static function MP_CDNA(): self | ||
{ | ||
return new self(self::MP_CDNA); | ||
} | ||
|
||
public static function MP_SAMPLE(): self | ||
{ | ||
return new self(self::MP_SAMPLE); | ||
} | ||
|
||
public static function MP_WATER(): self | ||
{ | ||
return new self(self::MP_WATER); | ||
} | ||
|
||
public static function FLUID_X(): self | ||
{ | ||
return new self(self::FLUID_X); | ||
} | ||
|
||
public static function MM(): self | ||
{ | ||
return new self(self::MM); | ||
} | ||
|
||
public static function DEST_LC(): self | ||
{ | ||
return new self(self::DEST_LC); | ||
} | ||
|
||
public static function DEST_PCR(): self | ||
{ | ||
return new self(self::DEST_PCR); | ||
} | ||
|
||
public static function DEST_TAQMAN(): self | ||
{ | ||
return new self(self::DEST_TAQMAN); | ||
} | ||
|
||
public function id(): ?string | ||
{ | ||
return null; | ||
} | ||
|
||
public function name(): string | ||
{ | ||
return $this->value; | ||
} | ||
|
||
public function type(): string | ||
{ | ||
switch ($this->value) { | ||
case self::A: | ||
return 'Eppis 24x0.5 ml Cooled'; | ||
case self::MP_CDNA: | ||
return 'MP cDNA'; | ||
case self::MP_SAMPLE: | ||
return 'MP Microplate'; | ||
case self::MP_WATER: | ||
return 'Trough 300ml MCA Portrait'; | ||
case self::FLUID_X: | ||
return '96FluidX'; | ||
case self::MM: | ||
return 'Eppis 32x1.5 ml Cooled'; | ||
case self::DEST_LC: | ||
return '96 Well MP LightCycler480'; | ||
case self::DEST_PCR: | ||
return '96 Well PCR ABI semi-skirted'; | ||
case self::DEST_TAQMAN: | ||
return '96 Well PCR TaqMan'; | ||
default: | ||
throw new \Exception('Type not defined for ' . $this->value); | ||
} | ||
} | ||
|
||
public function toString(): string | ||
{ | ||
return implode( | ||
';', | ||
[ | ||
$this->name(), | ||
$this->id(), | ||
$this->type(), | ||
] | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace MLL\Utils\Tests\Tecan\CustomCommands; | ||
|
||
use MLL\Utils\Tecan\CustomCommands\AspirateParameters; | ||
use MLL\Utils\Tecan\CustomCommands\DispenseParameters; | ||
use MLL\Utils\Tecan\CustomCommands\MLLReagentDistribution; | ||
use MLL\Utils\Tecan\LiquidClass\MLLLiquidClass; | ||
use MLL\Utils\Tecan\Rack\MLLLabWareRack; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class MLLReagentDistributionTest extends TestCase | ||
{ | ||
public function testFormatToString(): void | ||
{ | ||
$sourceStartPosition = 13; | ||
$sourceRack = MLLLabWareRack::MM(); | ||
$source = new AspirateParameters($sourceRack, $sourceStartPosition); | ||
|
||
$targetRack = MLLLabWareRack::DEST_PCR(); | ||
$target = new DispenseParameters($targetRack, [48, 49, 72, 73]); | ||
|
||
$dispenseVolume = 24; | ||
$liquidClass = MLLLiquidClass::TRANSFER_MASTERMIX_MP(); | ||
|
||
$command = new MLLReagentDistribution( | ||
$source, | ||
$target, | ||
$dispenseVolume, | ||
$liquidClass, | ||
); | ||
|
||
$numberOfDitiReuses = MLLReagentDistribution::NUMBER_OF_DITI_REUSES; | ||
$numberOfMultiDisp = MLLReagentDistribution::NUMBER_OF_MULTI_DISP; | ||
|
||
self::assertSame( | ||
"R;{$sourceRack->name()};;{$sourceRack->type()};{$sourceStartPosition};{$sourceStartPosition};{$targetRack->name()};;{$targetRack->type()};48;73;{$dispenseVolume};{$liquidClass->name()};{$numberOfDitiReuses};{$numberOfMultiDisp};0;50;51;52;53;54;55;56;57;58;59;60;61;62;63;64;65;66;67;68;69;70;71", | ||
$command->toString() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace MLL\Utils\Tests\Tecan\LiquidClass; | ||
|
||
use MLL\Utils\Tecan\LiquidClass\MLLLiquidClass; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class MLLLiquidClassTest extends TestCase | ||
{ | ||
public function testNameOfEnum(): void | ||
{ | ||
self::assertSame('DNA_Dilution', MLLLiquidClass::DNA_DILUTION()->name()); | ||
self::assertSame('DNA_Dilution_Water', MLLLiquidClass::DNA_DILUTION_WATER()->name()); | ||
self::assertSame('Transfer_PCR_Produkt', MLLLiquidClass::TRANSFER_PCR_PRODUKT()->name()); | ||
self::assertSame('Transfer_Mastermix_MP', MLLLiquidClass::TRANSFER_MASTERMIX_MP()->name()); | ||
self::assertSame('Transfer_Template', MLLLiquidClass::TRANSFER_TEMPLATE()->name()); | ||
} | ||
} |
Oops, something went wrong.