def test_HydrogenBondLifetimes(self, universe, selection): hbonds = MDAnalysis.analysis.hbonds.HydrogenBondAnalysis(universe, selection, selection, distance=3.5, angle=120.0) hbonds.run(start=0, stop=4) hbonds.autocorrelation(tau_max=3) assert_almost_equal(hbonds.acf_timeseries[3], 0.75)
def test_HydrogenBondLifetimes_growing_continuous(self, universe, selection): hbonds = MDAnalysis.analysis.hbonds.HydrogenBondAnalysis(universe, selection, selection, distance=3.5, angle=120.0) hbonds.run(start=0, stop=9) hbonds.autocorrelation(tau_max=5) assert all([frame >= framePlus1 for frame, framePlus1 in zip(hbonds.acf_timeseries, hbonds.acf_timeseries[1:])])
def get_hbonds(self, distance=3.0, angle=160.0): sys.path.insert(0, "/home/joe/git/md_analysis/") import joe_hbonds as joe self.hbond_distance = distance self.hbond_angle = angle hbonds = joe.HydrogenBondAnalysis(self.universe, 'protein', 'protein', update_selection1=True, update_selection2=True, detect_hydrogens='distance', distance=self.hbond_distance, angle=self.hbond_angle, distance_type="heavy") hbonds.run() hbonds_occupancy = hbonds.count_by_type() hbonds_occupancy_list = hbonds_occupancy.tolist() fp = open(self.out_path + self.out_file + "_hbonds.dat", 'w') for i in range(len(hbonds_occupancy_list)): fp.write("{0}\n".format(hbonds_occupancy_list[i])) fp.close()
def GetTimeSeries(psf, dcd, outname, libpath): """ Get time series data for Hbond (MDanalysis) :param psf: PSF file :param dcd: trajectory file (DCD) :param outname: output name :return: times series results (Pandas dataframe) """ donor, acceptor, head, glycerol, phos = CollectHbondCandInfo(libpath) universe = mda.Universe(psf, dcd) hbonds = mda.analysis.hbonds.HydrogenBondAnalysis(universe, "segid MEMB", "segid PROA", donors=donor, acceptors=acceptor) hbonds.run() hbonds.generate_table() hbonds_data = pd.DataFrame.from_records(hbonds.table) hbonds_data.to_csv("%s_hbonds_analysis_raw_data.csv" % outname) return hbonds_data
# This code computes the H-bond occupancy # Here we are considering only the H-bonds from the # Has to be upgraded to use pandas import MDAnalysis import MDAnalysis.analysis.hbonds var1 = '/Users/keshavpatil/Desktop/BRAF/100ns_unbiased/active_braf/unb100.xtc' var2 = '/Users/keshavpatil/Desktop/BRAF/100ns_unbiased/active_braf/unb100.gro' u = MDAnalysis.Universe(var2, var1) hbonds = MDAnalysis.analysis.hbonds.HydrogenBondAnalysis(u, 'protein', 'protein', distance=3.0, angle=120.0) hbonds.run() hbonds_occupancy = hbonds.count_by_type() hbonds_occupancy_list = hbonds_occupancy.tolist() # get the specific H-bonds: # By specific I mean: the H-bonds whose either the # donor_atom or the acceptor_atom or both belong to # alpha-helix or the activation loop # This is ofcourse dependent on the # type of kinase. The github repository which # has the info on this for somewhere around hundreds of # kinases is: https://github.com/ejjordan/mutator/blob/master/all_kinase.csv # Take this input from the user print('Enter the threshold for the h-bond occupany') threshold = input()