Skip to content

Commit

Permalink
Merge pre-release/2024-R5.3 (and pre-release/2024-R5.2) into master (#…
Browse files Browse the repository at this point in the history
…882)

* LIMS-1498: Change name of processed data archive (#855)

* LIMS-1469: Fix download button on old summary page (#840)

* LIMS-1463: Always display Mesh3D data collections as grid scans (#845)

* LIMS-1515: Add energy value to data collections (#853)

* LIMS-261: Allow download of PDB files (#857)

* LIMS-1529: Fix fast ep model viewer (#858)

* LIMS-753: Allow LN2 topups as part of dewar history (#856)

* LIMS-1530: Add To Queue Fails when Not Completed filter applied (#864)

* LIMS-1530: Add To Queue Fails when Not Completed filter applied

* LIMS-1552: Remove old jquery (#871)

* LIMS-1500: Set the dispatch request email recipients based on the dewar barcode (#848)

* LIMS-1458: Fix GitHub warnings (#841)

---------

Co-authored-by: Mark Williams <[email protected]>
Co-authored-by: Guilherme Francisco <[email protected]>
  • Loading branch information
3 people authored Dec 16, 2024
1 parent 0904d6d commit 7eb2aab
Show file tree
Hide file tree
Showing 39 changed files with 294 additions and 230 deletions.
16 changes: 8 additions & 8 deletions api/scripts/mtz2map.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ else
fi
fi

#export CCP4_MASTER=/dls_sw/apps/ccp4/<ccp4 version>
export CCP4_MASTER=$5
export CINCL=$CCP4_MASTER/include
export CLIBD=$CCP4_MASTER/lib/data

export CCP4_SCR=/tmp
export root=$CCP4_MASTER/bin

if [ $3 == 'dimple' -o $3 == 'mrbump' ]; then

if [ -f $4 ]; then
Expand All @@ -28,14 +36,6 @@ else
fi
fi

#export CCP4_MASTER=/dls_sw/apps/ccp4/<ccp4 version>
export CCP4_MASTER=$5
export CINCL=$CCP4_MASTER/include
export CLIBD=$CCP4_MASTER/lib/data

export CCP4_SCR=/tmp
export root=$CCP4_MASTER/bin

if [ $3 == 'dimple' ]; then

if $root/mtzinfo $mtz | grep -q PH2FOFCWT; then
Expand Down
8 changes: 4 additions & 4 deletions api/src/Page/Cell.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ function _beamlines()
$pdb = $this->db->pq("SELECT TO_CHAR(p.pdbdate, 'YYYY') as year, $replace as bl, count(p.pdbentryid) as count
FROM pdbentry p
WHERE p.pdbdate > TO_DATE('2010-05', 'YYYY-MM')
GROUP BY $replace, TO_CHAR(p.pdbdate, 'YYYY')
ORDER BY TO_CHAR(p.pdbdate, 'YYYY')");
GROUP BY bl, year
ORDER BY year, bl");

$isp = $this->db->pq("SELECT TO_CHAR(p.pdbdate, 'YYYY') as year, CASE WHEN p.autoprocprogramid > 0 THEN UPPER(s.beamlinename) ELSE $replace END as bl, count(p.pdbentryid) as count
FROM pdbentry p
Expand All @@ -284,8 +284,8 @@ function _beamlines()
INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid
INNER JOIN blsession s ON s.sessionid = dcg.sessionid
WHERE p.pdbdate > TO_DATE('2010-05', 'YYYY-MM')
GROUP BY CASE WHEN p.autoprocprogramid > 0 THEN UPPER(s.beamlinename) ELSE $replace END, TO_CHAR(p.pdbdate, 'YYYY')
ORDER BY TO_CHAR(p.pdbdate, 'YYYY')");
GROUP BY bl, year
ORDER BY year, bl");

foreach ($pdb as $i => &$s) {
$s['COUNT'] = intval(($s['COUNT']));
Expand Down
38 changes: 28 additions & 10 deletions api/src/Page/DC.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class DC extends Page
array('/dat/:id', 'get', '_plot'),
);

const EVTOA = 12398.4198;

# ------------------------------------------------------------------------
# Data Collection AJAX Requests
# This is pretty crazy, it will return unioned data collections, energy
Expand Down Expand Up @@ -422,9 +424,12 @@ function _data_collections($single = null)
dc.transmission,
dc.axisrange,
dc.wavelength,
".self::EVTOA."/dc.wavelength as energy,
dc.comments,
1 as epk,
1 as ein,
1 as wpk,
1 as win,
dc.xtalsnapshotfullpath1 as x1,
dc.xtalsnapshotfullpath2 as x2,
dc.xtalsnapshotfullpath3 as x3,
Expand Down Expand Up @@ -556,9 +561,12 @@ function _data_collections($single = null)
min(dc.transmission) as transmission,
min(dc.axisrange) as axisrange,
min(dc.wavelength) as wavelength,
".self::EVTOA."/min(dc.wavelength) as energy,
min(dc.comments) as comments,
1 as epk,
1 as ein,
1 as wpk,
1 as win,
min(dc.xtalsnapshotfullpath1) as x1,
min(dc.xtalsnapshotfullpath2) as x2,
min(dc.xtalsnapshotfullpath3) as x3,
Expand Down Expand Up @@ -705,17 +713,20 @@ function _data_collections($single = null)
es.energyscanid,
1,
es.element,
es.peakfprime,
es.peakfprime as resolution,
es.exposuretime,
es.axisposition,
es.peakfdoubleprime,
es.peakfdoubleprime as numimg,
es.starttime as st,
es.transmissionfactor,
es.inflectionfprime,
es.inflectionfdoubleprime,
es.inflectionfprime as axisrange,
es.inflectionfdoubleprime as wavelength,
1 as energy,
es.comments,
es.peakenergy,
es.inflectionenergy,
".self::EVTOA."/es.peakenergy as wpk,
".self::EVTOA."/es.inflectionenergy as win,
'A',
'A',
'A',
Expand Down Expand Up @@ -805,10 +816,13 @@ function _data_collections($single = null)
TO_CHAR(xrf.starttime, 'DD-MM-YYYY HH24:MI:SS') as st,
xrf.beamtransmission,
1,
xrf.energy,
".self::EVTOA."/xrf.energy as wavelength,
xrf.energy as energy,
xrf.comments,
1,
1,
1 as wpk,
1 as win,
'A',
'A',
'A',
Expand Down Expand Up @@ -899,9 +913,12 @@ function _data_collections($single = null)
1,
1,
1,
1 as energy,
'A',
1,
1,
1 as wpk,
1 as win,
r.xtalsnapshotbefore,
r.xtalsnapshotafter,
'A',
Expand Down Expand Up @@ -974,7 +991,7 @@ function _data_collections($single = null)

// Data collections
if ($dc['TYPE'] == 'data') {
$nf = array(1 => array('AXISSTART', 'CHISTART', 'PHI', 'OVERLAP'), 2 => array('RESOLUTION', 'TRANSMISSION', 'AXISRANGE', 'TOTALDOSE'), 4 => array('WAVELENGTH', 'EXPOSURETIME'));
$nf = array(0 => array('ENERGY'), 1 => array('AXISSTART', 'CHISTART', 'PHI', 'OVERLAP'), 2 => array('RESOLUTION', 'TRANSMISSION', 'AXISRANGE', 'TOTALDOSE'), 4 => array('WAVELENGTH', 'EXPOSURETIME'));

$dc['DIRFULL'] = $dc['DIR'];
$dc['DIR'] = preg_replace('/.*\/' . $this->arg('prop') . '-' . $dc['VN'] . '\//', '', $dc['DIR']);
Expand All @@ -993,9 +1010,10 @@ function _data_collections($single = null)
$dc['DCT'] = 'Data Collection';
}

if ($dc['DCT'] == 'Mesh')
if ($dc['DCT'] == 'Mesh' || $dc['DCT'] == 'Mesh3D' ||
($dc['DCT'] != 'Serial Fixed' && $dc['DCT'] != 'Serial Jet' && $dc['AXISRANGE'] == 0 && $dc['NI'] > 1)
) {
$dc['DCT'] = 'Grid Scan';
if ($dc['DCT'] != 'Serial Fixed' && $dc['DCT'] != 'Serial Jet' && $dc['AXISRANGE'] == 0 && $dc['NI'] > 1) {
$dc['TYPE'] = 'grid';
}
//$this->profile('dc');
Expand All @@ -1010,12 +1028,12 @@ function _data_collections($single = null)

$dc['FILETEMPLATE'] = preg_replace('/.*\/' . $this->arg('prop') . '-' . $dc['VN'] . '\//', '', $dc['FILETEMPLATE']);

$nf = array(2 => array('EXPOSURETIME', 'AXISSTART', 'RESOLUTION', 'TRANSMISSION'));
$nf = array(1 => array('EPK', 'EIN'), 2 => array('AXISRANGE', 'WAVELENGTH', 'EXPOSURETIME', 'AXISSTART', 'RESOLUTION', 'TRANSMISSION', 'NUMIMG'), 5 => array('WPK', 'WIN'));
$this->profile('edge');

// MCA Scans
} else if ($dc['TYPE'] == 'mca') {
$nf = array(2 => array('EXPOSURETIME', 'WAVELENGTH', 'TRANSMISSION'));
$nf = array(0 => array('ENERGY'), 2 => array('EXPOSURETIME', 'TRANSMISSION'), 4 => array('WAVELENGTH'));
$dc['DIRFULL'] = $dc['DIR'];
$dc['DIR'] = preg_replace('/.*\/\d\d\d\d\/\w\w\d+-\d+\//', '', $dc['DIR']);

Expand Down
10 changes: 4 additions & 6 deletions api/src/Page/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ function _download_visit()
$this->_error('There doesnt seem to be a data archive available for this visit');
}

# ------------------------------------------------------------------------
# Download mtz/log file for Fast DP / XIA2
# TODO: Delete me

# This method either returns a list of plots from MX auto processing tools (n_obs, n_uniq, completeness etc.)
# Or returns a specific plot based on auto processing attachment id (aid).
# Individual plotly format Graphs can be returned via an aid, but will not be included in the list of plots (as their format is different)
Expand Down Expand Up @@ -468,14 +466,14 @@ function _get_autoproc_archive()

$aps = $this->db->union(
array(
"SELECT app.autoprocprogramid, app.processingprograms, app.processingstatus
"SELECT app.autoprocprogramid, app.processingprograms, app.processingstatus, dc.imageprefix, dc.datacollectionnumber
FROM autoprocintegration api
INNER JOIN autoprocprogram app ON api.autoprocprogramid = app.autoprocprogramid
INNER JOIN datacollection dc ON dc.datacollectionid = api.datacollectionid
INNER JOIN datacollectiongroup dcg ON dcg.datacollectiongroupid = dc.datacollectiongroupid
INNER JOIN blsession s ON s.sessionid = dcg.sessionid
WHERE s.proposalid=:1 AND app.autoprocprogramid=:2",
"SELECT app.autoprocprogramid, app.processingprograms, app.processingstatus
"SELECT app.autoprocprogramid, app.processingprograms, app.processingstatus, dc.imageprefix, dc.datacollectionnumber
FROM autoprocprogram app
INNER JOIN processingjob pj on pj.processingjobid = app.processingjobid
INNER JOIN datacollection dc ON dc.datacollectionid = pj.datacollectionid
Expand All @@ -497,7 +495,7 @@ function _get_autoproc_archive()
}

$clean_program = preg_replace('/[^A-Za-z0-9\-]/', '', $ap['PROCESSINGPROGRAMS']);
$zipName = $this->arg('AUTOPROCPROGRAMID') . '_' . $clean_program;
$zipName = $this->arg('AUTOPROCPROGRAMID') . '_' . $ap['IMAGEPREFIX'] . '_' . $ap['DATACOLLECTIONNUMBER'] . '_' . $clean_program;
$this->_streamZipFile($files, $zipName);
}

Expand Down
16 changes: 16 additions & 0 deletions api/src/Page/Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class Sample extends Page
array('/pdbs(/pid/:pid)', 'get', '_get_pdbs'),
array('/pdbs', 'post', '_add_pdb'),
array('/pdbs(/:pdbid)', 'delete', '_remove_pdb'),
array('/pdbs/download/:pdbid', 'get', '_download_pdb'),

array('/concentrationtypes', 'get', '_concentration_types'),
array('/componenttypes', 'get', '_component_types'),
Expand Down Expand Up @@ -2062,6 +2063,21 @@ function _get_pdbs()
$this->_output($rows);
}

# ------------------------------------------------------------------------
# Download a pdb file
function _download_pdb()
{
if (!$this->has_arg('pdbid'))
$this->_error('No PDB id specified');

$pdb = $this->db->pq("SELECT name, contents FROM pdb WHERE pdbid = :1", array($this->arg('pdbid')));
$pdb = $pdb[0];

header('Content-Type:text/plain');
header('Content-Disposition:attachment;filename='.$pdb['NAME']);
print $pdb['CONTENTS'];
}

# ------------------------------------------------------------------------
# Add a new pdb
function _add_pdb()
Expand Down
Loading

0 comments on commit 7eb2aab

Please sign in to comment.