Skip to content

Commit edfa884

Browse files
authored
Merge pre-release/2025-R3.3 into master (#954)
* LIMS-1550: Add 'Mark Dispensing' button to plate well view (#869) * LIMS-167: Dont default to mx type for calendar/logistics views (#942) * LIMS-1716: Multicrystal processing only shows one DC per group (#938) * LIMS-1718: Display cluster info on multiplex jobs (#937) * LIMS-1752: Create view for Ligand Fit pipeline (#943)
1 parent 90d96d1 commit edfa884

File tree

20 files changed

+350
-22
lines changed

20 files changed

+350
-22
lines changed

api/src/Database/Type/MySQL.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ class MySQL extends DatabaseParent {
7575
'DewarReport',
7676
'CourierTermsAccepted',
7777

78+
'BLSamplePosition',
7879
'BLSubSample',
7980
'PDB',
8081
'Protein_has_PDB',
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
namespace SynchWeb\Downstream\Type;
4+
5+
use SynchWeb\Downstream\DownstreamPlugin;
6+
use SynchWeb\Downstream\DownstreamResult;
7+
8+
class LigandFit extends DownstreamPlugin {
9+
var $has_images = true;
10+
var $friendlyname = 'LigandFit';
11+
var $has_mapmodel = array(1, 0);
12+
13+
function _get_ligandfit_results_json() {
14+
$appid = array($this->autoprocprogramid);
15+
$filepath = $this->db->pq(
16+
"SELECT app.filePath, app.filename from autoprocprogramattachment app where autoprocprogramid = :1 and filename like '%.json' ",
17+
$appid
18+
);
19+
return $filepath;
20+
}
21+
22+
function _get_ligandfit_results_png() {
23+
$appid = array($this->autoprocprogramid);
24+
$filepath = $this->db->pq(
25+
"SELECT app.filepath, app.filename from autoprocprogramattachment app where autoprocprogramid = :1 and filename like '%.png' ",
26+
$appid
27+
);
28+
return $filepath;
29+
}
30+
31+
function _get_model_appaid() {
32+
$appid = array($this->autoprocprogramid);
33+
$filepath = $this->db->pq(
34+
"SELECT app.autoprocprogramattachmentid from autoprocprogramattachment app where autoprocprogramid = :1 and filename like '%.html' ",
35+
$appid
36+
);
37+
if (sizeof($filepath)) {
38+
return $filepath[0]["AUTOPROCPROGRAMATTACHMENTID"];
39+
} else {
40+
return;
41+
}
42+
}
43+
44+
function results() {
45+
$json_filepath = $this->_get_ligandfit_results_json();
46+
if (sizeof($json_filepath)) {
47+
$json_path = $json_filepath[0]["FILEPATH"] . "/" . $json_filepath[0]["FILENAME"] ;
48+
$json_data = file_get_contents($json_path);
49+
} else {
50+
$json_data = "[]";
51+
}
52+
$dat = array();
53+
$appaid = $this->_get_model_appaid();
54+
$dat['BLOBS'] = $appaid ? 1 : 0;
55+
$dat['MODEL_APPAID'] = $appaid;
56+
$dat['SOLUTIONS'] = json_decode($json_data);
57+
$dat['PARENTAUTOPROCPROGRAM'] = $this->process['PROCESSINGCOMMENTS'];
58+
59+
$results = new DownstreamResult($this);
60+
$results->data = $dat;
61+
62+
return $results;
63+
}
64+
65+
function images($n = 0) {
66+
$png = $this->_get_ligandfit_results_png();
67+
if (sizeof($png)) {
68+
return $png[0]["FILEPATH"] . "/" . $png[0]["FILENAME"];
69+
} else {
70+
return;
71+
}
72+
}
73+
}

api/src/Page/DC.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class DC extends Page
3737
'PERSONID' => '\d+',
3838
'AUTOPROCPROGRAMMESSAGEID' => '\d+',
3939
'PROCESSINGJOBID' => '\d+',
40+
'expandgroups' => '\d',
4041
'debug' => '\d',
4142
'sgid' => '\d+'
4243
);
@@ -381,7 +382,7 @@ function _data_collections($single = null)
381382
}
382383

383384
# Set Count field
384-
if ($this->has_arg('dcg') || $this->has_arg('PROCESSINGJOBID') || $this->has_arg('sgid')) {
385+
if ($this->has_arg('dcg') || $this->has_arg('PROCESSINGJOBID') || $this->has_arg('sgid') || $this->has_arg('expandgroups')) {
385386
$count_field = 'dc.datacollectionid';
386387
} else {
387388
$count_field = 'distinct dc.datacollectiongroupid';
@@ -616,6 +617,9 @@ function _data_collections($single = null)
616617
IFNULL(max(dc.rotationaxis), 'Omega') as rotationaxis,
617618
dc.detector2theta";
618619
$groupby = "GROUP BY dc.datacollectiongroupid";
620+
if ($this->has_arg('expandgroups')) {
621+
$groupby = "GROUP BY dc.datacollectionid";
622+
}
619623
}
620624

621625
// We don't want to remove duplicates, since if two counts are equal, one might go uncounted

api/src/Page/Processing.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,7 @@ private function _autoprocessing_query_builder($where, $group, $order = '') {
978978
(SELECT COUNT(api1.autoprocintegrationid) FROM autoprocintegration api1 WHERE api1.autoprocprogramid = app.autoprocprogramid) as imagesweepcount,
979979
app.processingstatus,
980980
app.processingmessage,
981+
app.processingenvironment,
981982
count(distinct pjis.datacollectionid) as dccount,
982983
max(pjis.processingjobid) as processingjobid,
983984
(SELECT IFNULL(blsg.name, bls.name) FROM processingjobparameter pjp
@@ -1059,6 +1060,9 @@ private function _format_auto_processing_result($table_rows, $messages_result) {
10591060
if ($row['GROUPNAME']) {
10601061
$value .= ' ('.$row['GROUPNAME'].')';
10611062
}
1063+
if ($row['PROCESSINGENVIRONMENT'] && strpos($row['PROCESSINGENVIRONMENT'], 'cluster=') !== false) {
1064+
$value .= ' ('.$row['PROCESSINGENVIRONMENT'].')';
1065+
}
10621066
}
10631067

10641068

api/src/Page/Proposal.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,11 @@ function _get_visits($visit = null, $output = true)
389389
}
390390

391391
if ($this->has_arg('ty')) {
392-
$beamlines = $this->_get_beamlines_from_type($this->arg('ty'));
392+
if ($this->arg('ty') == 'calendar') {
393+
$beamlines = $this->_get_beamlines_from_type($this->ty);
394+
} else {
395+
$beamlines = $this->_get_beamlines_from_type($this->arg('ty'));
396+
}
393397

394398
if (!empty($beamlines)) {
395399
$bls = implode("', '", $beamlines);

api/src/Page/Sample.php

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ class Sample extends Page
9393
'scid' => '\d+-\d+',
9494

9595
'BLSAMPLEID' => '\d+',
96-
'X' => '\d+(.\d+)?',
97-
'Y' => '\d+(.\d+)?',
96+
'X' => '\d*(.\d+)?',
97+
'Y' => '\d*(.\d+)?',
9898
'Z' => '\d+(.\d+)?',
9999
'X2' => '\d+(.\d+)?',
100100
'Y2' => '\d+(.\d+)?',
@@ -799,6 +799,9 @@ private function get_sub_samples_query($where, $first_inner_select_where = '', $
799799
po2.posx as x2,
800800
po2.posy as y2,
801801
po2.posz as z2,
802+
bsp.posx as dispensex,
803+
bsp.posy as dispensey,
804+
bsp.posz as dispensez,
802805
IF(cqs.containerqueuesampleid IS NOT NULL AND cqs.containerqueueid IS NULL, 1, 0) as readyforqueue,
803806
cq.containerqueueid,
804807
count(distinct IF(dc.overlap != 0,
@@ -824,7 +827,7 @@ private function get_sub_samples_query($where, $first_inner_select_where = '', $
824827
INNER JOIN shipping sh ON sh.shippingid = d.shippingid
825828
INNER JOIN proposal p ON p.proposalid = sh.proposalid
826829
827-
830+
LEFT OUTER JOIN blsampleposition bsp ON bsp.blsampleid = s.blsampleid
828831
LEFT OUTER JOIN containerqueuesample cqs ON cqs.blsubsampleid = ss.blsubsampleid
829832
LEFT OUTER JOIN containerqueue cq ON cqs.containerqueueid = cq.containerqueueid AND cq.completedtimestamp IS NULL
830833
@@ -1903,11 +1906,12 @@ function _update_sample()
19031906
if (!$this->has_arg('sid'))
19041907
$this->_error('No sampleid specified');
19051908

1906-
$samp = $this->db->pq("SELECT b.blsampleid, pr.proteinid,cr.crystalid,dp.diffractionplanid
1909+
$samp = $this->db->pq("SELECT b.blsampleid, pr.proteinid,cr.crystalid,dp.diffractionplanid,bsp.blsamplepositionid
19071910
FROM blsample b
19081911
INNER JOIN crystal cr ON cr.crystalid = b.crystalid
19091912
INNER JOIN protein pr ON pr.proteinid = cr.proteinid
19101913
LEFT OUTER JOIN diffractionplan dp on dp.diffractionplanid = b.diffractionplanid
1914+
LEFT OUTER JOIN blsampleposition bsp ON bsp.blsampleid = b.blsampleid AND bsp.positiontype='dispensing'
19111915
WHERE pr.proposalid = :1 AND b.blsampleid = :2", array($this->proposalid, $this->arg('sid')));
19121916

19131917
if (!sizeof($samp))
@@ -1980,6 +1984,34 @@ function _update_sample()
19801984
}
19811985
}
19821986
}
1987+
1988+
if ($this->has_arg('X') && $this->has_arg('Y')) {
1989+
$z = $this->has_arg('Z') ? $this->arg('Z') : null;
1990+
$pid = $samp['BLSAMPLEPOSITIONID'];
1991+
if ($this->arg('X') == '' && $this->arg('Y') == '') {
1992+
if (!empty($pid)) {
1993+
$this->db->pq(
1994+
"UPDATE blsampleposition SET posx=null, posy=null, posz=null, recordtimestamp=CURRENT_TIMESTAMP WHERE blsamplepositionid=:1",
1995+
array($pid)
1996+
);
1997+
}
1998+
} else {
1999+
if (empty($pid)) {
2000+
$this->db->pq(
2001+
"INSERT INTO blsampleposition (blsampleid, posx, posy, posz, positiontype, recordtimestamp)
2002+
VALUES (:1, :2, :3, :4, 'dispensing', CURRENT_TIMESTAMP) RETURNING blsamplepositionid INTO :id",
2003+
array($this->arg('sid'), $this->arg('X'), $this->arg('Y'), $z)
2004+
);
2005+
$pid = $this->db->id();
2006+
} else {
2007+
$this->db->pq(
2008+
"UPDATE blsampleposition SET posx=:1, posy=:2, posz=:3, recordtimestamp=CURRENT_TIMESTAMP WHERE blsamplepositionid=:4",
2009+
array($this->arg('X'), $this->arg('Y'), $z, $pid)
2010+
);
2011+
}
2012+
}
2013+
$this->_output(array('BLSAMPLEPOSITIONID' => $pid));
2014+
}
19832015
}
19842016

19852017

api/src/Page/Shipment.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,11 @@ function _get_dewars()
16771677
}
16781678

16791679
if ($this->has_arg('ty')) {
1680-
$bls_tmp = $this->_get_beamlines_from_type($this->arg('ty'));
1680+
if ($this->arg('ty') == 'overview') {
1681+
$bls_tmp = $this->_get_beamlines_from_type($this->ty);
1682+
} else {
1683+
$bls_tmp = $this->_get_beamlines_from_type($this->arg('ty'));
1684+
}
16811685
if (!empty($bls_tmp)) {
16821686
$bls = implode("', '", $bls_tmp);
16831687
$where .= " AND se.beamlinename IN ('$bls')";

client/src/css/partials/_content.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,11 @@ li:last-child .visit_users {
10821082
width: 40.5%;
10831083
height: 300px;
10841084

1085+
&.map {
1086+
width: 30%;
1087+
height: auto;
1088+
}
1089+
10851090
&.image-third {
10861091
width: 32.4%;
10871092

client/src/js/models/sample.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@ define(['backbone', 'collections/components',
1818
this.listenTo(this, 'change:RADIATIONSENSITIVITY', this.updateRadSen)
1919
this.updateRadSen()
2020

21+
this.listenTo(this, 'change:X', this.updatePosition)
22+
2123
this.listenTo(this, 'change', this.updateHasData)
2224
this.updateHasData()
2325

2426
},
2527

28+
updatePosition: function() {
29+
this.save(this.changedAttributes(), { patch: true })
30+
},
31+
2632
updateHasData: function() {
2733
var hasData = this.get('DC') > 0 || this.get('GR') > 0 || this.get('SC') > 0
2834
if (hasData !== this.get('HASDATA')) this.set('HASDATA', hasData)
@@ -98,7 +104,10 @@ define(['backbone', 'collections/components',
98104
VOLUME: '',
99105
INITIALSAMPLEGROUP: '',
100106
COMPONENTIDS: [],
101-
COMPONENTAMOUNTS: []
107+
COMPONENTAMOUNTS: [],
108+
X: null,
109+
Y: null,
110+
Z: null,
102111
},
103112

104113
validation: {
@@ -225,6 +234,15 @@ define(['backbone', 'collections/components',
225234
required: false,
226235
pattern: 'word'
227236
},
237+
X: {
238+
required: false
239+
},
240+
Y: {
241+
required: false
242+
},
243+
Z: {
244+
required: false
245+
},
228246

229247
COMPONENTAMOUNTS: function(from_ui, attr, all_values) {
230248
var values = all_values.components.pluck('ABUNDANCE')

client/src/js/modules/calendar/views/calendar-view.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export default {
244244
all: 1,
245245
}
246246
247-
if (app.staff) queryParams.ty = this.proposalType
247+
if (app.staff) queryParams.ty = 'calendar'
248248
if (this.selectedBeamline !== 'all') queryParams.bl = this.selectedBeamline
249249
250250
const visitsCollection = new Visits(null, {

0 commit comments

Comments
 (0)