Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/vue_master'
Browse files Browse the repository at this point in the history
  • Loading branch information
drnasmith committed Aug 17, 2021
2 parents 99ea896 + 68c05ef commit c2b8e95
Show file tree
Hide file tree
Showing 308 changed files with 19,978 additions and 5,677 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ This file should be copied to create a client/src/js/config.json file and edited
| ga_ident | Google Analytics id|
| site_name | Site Name to display in footer |
| site_link | URL to site home page |
| site_image | PNG image of site logo to display in header|
| data_catalogue | Object that includes name and url property for a link to a data catalogue - displayed on the landing page |

Site Image can be customised via the tailwind.config.js header-site-logo and footer-site-logo values.

### Build front end
See package.json for the full list of commands that can be run.
Expand Down
58 changes: 25 additions & 33 deletions api/config_sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,39 +89,12 @@
'pipeline=dials ' => 'DIALS',
);

# Filtered downstream jobs
$downstream_filter = array();

# Crystal alignment programs
$strat_align = array('XOalign', 'dials.align_crystal');

# Places to search for autoprocessing and screening statuses. File scraping is done if no database value is available.
$ap_statuses = array(
'locations' => array('/processed', 'tmp'),

'types' => array(
'screening' => array(
# Name on datacollectionpage => (folder, log file, grep for success, database name for matching)
"Mosflm" => array('simple_strategy/', 'strategy_native.log', 'Phi start'),
"EDNA" => array('edna/', 'summary.html', 'Selected spacegroup'),
),
'autoproc' => array(
"Fast DP" => array('fast_dp/', 'fast_dp.log', 'I/sigma', 'fast_dp'),

"Xia2/3dii" => array('xia2/3dii-run/', 'xia2.txt' , 'I/sigma', 'xia2 3dii'),
"DIALS" => array('xia2/dials-run/', 'xia2.txt' , 'I/sigma', 'xia2 dials'),

"Xia2/Multiplex" => array('xia2.multiplex/', 'xia2.multiplex.log' , 'clustering summary', 'xia2.multiplex'),

"autoPROC" => array('autoPROC/ap-run/', 'autoPROC.log', 'Normal termination', 'autoPROC'),
),
'downstream' => array(
"Fast EP" => array('fast_ep/', 'fast_ep.log', 'Best hand:'),
"Dimple" => array('fast_dp/dimple/', 'refmac5_restr.log', 'DPI'),
"MrBUMP" => array('auto_mrbump/', 'MRBUMP.log', 'Looks like MrBUMP succeeded'),
"Big EP/XDS" => array('big_ep/', '/xia2/3dii-run/big_ep*.log', 'Results for', ''),
"Big EP/DIALS" => array('big_ep/', '/xia2/dials-run/big_ep_*.log', 'Results for', 'Residues'),
)
)
);

# Active MQ - Set to empty string to disable
$activemq_server = 'tcp://activemq.server.ac.uk';
$activemq_rp_queue = '/queue/zocolo.name';
Expand Down Expand Up @@ -282,9 +255,28 @@
# This maps beamlinename in blsession to a proposal type
# - Internal maps a beamline to an api "type", there are currently:
# mx, gen, em
$bl_types = array('mx' => array('i02', 'i03', 'i04'),
'gen' => array('i11'),
);
$bl_types = array(
array(
'name' => 'i02',
'group' => 'mx',
'archived' => True
),
array(
'name' => 'i03',
'group' => 'mx',
'archived' => False
),
array(
'name' => 'i04',
'group' => 'mx',
'archived' => False
),
array(
'name' => 'i11',
'group' => 'gen',
'archived' => False
)
);


# Webcam IPs
Expand Down
5 changes: 2 additions & 3 deletions api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,9 @@
});

