# Comon topology name and address top = 'pNRTapo-strip.pdb' # Number of processors np = 10 # Functions required for parallelization def multi_run_wrapper(args): return f(*args) def f(msm,clL,frame,count): print count structure = msm.draw_samples(clL, 1)[frame] print structure f = md.load(T[structure[0][0]], top=top, frame=structure[0][1]) f.save_pdb(str(count)+'.pdb') print count cluster = pickle.load(open(cl,'rb')) clL = cluster.labels_ msm = io.load(msm) synthTrj = msm.sample_discrete(state = None, n_steps = n_samples) T = [] for trj in sorted(glob.glob(Trjs)): T.append(trj) arg = [(msm,clL,msm_mapping_[synthTrj[count]],count) for count in range(len(synthTrj))] p = Pool(np) S = p.map(multi_run_wrapper, arg)
### Performing kinetic Monte Carlo simulations on Markov state models to estimate the sampling time required to reach the ### target state from an arbitrary inital state using SAXS guided adaptive sampling strategy. ### Required packages: numpy, msmbuilder ### @Chuankai Zhao, [email protected] from msmbuilder.utils import io import numpy as np msm = io.load("MSM25.pkl") Steps = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30 ] Num = 10 Maxrun = 100 Rounds = [round + 1 for round in range(Maxrun)] def loadSAXSdata(): file = open("ProteinG_discrepancy.txt") SAXS = np.loadtxt(file) N_states = np.shape(SAXS)[0] SAXS_dict = {} for i in range(N_states): state = int(SAXS[i][0]) intensity = SAXS[i][1] SAXS_dict[state] = intensity return SAXS_dict
from msmbuilder.utils import io msm = io.load('MSM.pkl') counts = msm.countsmat_ import numpy as np from scipy.optimize import minimize msm.score msm.score_ll sklearn.cross_validation.LeaveOneOut
for j in range(0,parallel_traj[i]): for k in range(0,seq_traj[i]): if os.path.isfile(address+'round'+str(rounds[i]+1)+'/traj_files/par'+str(j+1)+'_sim'+str(k+1)+'.mdcrd')== True: f.write('trajin '+address+'round'+str(rounds[i]+1)+'/traj_files/par'+str(j+1)+'_sim'+str(k+1)+'.mdcrd 1 last 6'+'\n') else: pass f.write('watershell :A8S watershell_pyl10_active.dat W1 lower 3.0 upper 5.0'+ '\n') f.close() #----------------------------------------------------------------------------------- # Calculations of Lys and ser distance from ABA in inactive and active trajectories. from msmbuilder.utils import io #in shadowfax lys=io.load('/home/sshukla4/pyl10/msm/rmsd_dist/dist_data/aba_lys_dist.pkl') ser=io.load('/home/sshukla4/pyl10/msm/rmsd_dist/dist_data/cl2_ser_aba.pkl') inactive_lys=lys[0:90] active_lys=lys[536:576] inactive_ser=ser[0:90] active_ser=ser[536:576] #In lab mac os.chdir('/Users/Saurabh/Dropbox/My_Papers_and_Reports/Papers/ABA_binding/figures/active_inactive/pyl10') inactive_lys=io.load('inactive_lys_aba_pyl10.pkl') active_lys=io.load('active_lys_aba_pyl10.pkl') inactive_ser=io.load('inactive_ser_aba_pyl10.pkl') active_ser=io.load('active_ser_aba_pyl10.pkl')
'--stride', dest='stride', help='Stride of the raw trajectories being subsampled.', default=None, type=int, required=True) args = parser.parse_args() return args ### Main program if __name__ == '__main__': options = parse_cmdln() msm_name = options.msm cl_name = options.cl cluster = pickle.load(open(cl_name, 'rb'), encoding='latin1') msm = io.load(msm_name) cl_label = cluster.labels_ n_samples = options.NS stride = options.stride # Read the topology file and the list of MD raw trajectories top = "/home/amoffet2/msm_network_project/folding/lindorff-larsen_2011_trajs/protein_g-350K/protein_g.pdb" trajnames = glob.glob( "/home/amoffet2/msm_network_project/folding/lindorff-larsen_2011_trajs/protein_g-350K/DESRES-Trajectory_NuG2-*-protein/NuG2-*-protein/*.dcd" ) # Using msmbuilder.draw_samples function to extract 100 structures from each state selects = msm.draw_samples(cl_label, n_samples) pickstates(selects, trajnames, top, stride, options.NP)