Bootstrap Analysis — mdpath.src.bootstrap

This module contains the class BootstrapAnalysis which performs bootstrap analysis to determine the confidence in paths generated from the given MD trajectory.

Classes

BootstrapAnalysis

class mdpath.src.bootstrap.BootstrapAnalysis(df_all_residues: DataFrame, df_distant_residues: DataFrame, sorted_paths: list, num_bootstrap_samples: int, numpath: int, pdb: str, last_residue: int, graphdist: int, num_bins: int = 35)[source]

Bases: object

Perform bootstrap analysis on residue dihedral angle movements and path generation to check sample validity.

Attributes:

df_all_residues (pd.DataFrame): DataFrame containing all residue dihedral angle movements.

df_distant_residues (pd.DataFrame): DataFrame containing distant residues.

num_bootstrap_samples (int): Number of bootstrap samples to generate.

pdb (str): Path to the PDB file.

last_residue (int): Index of the last residue.

graphdist (int): Graph distance parameter.

num_bins (int): Number of bins to group dihedral angle movements into for NMI calculation. Defaults to 35.

common_counts (np.ndarray): Array with the counts of common paths between the original sample and bootstrap samples.

path_confidence_intervals (dict): Dictionary with the confidence intervals for each path.

bootstrap_analysis() Tuple[source]

Analyse the common paths between the original sample and bootstrap samples.

Returns:

common_counts (np.array): Array with the counts of common paths between the original sample and bootstrap samples.

path_confidence_intervals (dict): Dictionary with the confidence intervals for each path.

bootstrap_write(file_name: str) None[source]

Writes the path confidence intervals to a file.

Args:

file_name (str): The name of the file to write the path confidence intervals to.

Returns:

None write the path confidence intervals to a file.

create_bootstrap_sample(df_dihedral: DataFrame) tuple[source]

Creates a sample from the dataframe with replacement for bootstrap analysis.

Args:

df_dihedral (pd.DataFrame):Pandas dataframe with residue dihedral angle movements.

Returns:

bootstrap_sample (pd.DataFrame): Pandas dataframe containing the frames for the bootstrap analysis.

process_bootstrap_sample(pathways_set: set, sample_num: int) tuple[source]

Process a bootstrap sample to find common paths with the original sample.

Args:

pathways_set (set): Set of tuples with the pathways for bootstrapping.

sample_num (int): Number of the bootstrap sample.

Returns:

common_count (int): Number of common paths between the bootstrap sample and the original sample.

bootstrap_pathways (list): List of paths within the bootstrap sample.