dylightful package
Submodules
dylightful.bar_plot module
- dylightful.bar_plot.make_barplot(time_ser, ylabel, yticks, prefix=None, save_path=None)[source]
Craeates and saves bar plot
- Args:
time_ser ([type]): by paser.get_timeseries processed pml time series of features path ([type], optional): Where to save. Defaults to None. prefix ([type], optional): Name of the file
dylightful.discretizer module
- dylightful.discretizer.find_states_gaussian(proj, prefix, save_path, num_cluster=15, tol=0.01)[source]
Cluster the projection to get realy discretized values necessary for the MSM
- Args:
proj ([type]): [description] num_cluster (int, optional): [description]. Defaults to 15. tol (float, optional): [description]. Defaults to 0.01.
- dylightful.discretizer.find_states_kmeans(proj, prefix, save_path, num_cluster=15, tol=0.01, plotting=True)[source]
Cluster the projection to get realy discretized values necessary for the MSM
- Args:
proj ([type]): [description] num_cluster (int, optional): [description]. Defaults to 15. tol (float, optional): [description]. Defaults to 0.01.
- dylightful.discretizer.plot_ellbow_kmeans(metric, prefix=None, save_path=None, name='_ellbow_kMeans.png', ylabel='Sum of squared distances $R$')[source]
Plots the sum of squared distances for K-Means to do the ellbow method visually
- Args:
sum_of_squared_distances ([type]): [description] file_name ([type], optional): [description]. Defaults to None. save_path ([type], optional): [description]. Defaults to None.
- Returns:
None
- dylightful.discretizer.plot_scores_kmeans(metric, prefix=None, save_path=None, name='_scores_kmeans.png')[source]
Plots the scores of the k_means finder
- Args:
sum_of_squared_distances ([type]): [description] file_name ([type], optional): [description]. Defaults to None. save_path ([type], optional): [description]. Defaults to None.
- Returns:
None
- dylightful.discretizer.plot_tae_training(tae_model, prefix=None, save_path=None)[source]
Plots the loss function for the trainig of the TAE model.
- Args:
tae_model ([type]): [description] file_name ([type], optional): [description]. Defaults to None. save_path ([type], optional): [description]. Defaults to None.
- dylightful.discretizer.plot_tae_transform(proj, prefix=None, save_path=None)[source]
Plots the transformation obtained by the TAE model.
- Args:
proj ([type]): [description] num_steps (int, optional): [description]. Defaults to 1000. file_name ([type], optional): [description]. Defaults to None. save_path ([type], optional): [description]. Defaults to None.
- dylightful.discretizer.smooth_projection_gaussian(arr, num_cluster)[source]
Clusters an array with k_means according to num_cluster
- Args:
proj ([type]): [description] num_cluster ([type]): [description]
- Returns:
[type]: [description]
- dylightful.discretizer.smooth_projection_k_means(arr, num_cluster)[source]
Clusters an array with k_means according to num_cluster
- Args:
proj ([type]): [description] num_cluster ([type]): [description]
- Returns:
[type]: [description]
- dylightful.discretizer.tae_discretizer(time_ser, num_states, clustering=None, size=3, prefix=None, save_path=None, num_cluster=15, tol=0.01, plotting=True)[source]
Test MSM with time lagged autoencoders according to Noé et al.
- Args:
time_ser ([type]): Dynophore trajectory converted by the parser size (int, optional): 10*size is the autoencoder size Defaults to 3. file_name (str, optional): Name the output file. Defaults to None. save_path (str, optional): Path to output folder. Defaults to None. num_cluster (int, optional): Maximal number of MSM states to fit the analysis to. Defaults to 15. tol (float, optional): Tolerrance when to stop the clustering to find optimal states. Defaults to 0.01.
dylightful.dylightful module
dylightful.mdanalysis module
- dylightful.mdanalysis.write_state(labels, topology, coordinates, base, prefix=None, selection_string="protein or resname '*'")[source]
write out multipdb for markov state of given perspective
- Args:
labels ([type]): markov state trajectory topology ([type]): [description] coordinates ([type]): [description] base ([type]): [description]
dylightful.metrics module
- dylightful.metrics.calculate_max_probas(time_ser, model)[source]
Calculate the metric to evaluate based on max probabilities
- Args:
time_ser (np.ndarray): dynophore time series model (HMM): Fitted HMM
- Returns:
- np.float: Probability of prediting the given time series based on the fitted model
Model
- dylightful.metrics.calculate_mean_probas(time_ser, model)[source]
Calculate the metric to evaluate based on average probabilities
- Args:
time_ser (np.ndarray): dynophore time series model (HMM): Fitted HMM
- Returns:
- np.float: Probability of prediting the given time series based on the fitted model
Model
dylightful.msm module
- dylightful.msm.build_tae_msm(traj_path, time_ser, num_states, prefix=None)[source]
does the tae analysis of a dynophore trajectory
- Args:
traj_path (string): path to trajectory to be discretized num_states (int): assumed states
- dylightful.msm.fit_msm(trajectory, prefix=None, save_path=None)[source]
Function to fit the msm to a given trajectory and save the vizualization
- Args:
trajectory ([type]): Time series to be discretized prefix ([type], optional): Name to save a file. save_path ([type], optional): Wheree to save a file.
- Returns:
[type]: msm
dylightful.parser module
- dylightful.parser.get_time_series(pml_path)[source]
gets the time_series of the dynophore from the pml file
- Args:
pml_path (str): path to the pml file containing the Dynophore trajectory
- Returns:
[dictionary, JSON]: returns the time series for each superfeature as a JSON file
- dylightful.parser.load_env_partners(json_path)[source]
Generates the env_partners with occurences from the corresponding json
- Args:
json_path ([type]): [description]
dylightful.plot_hmm module
- dylightful.plot_hmm.plot_score(scores, file_name=None, save_path=None)[source]
Plots the score for the HMM analysis, as well as AIC and BIC scores
- Args:
scores ([type]): [description] file_name ([type], optional): [description]. Defaults to None. save_path ([type], optional): [description]. Defaults to None.
- dylightful.plot_hmm.plot_state_diagram(probabilities, max_states=15, file_name=None, save_path=None)[source]
Plots the state diagram
- Args:
probabilities ([type]): array of time series max_states (int): maximum number of hidden states filename (str): filename of the parent dynophore trajectory
- dylightful.plot_hmm.plot_transmat_graph(trans_mat, file_name=None, save_path=None)[source]
transition state matrix visualized as a directed graph
- Args:
trans_mat ([type]): [description] file_name ([type], optional): [description]. Defaults to None. save_path ([type], optional): [description]. Defaults to None.
- dylightful.plot_hmm.plot_transmat_map(trans_mat, file_name=None, save_path=None)[source]
State transition matrix visualised as a heatmap
- Args:
trans_mat ([type]): [description] file_name ([type], optional): [description]. Defaults to None. save_path ([type], optional): [description]. Defaults to None.
dylightful.postprocess module
- dylightful.postprocess.generate_state_map(time_ser_superf, labels_states, state_data)[source]
Generates a map foar each time point of a Markov Sate to a Superfeature tuple such that the time series is the (0,1,2), (0,1,3), (0,1,2) etc…
- Args:
time_ser_superf ([type]): loaded combined array of superfeature occurences such that shape is ( len_md_traj, num_superfeatures,) labels_states ([type]): time series of the labels of the different Markov states
- Returns:
[np.ndarray]: array of
- dylightful.postprocess.get_distinct_superfeatures(unique_pharmc)[source]
[summary]
- Args:
unique_pharmc ([type]): [description]
- Returns:
[type]: [description]
- dylightful.postprocess.get_env_partners(frame_indices, env_partners)[source]
- Args:
frameIndices_state ([type]): [description] env_partners ([type]): [description]
- Returns:
[type]: [description]
- dylightful.postprocess.get_information_mstates(labels_states, state_data)[source]
caclulates some general information such as occurences of the Markov states and unique pharmacophores
- dylightful.postprocess.get_information_pc(pharmacophore_traj)[source]
Calculates information about the pharcophore/superfeature patterns
- Args:
state_data ([type]): [description]
- Returns:
[(list, float)]:
- dylightful.postprocess.get_unique_env_partner(partner_traj)[source]
Counts env_partners from the env_partner trajectory
- Args:
partner_traj ([type]): specific to a state returns the trajectory of the env partners
- Returns:
[(unique_partners, their_counts)]:
dylightful.preanalysis module
dylightful.utilities module
- dylightful.utilities.get_dir(path)[source]
Automatically extracts the path to the dynophore trajectory
- Args:
path (str): File path to the dynophore trajectory
- Returns:
str: /some/file/path
- dylightful.utilities.get_name(path)[source]
Gets the name of the dynophore trajectory without the .pml extension
- Args:
path (str): File path to the dynophore trajectory
- Returns:
str: dynophore_pml
- dylightful.utilities.load_parsed_dyno(traj_path)[source]
Loads the parsed trajectory from the parser
- Args:
traj_path ([type]): Path to the parsed traj
- Returns:
[type]: trajectory as pd.DataFrame, number of observations as int
- dylightful.utilities.make_name(prefix, name, dir='/home/docs/checkouts/readthedocs.org/user_builds/dylightful/checkouts/latest/dylightful')[source]
Merge a prefix and a name
- Args:
prefix ([type]): [description] name ([type]): [description]
- Returns:
[type]: [description]
Module contents
Dylightful