Skip to content
Snippets Groups Projects
Commit 90d72f06 authored by Michal Malý's avatar Michal Malý
Browse files

Update API

parent 466b5672
No related branches found
No related tags found
No related merge requests found
<?php <?php
// vim: expandtab sw=4 ts=4 sts=4 : // vim: set sw=4 ts=4 sts=4 expandtab :
/** /**
* WebMMB PHP client * WebMMB PHP client
...@@ -460,9 +460,9 @@ class Mobilizer ...@@ -460,9 +460,9 @@ class Mobilizer
} }
/** /**
* Defines NtC class applicable to steps in a Compound * Defines NtC conformation for a given step or range of steps
*/ */
class NtC class NtCConformation
{ {
/** /**
* Name of the chain * Name of the chain
...@@ -524,6 +524,45 @@ class NtC ...@@ -524,6 +524,45 @@ class NtC
} }
} }
/**
* Defines NtCs configuration
*/
class NtCs
{
/**
* Array of all applied NtC conformations
* @var NtCConformation[] $conformations
*/
public array $conformations;
/**
* Global scale factor of the NtC forces
* @var flaot $force_scale_factor;
*/
public float $force_scale_factor;
public function __construct(
array $conformations,
float $force_scale_factor
) {
$this->conformations = $conformations;
$this->force_scale_factor = $force_scale_factor;
}
public static function fromArray(array $data)
{
try {
$obj = new self([], 0);
$obj->conformations = array_get('conformations', $data);
$obj->force_scale_factor = array_get('force_scale_factor', $data);
return $obj;
} catch (\TypeError $ex) {
throw new InvalidDataError($ex->getMessage());
}
}
}
/** /**
* Defines residue number * Defines residue number
*/ */
...@@ -687,9 +726,9 @@ class StandardCommands extends Commands ...@@ -687,9 +726,9 @@ class StandardCommands extends Commands
/** /**
* NtCs to be applied. * NtCs to be applied.
* This shall be set explicitly after the object is constructed. * This shall be set explicitly after the object is constructed.
* @var NtC[] $ntcs * @var NtCs $ntcs
*/ */
public array $ntcs; public object $ntcs;
/** /**
* Advanced job parametrers - currently unavailable * Advanced job parametrers - currently unavailable
* @var $adv_params * @var $adv_params
...@@ -722,7 +761,7 @@ class StandardCommands extends Commands ...@@ -722,7 +761,7 @@ class StandardCommands extends Commands
$this->compounds = []; $this->compounds = [];
$this->double_helices = []; $this->double_helices = [];
$this->base_interactions = []; $this->base_interactions = [];
$this->ntcs = []; $this->ntcs = new NtCs([], 0);
$this->mobilizers = []; $this->mobilizers = [];
$this->adv_params = new AdvParams(); $this->adv_params = new AdvParams();
$this->set_default_MD_parameters = false; $this->set_default_MD_parameters = false;
...@@ -743,9 +782,6 @@ class StandardCommands extends Commands ...@@ -743,9 +782,6 @@ class StandardCommands extends Commands
[ 'name' => 'base_interactions', 'initer' => function (array $data) { [ 'name' => 'base_interactions', 'initer' => function (array $data) {
return BaseInteraction::fromArray($data); return BaseInteraction::fromArray($data);
} ], } ],
[ 'name' => 'ntcs', 'initer' => function (array $data) {
return NtC::fromArray($data);
} ],
[ 'name' => 'mobilizers', 'initer' => function (array $data) { [ 'name' => 'mobilizers', 'initer' => function (array $data) {
return Mobilizer::fromArray($data); return Mobilizer::fromArray($data);
} ] } ]
...@@ -753,6 +789,8 @@ class StandardCommands extends Commands ...@@ -753,6 +789,8 @@ class StandardCommands extends Commands
foreach ($ARRAY_PROPS_INIT as $init) { foreach ($ARRAY_PROPS_INIT as $init) {
$obj->initializeArrayProperty($init['name'], $data, $init['initer']); $obj->initializeArrayProperty($init['name'], $data, $init['initer']);
} }
$obj->ntcs = NtCs::fromArray(array_get('ntcs', $data));
// TODO: adv_params once we start to support them // TODO: adv_params once we start to support them
$obj->set_default_MD_parameters = array_get('set_default_MD_parameters', $data); $obj->set_default_MD_parameters = array_get('set_default_MD_parameters', $data);
...@@ -794,9 +832,9 @@ class DensityFitCommands extends Commands ...@@ -794,9 +832,9 @@ class DensityFitCommands extends Commands
/** /**
* NtCs to be applied. * NtCs to be applied.
* This shall be set explicitly after the object is constructed. * This shall be set explicitly after the object is constructed.
* @var NtC[] $ntcs * @var NtCs $ntcs
*/ */
public array $ntcs = []; public object $ntcs;
/** /**
* Whether to account for electrostatic and Lennard-Jones forces * Whether to account for electrostatic and Lennard-Jones forces
* @var bool $set_default_MD_parameters * @var bool $set_default_MD_parameters
...@@ -834,6 +872,8 @@ class DensityFitCommands extends Commands ...@@ -834,6 +872,8 @@ class DensityFitCommands extends Commands
throw new InvalidOperationError('Invalid name of density map file'); throw new InvalidOperationError('Invalid name of density map file');
} }
$this->ntcs = new NtCs([], 0);
$this->structure_file_name = $structure_file_name; $this->structure_file_name = $structure_file_name;
$this->density_map_file_name = $density_map_file_name; $this->density_map_file_name = $density_map_file_name;
} }
...@@ -847,9 +887,6 @@ class DensityFitCommands extends Commands ...@@ -847,9 +887,6 @@ class DensityFitCommands extends Commands
[ 'name' => 'compounds', 'initer' => function (array $data) { [ 'name' => 'compounds', 'initer' => function (array $data) {
return Compound::fromArray($data); return Compound::fromArray($data);
} ], } ],
[ 'name' => 'ntcs', 'initer' => function (array $data) {
return NtC::fromArray($data);
} ],
[ 'name' => 'mobilizers', 'initer' => function (array $data) { [ 'name' => 'mobilizers', 'initer' => function (array $data) {
return Mobilizer::fromArray($data); return Mobilizer::fromArray($data);
} ] } ]
...@@ -857,6 +894,8 @@ class DensityFitCommands extends Commands ...@@ -857,6 +894,8 @@ class DensityFitCommands extends Commands
foreach ($ARRAY_PROPS_INIT as $init) { foreach ($ARRAY_PROPS_INIT as $init) {
$obj->initializeArrayProperty($init['name'], $data, $init['initer']); $obj->initializeArrayProperty($init['name'], $data, $init['initer']);
} }
$obj->ntcs = NtCs::fromArray(array_get('ntcs', $data));
$obj->structure_file_name = array_get('structure_file_name', $data); $obj->structure_file_name = array_get('structure_file_name', $data);
$obj->density_map_file_name = array_get('density_map_file_name', $data); $obj->density_map_file_name = array_get('density_map_file_name', $data);
$obj->set_default_MD_parameters = array_get('set_default_MD_parameters', $data); $obj->set_default_MD_parameters = array_get('set_default_MD_parameters', $data);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment