for this_sim in simulations:
    for this_atom_pair in atom_pairs:
        this_lig = []
        for this_traj in [this_sim]:
            this_lig.extend(
                md_dist.compute_distances(this_traj, [this_atom_pair]))
        distances.append(this_lig)

dist_path = '/home/shenglan/TryMSMbuilder/output/ten_ligands/dist_to_binding'\
+'_s'+str(LOAD_STRIDE)+'.out'
pickle.dump(distances, open(dist_path, 'wb'))

# get N positions
sequences_all = []
for this_sim in simulations:
    this_seq = util.featurize_RawPos(inds_N, [this_sim])
    sequences_all.extend(this_seq)
seq_path = '/home/shenglan/TryMSMbuilder/output/ten_ligands/sequences' + '_s' + str(
    LOAD_STRIDE) + '.out'
pickle.dump(sequences_all, open(seq_path, 'wb'))

clustering = KCenters(n_clusters=N_CLUSTER)
geo_assign = clustering.fit_predict(sequences_all)
centers = clustering.cluster_centers_

geo_assign_path = '/home/shenglan/TryMSMbuilder/output/ten_ligands/KC_geoassign_c' \
+str(N_CLUSTER)+'_s'+str(LOAD_STRIDE)+'.out'
pickle.dump(geo_assign, open(geo_assign_path, 'wb'))

