1
- import {
2
- complexObjectTypes ,
3
- generateComplex ,
4
- generateMolecule ,
5
- generateSphere
6
- } from '../../molecule/molecules_helpers' ;
1
+ import { generateSphere } from '../../molecule/molecules_helpers' ;
7
2
import { VIEWS } from '../../../../constants/constants' ;
8
3
import {
9
4
decrementCountOfRemainingMoleculeGroupsWithSavingDefaultState ,
10
5
deleteObject ,
11
6
loadObject
12
7
} from '../../../../reducers/ngl/dispatchActions' ;
13
8
import {
14
- removeFromComplexList ,
15
- removeFromProteinList ,
16
- removeFromSurfaceList ,
17
- removeFromFragmentDisplayList ,
18
- removeFromVectorOnList ,
19
9
resetSelectionState ,
20
10
setComplexList ,
21
11
setFilter ,
22
12
setFragmentDisplayList ,
23
13
setMolGroupSelection ,
24
- setObjectSelection ,
25
14
setVectorList ,
26
15
setVectorOnList
27
16
} from '../../../../reducers/selection/actions' ;
@@ -33,90 +22,12 @@ import { setSortDialogOpen } from '../../molecule/redux/actions';
33
22
import { resetCurrentCompoundsSettings } from '../../compounds/redux/actions' ;
34
23
import { reloadSession } from '../../../snapshot/redux/dispatchActions' ;
35
24
import { resetRestoringState } from '../../../../reducers/tracking/dispatchActions' ;
36
- import { selectJoinedMoleculeList } from '../../molecule/redux/selectors' ;
37
25
import { URLS } from '../../../routes/constants' ;
38
26
39
- export const clearAfterDeselectingMoleculeGroup = ( { molGroupId, currentMolGroup, majorViewStage } ) => (
40
- dispatch ,
41
- getState
42
- ) => {
43
- dispatch ( setObjectSelection ( [ molGroupId ] ) ) ;
44
-
45
- let site ;
46
- const state = getState ( ) ;
47
- const { fragmentDisplayList, complexList, proteinList, surfaceList, vectorOnList, vector_list } = state . selectionReducers ;
48
-
49
- const actionFragmentDisplayList = [ ] ;
50
- const actionComplexList = [ ] ;
51
- const actionProteinList = [ ] ;
52
- const actionSurfaceList = [ ] ;
53
- const actionVectorOnList = [ ] ;
54
-
55
- // loop through all molecules
56
- selectJoinedMoleculeList ( state ) . forEach ( mol => {
57
- site = mol . site ;
58
-
59
- // remove Ligand
60
- dispatch (
61
- deleteObject (
62
- Object . assign ( { display_div : VIEWS . MAJOR_VIEW } , generateMolecule ( mol . protein_code , mol . sdf_info ) ) ,
63
- majorViewStage
64
- )
65
- ) ;
66
-
67
- // remove Complex, Protein, Surface
68
- Object . keys ( complexObjectTypes ) . forEach ( type => {
69
- dispatch (
70
- deleteObject (
71
- Object . assign (
72
- { display_div : VIEWS . MAJOR_VIEW } ,
73
- generateComplex ( mol . protein_code , mol . sdf_info , mol . molecule_protein , type )
74
- ) ,
75
- majorViewStage
76
- )
77
- ) ;
78
- } ) ;
79
-
80
- if ( fragmentDisplayList . find ( ligand => ligand === mol . id ) ) actionFragmentDisplayList . push ( mol ) ;
81
- if ( complexList . find ( ligand => ligand === mol . id ) ) actionComplexList . push ( mol ) ;
82
- if ( proteinList . find ( ligand => ligand === mol . id ) ) actionProteinList . push ( mol ) ;
83
- if ( surfaceList . find ( ligand => ligand === mol . id ) ) actionSurfaceList . push ( mol ) ;
84
- if ( vectorOnList . find ( ligand => ligand === mol . id ) ) actionVectorOnList . push ( mol ) ;
85
- } ) ;
86
- dispatch ( setMolGroupOff ( molGroupId , {
87
- ligand : actionFragmentDisplayList ,
88
- protein : actionProteinList ,
89
- complex : actionComplexList ,
90
- surface : actionSurfaceList ,
91
- vector : actionVectorOnList
92
- } ) ) ;
93
-
94
- // remove all Vectors
95
- vector_list
96
- . filter ( v => v . site === site )
97
- . forEach ( item => {
98
- dispatch ( deleteObject ( Object . assign ( { display_div : VIEWS . MAJOR_VIEW } , item ) , majorViewStage ) ) ;
99
- } ) ;
100
-
101
- dispatch ( setObjectSelection ( undefined ) ) ;
102
-
27
+ export const clearAfterDeselectingMoleculeGroup = ( { molGroupId } ) => dispatch => {
103
28
// remove all molecule orientations
104
29
dispatch ( setMoleculeOrientations ( { } ) ) ;
105
-
106
- // remove all selected ALCV of given site
107
- currentMolGroup . mol_id . forEach ( moleculeID => {
108
- // remove Ligand, Complex, Vectors from selection
109
- //Ligand
110
- dispatch ( removeFromFragmentDisplayList ( { id : moleculeID } , true ) ) ;
111
- // Complex
112
- dispatch ( removeFromComplexList ( { id : moleculeID } , true ) ) ;
113
- // Protein
114
- dispatch ( removeFromProteinList ( { id : moleculeID } , true ) ) ;
115
- // Surface
116
- dispatch ( removeFromSurfaceList ( { id : moleculeID } , true ) ) ;
117
- // Vectors
118
- dispatch ( removeFromVectorOnList ( { id : moleculeID } , true ) ) ;
119
- } ) ;
30
+ dispatch ( setMolGroupOff ( molGroupId ) ) ;
120
31
} ;
121
32
122
33
export const saveMoleculeGroupsToNglView = ( molGroupList , stage , projectId ) => dispatch => {
@@ -288,13 +199,7 @@ export const onDeselectMoleculeGroup = ({ moleculeGroup, stageSummaryView, major
288
199
const mol_group_selection = state . selectionReducers . mol_group_selection ;
289
200
const selectionCopy = mol_group_selection . slice ( ) ;
290
201
const objIdx = mol_group_selection . indexOf ( moleculeGroup . id ) ;
291
- dispatch (
292
- clearAfterDeselectingMoleculeGroup ( {
293
- molGroupId : moleculeGroup . id ,
294
- currentMolGroup,
295
- majorViewStage
296
- } )
297
- ) ;
202
+ dispatch ( clearAfterDeselectingMoleculeGroup ( { molGroupId : moleculeGroup . id } ) ) ;
298
203
selectionCopy . splice ( objIdx , 1 ) ;
299
204
dispatch (
300
205
deleteObject (
0 commit comments