$app->get('/options', function () use ($app) {
global $motd, $authentication_type, $cas_url, $cas_sso, $package_description, $facility_courier_countries, $facility_courier_countries_nde, $dhl_enable, $dhl_link, $scale_grid, $preset_proposal, $ap_statuses, $timezone, $valid_components;
global $motd, $authentication_type, $cas_url, $cas_sso, $package_description, $facility_courier_countries, $facility_courier_countries_nde, $dhl_enable, $dhl_link, $scale_grid, $preset_proposal, $timezone, $valid_components, $enabled_container_types;
$app->contentType('application/json');
$app->response()->body(json_encode(array('motd' => $motd, 'authentication_type' => $authentication_type, 'cas_url' => $cas_url, 'cas_sso' => $cas_sso, 'package_description' => $package_description, 'facility_courier_countries' => $facility_courier_countries, 'facility_courier_countries_nde' => $facility_courier_countries_nde, 'dhl_enable' => $dhl_enable, 'dhl_link' => $dhl_link, 'scale_grid' => $scale_grid, 'preset_proposal' => $preset_proposal, 'ap_statuses' => $ap_statuses['types'], 'timezone' => $timezone, 'valid_components' => $valid_components)));
// $app->response()->body(json_encode($options->ui()));
$app->response()->body(json_encode(array('motd' => $motd, 'authentication_type' => $authentication_type, 'cas_url' => $cas_url, 'cas_sso' => $cas_sso, 'package_description' => $package_description, 'facility_courier_countries' => $facility_courier_countries, 'facility_courier_countries_nde' => $facility_courier_countries_nde, 'dhl_enable' => $dhl_enable, 'dhl_link' => $dhl_link, 'scale_grid' => $scale_grid, 'preset_proposal' => $preset_proposal, 'timezone' => $timezone, 'valid_components' => $valid_components, 'enabled_container_types' => $enabled_container_types)));
});

// the following prevents unexpected effects when using objects as save handlers
Expand Down
4 changes: 2 additions & 2 deletions api/scripts/mtz2map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ gzip "/tmp/$2_$3_fofc.map"


else
$root/fft HKLIN $1 MAPOUT "/tmp/$2_ep.map" << eof
$root/fft HKLIN $1 MAPOUT "/tmp/$2_$3.map" << eof
title $2 fofc
xyzlim asu
scale F1 1.0
Expand All @@ -82,6 +82,6 @@ eof
#BORDER 5
#eof

gzip "/tmp/$2_ep.map"
gzip "/tmp/$2_$3.map"

fi
8 changes: 7 additions & 1 deletion api/src/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ function check_auth_required() {
# Allow barcode reader ips unauthorised access to add history
($parts[0] == 'shipment' && $parts[1] == 'dewars' && $parts[2] == 'history' && in_array($_SERVER["REMOTE_ADDR"], $bcr)) ||

# Allow barcode reader ips unauthorised access to add comments
($parts[0] == 'shipment' && $parts[1] == 'dewars' && $parts[2] == 'comments' && in_array($_SERVER["REMOTE_ADDR"], $bcr)) ||

# Container notification: allow beamlines running in automated mode to notify users
($parts[0] == 'shipment' && $parts[1] == 'containers' && $parts[2] == 'notify' && in_array($_SERVER["REMOTE_ADDR"], $auto))
($parts[0] == 'shipment' && $parts[1] == 'containers' && $parts[2] == 'notify' && in_array($_SERVER["REMOTE_ADDR"], $auto)) ||

# Allow barcode reader ips unauthorised access to add container history
($parts[0] == 'shipment' && $parts[1] == 'containers' && $parts[2] == 'history' && in_array($_SERVER["REMOTE_ADDR"], $bcr))
) {
$need_auth = false;
}
Expand Down
30 changes: 30 additions & 0 deletions api/src/Database/Type/MySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ function tablelookup($query)
'XrayCentringResult',

'BeamCalendar',
'SpaceGroup',

// MR
'MXMRRun',
'MXMRRunBlob',
);

foreach ($tables as $table) {
Expand Down Expand Up @@ -421,6 +426,31 @@ function pq($query, $args = array())

}

// Union multiple queries that take the same arguments and return the same columns
// Query can optionally be wrapped, where :QUERY will be replaced with the inner query:
// $wrapper = 'SELECT * FROM (:QUERY) GROUP BY id';
function union($queries, $args, $all=false, $wrapper=null) {
$nargs = sizeof($args);
$all_args = array();
$union_kw = $all ? 'UNION ALL' : 'UNION';
foreach ($queries as $i => &$query) {
$offset = $i * $nargs;
$query = preg_replace_callback('/\:(\d+)/',
function($mat) use ($offset) {
return ':'.(intval($mat[1]) + $offset);
},
$query);
$all_args = array_merge($all_args, $args);
}

$union = implode("\n$union_kw\n", $queries);
if ($wrapper) {
$union = preg_replace('/:QUERY/', $union, $wrapper);
}

return $this->pq($union, $all_args);
}

