pyqmmm.md.hbond_compare

Analyze data from hydrogen bonding analysis based on hbond.gnu file.

Module Contents

Functions

bond_labels(file_path[, ignore_backbone, include_backbone])

Extracts bond labels from gnu file.

count_occurrences(file_path, labels)

Counts percent occurrences of each hydrogen bond.

process_data(count_df, frame_count, name, substrate)

Cleans up hbonding data (formats residue names, dataframe index, etc.)

figure_formatting()

Sets formatting for matplotlib.

plot(data, file_path)

Plot single figure for hbonding analysis.

plot_multi(data, file_path)

Plot hbonding comparison between two trajectories.

analyze_hbonds(file_paths, names, substrate)

Driver for analyzing hbonds from hbond.gnu file

pyqmmm.md.hbond_compare.bond_labels(file_path, ignore_backbone=True, include_backbone=tuple('DHK'))[source]

Extracts bond labels from gnu file.

Parameters:
  • file_path (str) – Path to hbond.gnu file

  • ignore_backbone (bool) – Whether to ignore backbone hydrogen bonds (donor/acceptor named N or O)

  • include_backbone (tuple(str)) – If ignore_backbone, these residues are the exception

Returns:

grouped – DataFrame containing residue pair and interaction index

Return type:

pd.DataFrame

pyqmmm.md.hbond_compare.count_occurrences(file_path, labels)[source]

Counts percent occurrences of each hydrogen bond.

Parameters:
  • file_path (str) – Path to hbond.gnu file

  • labels (str) – Hbond labels as outputted by CPPTRAJ in gnu format

Returns:

  • labels (DataFrame containing residue pair and interaction index)

  • frame_count (total number of frames in trajectory)

pyqmmm.md.hbond_compare.process_data(count_df, frame_count, name, substrate)[source]

Cleans up hbonding data (formats residue names, dataframe index, etc.)

Parameters:
  • count_df (pd.DataFrame) – DataFrame containing the hydrogen bonding counts

  • frame_count (int) – Number of frames in trajectory

  • name (str) – System name

Returns:

count_df – Cleaned DataFrame containing the hydrogen bonding counts

Return type:

pd.DataFrame

pyqmmm.md.hbond_compare.figure_formatting()[source]

Sets formatting for matplotlib.

pyqmmm.md.hbond_compare.plot(data, file_path)[source]

Plot single figure for hbonding analysis.

Parameters:
  • data (pd.DataFrame) – Data that will be used to plot the figure

  • file_path (str) – Path to directory where output image should go

pyqmmm.md.hbond_compare.plot_multi(data, file_path)[source]

Plot hbonding comparison between two trajectories.

Parameters:
  • data (list of two dataframes)

  • file_path (path to directory where output image should go)

pyqmmm.md.hbond_compare.analyze_hbonds(file_paths, names, substrate)[source]

Driver for analyzing hbonds from hbond.gnu file

Parameters:
  • file_paths (list[str]) – A list of paths to hbond.gnu files

  • names (list[str]) – A list of names of each hbond.gnu files