micro_msm = MarkovStateModel(lag_time=1,
                             reversible_type='transpose',
Пример #2
0
    inds.append(iis)

#track residue Aps113
first_res = str(simulations[0][0].topology.chain(0).residue(0))
import re
match = re.match(r"([a-z]+)([0-9]+)", first_res, re.I)
if match:
    items = match.groups()
first_res_number = int(items[-1])
target_res = simulations[0][0].topology.chain(0).residue(113-first_res_number)
res_ind = [atom.index for atom in target_res.atoms if atom.name in ['OD1']]

#sequences of coordinates of ligand aromatic ring and Aps113
sequences_all = []
for this_sim in simulations:
    this_seq = util.featurize_RawPos(inds,this_sim)
    sequences_all.extend(this_seq)

#print len(sequences_all)
#print sequences_all[-1].shape

#average position of Asp113
#res_pos_ave = np.mean(res_pos_A_1[0],axis = 0)
# 
time_step = util.calc_time_step(times_path,stride = LOAD_STRIDE)
# 
clustering = KCenters(n_clusters = 10)
assignments = clustering.fit_predict(sequences_all)
centers = clustering.cluster_centers_

#print len(assignments)
Пример #3
0
ligands = ['ALP%d' % (ii + 1) for ii in range(10)]
print ligands

print test_traj[0].topology.chain(0).atom(4667).residue
for ligand in ligands:
    iis = [
        atom.index for atom in test_traj[0].topology.chain(0).atoms if
        atom.element.symbol in atoms_to_track and str(atom.residue) == ligand
    ]
    inds_N.append(iis)

# inds_N = [[atom.index] for atom in test_traj[0].topology.chain(0).atoms if atom.element.symbol in atoms_to_track
#            and atom.residue.name== 'ALP']
print inds_N

test_seq = util.featurize_RawPos(inds_N, test_traj)
print test_seq[0][0]
print test_seq[1][0]

for atom_idx in inds_N:
    print(tuple(test_traj[0].xyz[0, atom_idx, :]))

print(tuple(test_traj[0].xyz[0, 4979, :]))

print test_traj[0]
#
# test_traj2 = md.load_dcd(parent_dir + run_dirs[0] + '/' + files[0]
#                                     , top = '/home/shenglan/topologies/test.pdb'
#                                     , stride = LOAD_STRIDE
#                                     )
#
Пример #4
0
    inds_N.append(iis)

inds_all = []  #indices of all atoms, separated by ligands
for ligand in ligands:
    iis = [
        atom.index for atom in simulations[0][0].topology.chain(0).atoms
        if str(atom.residue) == ligand
    ]
    inds_all.append(iis)

# #sequences of coordinates of ligands and Aps113
total_frames = 0
sequences_all = []
for this_sim in simulations:
    if use_COM:
        this_seq = util.featurize_RawPos(inds_all, this_sim, average=True)
    else:
        this_seq = util.featurize_RawPos(inds_N, this_sim)
    total_frames = this_seq[0].shape[0] * 10 + total_frames
    sequences_all.extend(this_seq)
print('the total number of conformations we are clustering is %d.' %
      total_frames)

time_step = util.calc_time_step(times_path, stride=LOAD_STRIDE)

clustering = KCenters(n_clusters=N_CLUSTER)
assignments = clustering.fit_predict(sequences_all)
centers = clustering.cluster_centers_
#
# print len(assignments)
# print assignments[1].shape
Пример #5
0
for ligand in ligands:
    iis = [atom.index for atom in simulations[0][0].topology.chain(0).atoms if atom.element.symbol in atoms_to_track
          and atom.residue == ligand]
    inds_N.append(iis)
    
inds_all = [] #indices of all atoms, separated by ligands
for ligand in ligands:
    iis = [atom.index for atom in simulations[0][0].topology.chain(0).atoms if atom.residue == ligand]
    inds_all.append(iis)

#sequences of coordinates of ligands and Aps113
total_frames = 0
sequences_all = []
for this_sim in simulations:
    if use_COM:
        this_seq = util.featurize_RawPos(inds_all,this_sim,average = True)
    else:
        this_seq = util.featurize_RawPos(inds_N,this_sim)
    total_frames = this_seq[0].shape[0]*10+total_frames
    sequences_all.extend(this_seq)
print('the total number of conformations we are clustering is %d.' % total_frames)

# print len(sequences_all)
# print sequences_all[-1].shape


# res_pos = []
# res_pos_ave =[]
# total_frames = 0
# for this_sim in simulations:
#     this_seq = util.featurize_RawPos(res_ind,this_sim)
distances = []
for this_sim in simulations:
    for this_atom_pair in atom_pairs:
        this_lig = []
        for this_traj in [this_sim]: 
            this_lig.extend(md_dist.compute_distances(this_traj,[this_atom_pair]))
        distances.append(this_lig)

dist_path = '/home/shenglan/TryMSMbuilder/output/ten_ligands/dist_to_binding'\
+'_s'+str(LOAD_STRIDE)+'.out'
pickle.dump(distances,open(dist_path,'wb'))

# get N positions
sequences_all = []
for this_sim in simulations:
    this_seq = util.featurize_RawPos(inds_N,[this_sim])
    sequences_all.extend(this_seq)
seq_path = '/home/shenglan/TryMSMbuilder/output/ten_ligands/sequences'+'_s'+str(LOAD_STRIDE)+'.out'
pickle.dump(sequences_all,open(seq_path,'wb'))

clustering = KCenters(n_clusters = N_CLUSTER)
geo_assign = clustering.fit_predict(sequences_all)
centers = clustering.cluster_centers_

geo_assign_path = '/home/shenglan/TryMSMbuilder/output/ten_ligands/KC_geoassign_c' \
+str(N_CLUSTER)+'_s'+str(LOAD_STRIDE)+'.out'
pickle.dump(geo_assign,open(geo_assign_path,'wb'))

micro_msm = MarkovStateModel(lag_time=1, reversible_type = 'transpose', 
ergodic_cutoff = 'off'
,verbose=True).fit(geo_assign)
Пример #7
0
inds_N =[] #indices of N atom
atoms_to_track =['N']
ligands = ['ALP%d'%(ii+1) for ii in range(10)]
print ligands

print test_traj[0].topology.chain(0).atom(4667).residue
for ligand in ligands:
    iis = [atom.index for atom in test_traj[0].topology.chain(0).atoms if atom.element.symbol in atoms_to_track
          and str(atom.residue)==ligand]
    inds_N.append(iis)

# inds_N = [[atom.index] for atom in test_traj[0].topology.chain(0).atoms if atom.element.symbol in atoms_to_track
#            and atom.residue.name== 'ALP']
print inds_N

test_seq = util.featurize_RawPos(inds_N,test_traj)
print test_seq[0][0]
print test_seq[1][0]

for atom_idx in inds_N: 
    print(tuple(test_traj[0].xyz[0, atom_idx,:]))

print(tuple(test_traj[0].xyz[0, 4979,:]))

print test_traj[0]
# 
# test_traj2 = md.load_dcd(parent_dir + run_dirs[0] + '/' + files[0]
#                                     , top = '/home/shenglan/topologies/test.pdb'
#                                     , stride = LOAD_STRIDE
#                                     )
#