function set_explain($exp)
{

Expand Down
150 changes: 150 additions & 0 deletions api/src/Downstream/BigEPPhasing.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<?php

namespace SynchWeb\Downstream;

use SynchWeb\Downstream\DownstreamPlugin;
use SynchWeb\Downstream\DownstreamResult;

class BigEPPhasing extends DownstreamPlugin {
var $has_images = true;
var $has_mapmodel = array(1, 1);

function results() {
$dat = array();

if (array_key_exists('program_id', $this->process['PARAMETERS'])) {
$integrator = $this->_lookup_autoproc(
$this->process['PARAMETERS']['program_id']
);
if ($integrator) {
$dat['PARENTAUTOPROCPROGRAM'] =
$integrator['PROCESSINGPROGRAMS'];
$dat['PARENTAUTOPROCPROGRAMID'] =
$integrator['AUTOPROCPROGRAMID'];
}
}

$image = $this->_get_image();
$dat['IMAGE'] = file_exists($image);

$model = $this->_get_attachments('big_ep_model_ispyb.json');
$dat['HASMODEL'] = $model && file_exists($model['FILE']);
if ($model) {
if (file_exists($model['FILE'])) {
$json_str = file_get_contents($model['FILE']);
$json_data = json_decode($json_str, true);
foreach (
array(
'RESID' => array('total', 0),
'FRAGM' => array('fragments', 0),
'MAXLEN' => array('max', 0),
'MAPCC' => array('mapcc', 2),
'MAPRESOL' => array('mapcc_dmin', 2),
)
as $k => $v
) {
if (array_key_exists($v[0], $json_data)) {
$dat[$k] = number_format($json_data[$v[0]], $v[1]);
} else {
$dat[$k] = null;
}
}
}
}

# Read SHELXC logs
$shx_log = $this->_get_attachments(null, null, "shelxc.log");
if (sizeof($shx_log)) {
$shx_log = $shx_log[0]['FILE'];
$graph_patterns = array(
'CHISQ' => array('Chi-sq', 2),
'ISIGI' => array('<I/sig>', 2),
'DSIG' => array('<d"/sig>', 2),
'CC12' => array('CC(1/2)', 2),
'RESO' => array('Resl.', 3),
);


if (file_exists($shx_log)) {
$lst = explode("\n", file_get_contents($shx_log));
$graphs = array();
foreach ($lst as $l) {
foreach ($graph_patterns as $k => $gr) {
if (strpos($l, $gr[0]) == 1) {
$graphs[$k] = array_map(
'floatval',
array_slice(preg_split('/\s+/', $l), $gr[1])
);
}
}
}

$dat['SHELXC'] = array();
foreach (array_keys($graph_patterns) as $k) {
if ($k != 'RESO' and array_key_exists($k, $graphs)) {
$dat['SHELXC'][$k] = array();
}
}
if (array_key_exists('RESO', $graphs)) {
foreach ($graphs['RESO'] as $i => $r) {
foreach (array_keys($dat['SHELXC']) as $k) {
if (array_key_exists($i, $graphs[$k])) {
array_push($dat['SHELXC'][$k], array(
1.0 / pow($r, 2),
$graphs[$k][$i],
));
}
}
}
}
}
}

$results = new DownstreamResult($this);
$results->data = $dat;

return $results;
}

function _get_image() {
$images = $this->_get_attachments(null, null, '.png');
if (sizeof($images)) {
return $images[0]['FILEPATH'] . '/' . $images[0]['FILENAME'];
}
}

function images($n = 0) {
return $this->_get_image();
}

function mapmodel($n = 0, $map = false) {
if ($map) {
$maps = $this->_get_attachments(null, null, '.map');
if (!sizeof($maps)) {
return;
}
$map = $maps[0];

$out =
'/tmp/' .
$this->autoprocprogramid .
'_' .
$this->type .
'_map.gz';
if (!file_exists($out) && file_exists($map['FILE'])) {
file_put_contents(
$out,
gzencode(file_get_contents($map['FILE']))
);
}

return $out;
} else {
$pdbs = $this->_get_attachments(null, null, '.pdb');
if (!sizeof($pdbs)) {
return;
}
return $pdbs[0]['FILE'];
}
}
}

0 comments on commit c2b8e95

Please sign in to comment.