Skip to content

Commit

Permalink
#594 Electron Density - Settings read file
Browse files Browse the repository at this point in the history
  • Loading branch information
ak-m2ms committed Apr 14, 2021
1 parent 5c1a7da commit 3bbece4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion js/components/nglView/renderingObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ const showDensity = ({ stage, input_dict, object_name, representations, dispatch
opacity: input_dict.opacity || 1,
opaqueBack: false
};

return Promise.all([
input_dict.sigmaa_url &&
stage.loadFile(input_dict.sigmaa_url, { ext: 'map' }).then(comp => {
Expand All @@ -419,7 +420,8 @@ const showDensity = ({ stage, input_dict, object_name, representations, dispatch
return assignRepresentationArrayToComp(reprArray, comp);
})
]).then(values => {
let val = [...values];
let val = [...values].filter(v => v !== undefined);
return val;
});
};

Expand Down
2 changes: 1 addition & 1 deletion js/components/preview/molecule/redux/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export const addImageToCache = (molId, image) => ({

export const addProteindDataToCache = (molId, proteinData) => ({
type: constants.ADD_PROTEIN_DATA_TO_CACHE,
payload: { molId: molId, image: proteinData }
payload: { molId: molId, proteinData: proteinData }
});
6 changes: 3 additions & 3 deletions js/components/preview/molecule/redux/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import { resetCurrentCompoundSettingsWithoutSelection } from '../../compounds/re
import { selectMoleculeGroup } from '../../moleculeGroups/redux/dispatchActions';
import { setDirectAccessProcessed } from '../../../../reducers/api/actions';
import { MOL_TYPE } from './constants';
import { addImageToCache } from './actions';
import { addImageToCache, addProteindDataToCache } from './actions';
import { OBJECT_TYPE } from '../../../nglView/constants';
import { getRepresentationsByType } from '../../../nglView/generatingObjects';
import { readQualityInformation } from '../../../nglView/renderingHelpers';
Expand Down Expand Up @@ -294,7 +294,7 @@ export const addDensity = (
) => dispatch => {
dispatch(getProteinData(data)).then(i => {
if (i && i.length > 0) {
data.protein_data = i[0];
data.proteinData = i[0];

dispatch(
loadObject({
Expand Down Expand Up @@ -795,7 +795,7 @@ export const getProteinData = molecule => (dispatch, getState) => {
} else {
return loadProteinData(code).then(i => {
if (!proteindDataCache.hasOwnProperty(molIdStr)) {
dispatch(addImageToCache(molId.toString(), i));
dispatch(addProteindDataToCache(molId.toString(), i));
}
return i;
});
Expand Down
4 changes: 3 additions & 1 deletion js/reducers/ngl/dispatchActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ export const loadObject = ({
dispatch
})
.then(representations => {
dispatch(loadNglObject(versionFixedTarget, representations));
if (representations && representations.length > 0) {
dispatch(loadNglObject(versionFixedTarget, representations));
}
})
.catch(error => {
console.error(error);
Expand Down

0 comments on commit 3bbece4

Please sign in to comment.