Data = dataIO.readData(options.data_FN) # first reshape the data into trajectories. Lens = Proj["TrajLengths"] Trajs = [] sum = 0 for i in range(len(Lens)): Trajs.append(Data[sum : sum + Lens[i]]) sum += Lens[i] Folds = [] Unfolds = [] for traj in Trajs: (a, b) = msmTools.calcRawFoldTime(traj, options.f_cut, options.u_cut, low_is_folded=options.low_is_folded) Folds.extend(a) Unfolds.extend(b) # FoldsDist = bincount( Folds ) # UnfoldsDist = bincount( Unfolds ) figure() subplot(211) foldHist = hist(Folds, bins=100, color="blue", label="Fold") vlines(mean(Folds), 0, ylim()[1], color="black", linewidth=3) ylabel("Frequency") legend() xFolds = xlim() subplot(212) unfoldHist = hist(Unfolds, bins=100, color="red", label="Unfold")
options, args = parser.parse_args() from numpy import * from pyschwancr import dataIO, msmTools import os, sys, re # first make the xvg. os.system('echo "0 0" | g_rms -f %s -s %s -o %s_rmsd.xvg' % ( options.traj_FN, options.struc_FN, options.traj_FN ) ) xvgIn = open( '%s_rmsd.xvg' % options.traj_FN, 'r' ) dat = [] for line in xvgIn: if line[0] in [ '#', '@' ]: continue else: dat.append( [ float( i ) for i in line.split() ] ) dat = array( dat ) hist( dat[:,1], bins=100 ) savefig('%s_dist.pdf' % options.traj_FN ) #Find the correct cutoffs to use... I'm going to simply use the two maxima. Folds, Unfolds = msmTools.calcRawFoldTime( dat[:,1], options.f_cut, options.u_cut, low_is_folded = True ) savetxt( options.out_FN[:-4] + '_FoldTimes.dat', Folds ) savetxt( options.out_FN[:-4] + '_UnfoldTimes.dat', Unfolds )