run_dirs = [] for ii in range(20): run_dirs.append('/DESRES-Trajectory_pnas2011a-A-'+str(ii)+'-no-water-no-lipid/pnas2011a-A-'+str(ii)+'-no-water-no-lipid') dir_top = '/home/shenglan/topologies' times_path = parent_dir+run_dirs[0]+'/'+run_dirs[0].split('/')[-1]+'_times.csv' LOAD_STRIDE = 10 colors = np.array([x for x in 'bgrcmykbgrcmykbgrcmykbgrcmyk']) colors = np.hstack([colors] * 20) #load list of mdtraj objects simulations = [] for this_run_dir in run_dirs: simulations.append(util.load_trajs(this_run_dir,parent_dir,dir_top,load_stride = LOAD_STRIDE)) #track atoms in ligands inds =[] #indices of Cs in the aromatic ring atoms_in_ring = ['C8','C9','C10','C11','C12','C13'] ligands = [residue for residue in simulations[0][0].topology.chain(1).residues][:-1] for ligand in ligands: iis = [atom.index for atom in simulations[0][0].topology.chain(1).atoms if atom.name in atoms_in_ring and atom.residue == ligand] 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:
run_dirs.append('/DESRES-Trajectory_pnas2011a-C-' + str(ii) + '-no-water-no-lipid/pnas2011a-C-' + str(ii) + '-no-water-no-lipid') dir_top = '/home/shenglan/topologies' times_path = parent_dir + run_dirs[0] + '/' + run_dirs[0].split( '/')[-1] + '_times.csv' LOAD_STRIDE = None N_CLUSTER = 1000 #load list of mdtraj objects simulations = [] for this_run_dir in run_dirs: simulations.append( util.load_trajs(this_run_dir, parent_dir, dir_top, load_stride=LOAD_STRIDE)) #track atoms in ligands inds_N = [] #indices of N atom atoms_to_track = ['N'] ligands = ['ALP%d' % (ii + 1) for ii in range(10)] 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 str(atom.residue) == ligand ] inds_N.append(iis) inds_all = [] #indices of all atoms, separated by ligands
dir_top = '/home/shenglan/topologies' times_path = parent_dir + run_dirs[0] + '/' + run_dirs[0].split( '/')[-1] + '_times.csv' files = [] for this_file in os.listdir(parent_dir + run_dirs[0]): if this_file.endswith('.dcd'): files.append(this_file) files = sorted(files) LOAD_STRIDE = 10000 test_run = run_dirs[0] test_traj = util.load_trajs(test_run, parent_dir, dir_top, load_stride=LOAD_STRIDE) 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)
for ii in range(number_of_sims): run_dirs.append('/DESRES-Trajectory_pnas2011a-C-'+str(ii)+'-no-water-no-lipid/pnas2011a-C-'+str(ii)+'-no-water-no-lipid') dir_top = '/home/shenglan/topologies' times_path = parent_dir+run_dirs[0]+'/'+run_dirs[0].split('/')[-1]+'_times.csv' files = [] for this_file in os.listdir(parent_dir+run_dirs[0]): if this_file.endswith('.dcd'): files.append(this_file) files = sorted(files) LOAD_STRIDE = 10000 test_run = run_dirs[0] test_traj = util.load_trajs(test_run,parent_dir,dir_top,load_stride = LOAD_STRIDE) 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