Skip to content

Commit

Permalink
Merge pull request #474 from olofsvensson/issue_472
Browse files Browse the repository at this point in the history
Issue #472 and ISPYB-91 : Improvements of display of MR results
  • Loading branch information
olofsvensson authored Nov 14, 2018
2 parents 36845f6 + 2c98672 commit f3e2d13
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 20 deletions.
77 changes: 59 additions & 18 deletions js/mx/view/phasingview/phasinggridview.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,63 @@ PhasingGridView.prototype.printHTML = function(target) {
if (steps[z].metric){
toBePushed = getMetrics(steps[z]);
}

/* Opening uglymol with:
1) pdb file
2) map1 as first map file
3) map2 as second map file
*/
var pdbUrl = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( steps[z].pdb);

if ( steps[z].map != null){
if (step == "MODEL_BUILDING") {
/* Opening uglymol with:
1) pdb file
2) map1 as first map file
3) map2 as second map file
*/
var pdbUrl = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( steps[z].pdb);
if ( steps[z].map != null){
var mapsArr = steps[z].map.split(",");
if (mapsArr.length == 2){
var mapUrl1 = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( mapsArr[0]);
var mapUrl2 = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( mapsArr[1]);
toBePushed["uglymol"] = '../viewer/uglymol/index.html?pdb=' + pdbUrl + '&map1=' + mapUrl1 + '&map2=' + mapUrl2;
}
}
} else if (step == "REFINEMENT") {
var pdbFileId = -1;
var listUglyMol = [];
var mapsArr = steps[z].map.split(",");
if (mapsArr.length == 2){
var mapUrl1 = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( mapsArr[0]);
var mapUrl2 = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( mapsArr[1]);
toBePushed["uglymol"] = '../viewer/uglymol/index.html?pdb=' + pdbUrl + '&map1=' + mapUrl1 + '&map2=' + mapUrl2;
var pdbsArr = steps[z].pdb.split(",");
var mapFileNamesArr = steps[z].mapFileName.split(",");
for (var i = 0; i < mapFileNamesArr.length; i++) {
mapFileNamesArr[i] = mapFileNamesArr[i].slice(0, -4)
}
}
var pdbFileNamesArr = steps[z].pdbFileName.split(",");
for (var i = 0; i < pdbFileNamesArr.length; i++) {
if (pdbFileNamesArr[i] == "refined.pdb") {
pdbFileId = pdbsArr[i];
}
}
if (pdbFileId != -1) {
index2FOFC_MR = mapFileNamesArr.indexOf("2FOFC_MR");
indexFOFC_MR = mapFileNamesArr.indexOf("FOFC_MR");
index2FOFC_REFINE = mapFileNamesArr.indexOf("2FOFC_REFINE");
indexFOFC_REFINE = mapFileNamesArr.indexOf("FOFC_REFINE");
if ( (index2FOFC_MR == -1) || (indexFOFC_MR) == -1) {
listUglyMol.push("");
} else {
var pdbUrl = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( pdbFileId );
var mapUrl1 = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( mapsArr[index2FOFC_MR]);
var mapUrl2 = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( mapsArr[indexFOFC_MR]);
listUglyMol.push('../viewer/uglymol/index.html?pdb=' + pdbUrl + '&map1=' + mapUrl1 + '&map2=' + mapUrl2);
}
if ( (index2FOFC_REFINE == -1) || (indexFOFC_REFINE == -1) ) {
listUglyMol.push("");
} else {
var pdbUrl = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( pdbFileId );
var mapUrl1 = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( mapsArr[index2FOFC_REFINE]);
var mapUrl2 = EXI.getDataAdapter().mx.phasing.downloadPhasingFilesByPhasingAttachmentId( mapsArr[indexFOFC_REFINE]);
listUglyMol.push('../viewer/uglymol/index.html?pdb=' + pdbUrl + '&map1=' + mapUrl1 + '&map2=' + mapUrl2);
}
} else {
listUglyMol.push("");
listUglyMol.push("");
}
toBePushed["listUglyMol"] = listUglyMol;
}
/** It will add only the files coming from these steps */
toBePushed["downloadFilesUrl"] = EXI.getDataAdapter().mx.phasing.getDownloadFilesByPhasingStepIdURL(parseDownloadAttachments(steps[z]));
node["metrics"].push(toBePushed);
Expand All @@ -185,6 +226,10 @@ PhasingGridView.prototype.printHTML = function(target) {
node = getNodeByPhasingStep(node, stepsBySpaceGroup, "MODELBUILDING");
}
else{
if (_.find(stepsBySpaceGroup, {"PhasingStep_phasingStepType" : "REFINEMENT"}) != null){
node = getNodeByPhasingStep(node, stepsBySpaceGroup, "REFINEMENT");
}
else{
/** There is no model building the we parse the phasing*/
if (_.find(stepsBySpaceGroup, {"PhasingStep_phasingStepType" : "PHASING"}) != null){
node = getNodeByPhasingStep(node, stepsBySpaceGroup, "PHASING");
Expand All @@ -193,10 +238,6 @@ PhasingGridView.prototype.printHTML = function(target) {
if (_.find(stepsBySpaceGroup, {"PhasingStep_phasingStepType" : "SUBSTRUCTUREDETERMINATION"}) != null){
node = getNodeByPhasingStep(node, stepsBySpaceGroup, "SUBSTRUCTUREDETERMINATION");
}
else{
if (_.find(stepsBySpaceGroup, {"PhasingStep_phasingStepType" : "REFINEMENT"}) != null){
node = getNodeByPhasingStep(node, stepsBySpaceGroup, "REFINEMENT");
}
else{
node = getNodeByPhasingStep(node, stepsBySpaceGroup, "PREPARE");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
<th style='color:gray'>Program</th>
<th style='color:gray'>Method</th>
<th style='color:gray'>Resolution</th>

<th style='color:gray'>Electron density MR</th>
<th style='color:gray'>Electron density REFINE</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -67,7 +68,16 @@
<td>{.PhasingProgramRun_phasingPrograms} </td>
<td>{.PhasingStep_method} </td>
<td>{.PhasingStep_highRes} - {.PhasingStep_lowRes} </td>

{#listUglyMol}
{@eq key="{.}" value=""}
<td></td>
{:else}
<td>
<a><a target="_blank" href='{.}' ><span style='font-size: 1em;' class="glyphicon glyphicon-eye-open" ></span></a>
</td>
{/eq}
{/listUglyMol}

</tr>
{/metrics}
{/.parsed}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@
{/SpaceGroupModelResolvedByPhasing}
</div>
</div>
<div class="container-fluid" style="padding-bottom: 10px;">
<div class="col-xs-12 col-md-12">
{?SpaceGroupModelResolvedByMr}
<div class="alert alert-success" style='font-size:14px;'>
Automatic MR appears to have worked with the space group {.SpaceGroupModelResolvedByMr}
</div>
{/SpaceGroupModelResolvedByMr}
</div>
</div>
</div>
</div>
<div id="experimentparameters_{.DataCollection_dataCollectionId}" class="tab-pane fade">
Expand Down

0 comments on commit f3e2d13

Please sign in to comment.