API Documentation
- class twodanalysis.Memb2D.Memb2D(obj, lipid_list=None, guess_chain_l=True, chain_info=None, v_min=None, v_max=None, add_radii=False, verbose=False)[source]
Bases:
object- visualize_polarity(lipids='all')[source]
This function is used to visualize what atoms are considered in polarity
- Parameters:
lipids (str, optional) – Lipids to show polarity, by default “all”
- order_histogram(lipid, layer, n_grid, n_chain, edges=None, all_head=None, start=None, final=None, step=1, method='numpy')[source]
Method that allows for the computation of order parameters in 2D fashion
- Parameters:
lipid (str) – Working lipid to compute the order parameters
layer (str) – working layer, can be top, bot or both
n_grid (int) – number of divisions of the grid
n_chain (int or list) – number of carbons in the first chain or in both chains, e.g., 16 or [16,18]
v_min (float, optional) – min value for the 2D grid, by default None
v_max (float, optional) – min value for the 2D grid,, by default None
all_head (AtomGroup, optional) – atoms considered to define the middle of the membrane (all p atoms used as default), by default None
start (int, optional) – start frame, by default None
final (int, optional) – final frame, by default None
step (int, optional) – frames to skip, by default 1
method (str, optional) – method to compute the 2d histogram, by default “numpy” which uses np.histogram2d for each carbon in the lipid tails.
- Returns:
matrix containind the 2D SCD and the edges in the following disposition [v_min,v_max,v_min,_vmax] (Can be used to plot directly with extent)
- Return type:
ndarray(n_grid,n_grid), ndarray(4) (Still check the return)
- static get_individual(lista)[source]
This function gets a list with a specific carbon (e.g. C34 or C22) and its respective hidrogens (e.g. H4X, H4Y). It computes the vectors that connect the carbons and the hydrogens and computes the \(cos(\theta)^2\), where \(\theta\) is the angle between each vector and the z-axis. Finally, this function returns a vector with the individual (per lipid) \(\braket{cos(\theta)^2}\), where the mean is computed over the hydrogens of each carbon.
- Parameters:
lista (list) – Vector of the shape \([C*i, HiX,HiY, HiZ]\), the minimun len is 2 (when the carbon only have one hydrogen) and the maximun is 4 (when there is three hydrogens) Note: If there is N lipids, there will be N carbons \(C*i\), and the i represents the position of the carbon in the lipid tail.
- Returns:
order – Float with the mean of \(\braket{cos(\theta)^2}\)
- Return type:
array(n_lipids)
Notes
The average of the angle of the i-th carbon for all the lipids in the selection is computed as follows:
\[\braket{cos(\theta_i)^2}\]where \(\theta_i\) is the angle between the z- axis and the vector that connects the i-th carbon and the hydrogen.
- individual_order_sn1(sel, lipid, n_chain)[source]
Code to loop over the number of carbons_summary_ in the lipid tail and get a list with the carbon and its hydrogens for each carbon in the lipid tail: \([C3i, HiX, HiY, ...]\). This list is passed to get_vectors which return the averages of each i-th carbon. This code returns an array of dim n_chain with the mean \(raket{cos( heta_i)^2}\)
- Parameters:
lipid (str) – Name of the lipid to compute the order parameters
n_chain (int) – Number of carbons in the lipid tail sn1
- Returns:
chains – Vector dim n_chains with the mean \(raket{cos( heta_i)^2}\)
- Return type:
ndarray
Notes
The return is a vector containing the value \(raket{cos^2( heta_i}\). As follows:
\[[raket{cos^2( heta_2}, raket{cos^2( heta_3}, ..., raket{cos^2( heta_{n_chain}}]\]The index starts at 2 because that is the carbon the lipid tail starts with.
- individual_order_sn2(sel, lipid, n_chain)[source]
Code to loop over the number of carbons in the lipid tail and get a list with the carbon and its hydrogens for each carbon in the lipid tail: \([C2i, HiX, HiY, ...]\). This list is passed to get_vectors which return the averages of each i-th carbon. This code returns an array of dim n_chain with the mean \(\braket{cos(\theta_i)^2}\)
- Parameters:
lipid (str) – Name of the lipid to compute the order parameters
n_chain (int) – Number of carbons in the lipid tail sn1
- Returns:
chains – Vector dim n_chains with the mean \(\braket{cos(\theta_i)^2}\)
- Return type:
ndarray
Notes
The return is a vector containing the value \(\braket{cos^2(\theta_i}\). As follows:
\[[\braket{cos^2(\theta_2}, \braket{cos^2(\theta_3}, ..., \braket{cos^2(\theta_{n_chain}}]\]The index starts at 2 because that is the carbon the lipid tail starts with.
- histogram2D(sample1, weights, n_chain, bins=10, edges=None)[source]
Computes the 2D histogram of 2D data with various values taking an average of them
- Parameters:
sample1 (np.array(n,2)) – 2D data information
weights (np.array(n,m)) – m values can be attached to the data (usually lenght of the tails)
n_chain (int or list) – Number of carbons in each chain, e.g, 16 or [16,16] for both chains
bins (int, optional) – Number of bins to split the space, by default 10
edges (list(float)) – Edges for the 2D grid
- Returns:
matrix containining the averaged 2D histogram, edges corresponding to te matrix
- Return type:
np.array, list
- numpyhistogram2D(sample1, weights, n_chain, bins=10, edges=None)[source]
Computes the 2D histogram of 2D data with various values taking an average of them
- Parameters:
sample1 (np.array(n,2)) – 2D data information
weights (np.array(n,m)) – m values can be attached to the data (usually lenght of the tails)
n_chain (int or list) – Number of carbons in each chain, e.g, 16 or [16,16] for both chains
bins (int, optional) – Number of bins to split the space, by default 10
edges (list(float)) – Edges for the grid [xmin,xmax,ymin,ymax]
- Returns:
matrix containining the averaged 2D histogram, edges corresponding to te matrix
- Return type:
np.array, np.array
- static count_order(data, min_lenght, n_chain)[source]
Function used to count and average the order parameter in each grid square
- Parameters:
data (ndarray(n,2 + len(n_chain[0]) or 2 + len(n_chain[0]) +len(n_chain[1]))) – Array that contains the order parameters data to be averaged.
min_lenght (int) – size of the data
n_chain (int or list) – Sets the number of carbons in the fatty acida chain
- Returns:
Array containing the mean SCD for each grid square
- Return type:
_np.array
- all_lip_order(layer, nbins, edges=None, all_head=None, start=None, final=None, step=1, plot=False)[source]
all_lip_order Find the 2D order parameters for all lipids
- Parameters:
layer ((str)) – Layer, can be top, bot, both
nbins ((int)) – number of bins
edges (list(float)) – Edges for the grid in the shape [xmin,xmax,ymin,ymax]
all_head ((mda selection, optional), optional) – heads to be considered, by default None
start ((int, optional), optional) – start frame, by default None
final ((int, optional), optional) – final frame, by default None
step ((int, optional), optional) – step, by default 1
plot (bool, optional) – plot the resulting matrix, by default False
- Returns:
matrix containing the 2d order, edges of the matrix
- Return type:
ndarray(n,n), ndarray(n+1)
- surface(start=None, final=None, step=None, lipids='DSPC', layer='top', filename=None, include_charge=False)[source]
Code to loop over the trajectory and print [x,y,z(referenced to zmean), charge] in a file.
- Parameters:
start (int, optional) – Start Frame, by default None
final (int, optional) – Final frame, by default None
step (int, optional) – Frames to skip, by default None
lipids (str or list, optional) – Lipid to work, by default “DSPC”
layer (str, optional) – Layer to work, by default ‘top’
filename (str, optional) – filename to write data, by default None
include_charge (bool, optional) – Include or not charge, by default False
- Returns:
_description_
- Return type:
_type_
- height_matrix(lipids, layer, edges=None, start=None, final=None, step=None, nbins=50, clean=True)[source]
Code to divide the space in a 2D grid and compute the height referenced to zmean
- Parameters:
lipids (list(str)) – Lipids to include in the height analysis
layer (str) – Working layer for thickness
edges (list) – Edges for the grid
start (int, optional) – Frame to start analysis, by default None
final (int, optional) – Final frame for the analysis, by default None
step (int, optional) – Steps to skip, by default None
nbins (int, optional) – Number of bins to divide the grid space, by default 50
clean (bool, optional) – Decide if rerun and overwrite surface generated files, by default True
- Returns:
Retun a matrix with the height information
- Return type:
ndarray(nbins,nbins)
- thickness(nbins, edges=None, lipids=None, start=0, final=-1, step=1)[source]
Find the thichness mapped in a 2d grid
- Parameters:
nbins (int) – number of bins for thickness
edges (list) – Edges for the grid
lipids (list(str)) – Lipids to be considered in the thickness computation
start (int, optional) – Start frame, by default 0
final (int, optional) – Final frame, by default -1
step (int, optional) – Step frame, by default 1
- Returns:
Matrix with the thickness, edeges for the matrix
- Return type:
np.array, np.array
- packing_defects(layer='top', nbins=180, height=False, periodic=False, edges=None, area=True, count=True, verbose=True)[source]
Compute packing defects based on packmem: https://doi.org/10.1016/j.bpj.2018.06.025
- Parameters:
layer (str, optional) – working layer (top/bot). Defaults to ‘top’, by default ‘top’
nbins (int, optional) – Number of bins of the xy grid, by default 180
height (bool, optional) – Store height matrix (To study deepness of th packing defects), by default False
periodic (bool, optional) – Defines if using periodicity or not. When True, takes into acount periodicity and returns a 2D grid with of the size of the periodic box, by default False
vmin (float, optional) – Store the min value for x and y
vmax (float, optional) – Store the max value for x and y
- Returns:
ndarray – If height == Flase: matrix with packing defects
ndarray, ndarray – If height === True: matrix with packing defects, amtrix with height information
- static create_circle_array(grid_size, radius_A, center=None)[source]
Create a small matrix with a inner circle of the size of radius_A
- Parameters:
grid_size (float) – define the grid size to create the optimun grid (Amstrongs)
radius_A (float) – define the radius for the matrix (amstrongs)
center (bool, optional) – Bool to set the center of the circle, by default None
- Returns:
array with a circle of ones
- Return type:
ndarray
- static add_small_matrix(big_matrix, small_matrix, center_i, center_j)[source]
Add smmall matrix to a big matrix
- Parameters:
big_matrix (ndarray(n,n)) – big matrix where a small matrix will be added
small_matrix (ndarray(m,m)) – small matrix to be added
center_i (int) – i coordinate
center_j (int) – j coordinate
- Returns:
big matrix modified
- Return type:
ndarray(n,n)
- add_defects(matrix, indexes, elements, names, lipid, mat_radii_dict)[source]
Code to easily add defects in the 2d matrix
- Parameters:
matrix (ndarray(n,n)) – Matrix where the defects are going to be added
indexes (ndarray(i,j)) – List of indexes i,j in the matrix where the defects should be added
elements (list) – type of element (needed to put the right radious)
names (list) – names of the atoms (needed to map hydrophobic and not hydrophobic atoms)
lipid (str) – lipid name
mat_radii_dict (dict) – dictionary with the radii
- Returns:
matrix matrix filled with the defects
- Return type:
ndarray
- static extend_data(data, dimensions, percentage, others=None)[source]
Function to extent data for periodicity purposes
- Parameters:
data (ndarray(:,2)) – data in 2D fashion
dimensions (ndarray(2)) – periodicity dimension (usually gottem from u.ts.dimensions[:2])
percentage (float) – Percentage of data to replicate with periodicity
others (list(ndarray(:), ndarray(:),…,ndarray(:)), optional) – List of other data to replicate with periodicity (ndarrays initially match with data axis 0 dimension), by default None
- Returns:
ndarray – Data extended
ndarray, list – Data extended, others extended
- static get_highest(data, min_lenght)[source]
Code to get the highest value given two columns that are to be ordered in a 2D grid :Parameters: * data ((ndarray(:,2))) – Array with two columns (column1: map to a 2D grid, column2: values)
min_lenght ((int)) – Size of squares in the 2D grid
- Returns:
ndarray( – With the maximun of each grid square
- Return type:
,2)
- get_indexes(data, bins=10, edges=None, matrix_height=False)[source]
given data in 2D, the code returns the indexes to locate the data in the 2D grid defined by edges and bins
- Parameters:
data (ndarray(n,2 o 3)) – Data in 2D fashion, (3 columns if height = True)
bins (int, optional) – number of bins of the grid, by default 10
edges (list, optional) – Edges in the following way [xmin,xmax,ymin,ymax], by default None
matrix_height (bool, optional) – returns the height matrix (matrix with only the lipids closer to water), by default False
- Returns:
tuple – tuple with the indexes
tuple, ndarray(bins,bins) – tuple with indexes and 2D data of the highest point
- packing_defects_stats(nbins=180, layer='top', edges=None, periodic=False, start=0, final=-1, step=1, area_size=True, verbose=True)[source]
- Run packing defects from start to final and stores data
about area of defects, total area, number of defects, and size of defects
- Parameters:
nbins (int, optional) – number of bins to consider, by default 180
layer (str, optional) – layer to consider, can be top, bot, by default “top”
edges (list(float), optional) – Edges in the shape [xmin,xmax,ymin,ymax], by default None
periodic (bool, optional) – Consider or not periodicity, by default False
start (int, optional) – stat frame, by default 0
final (int, optional) – final frame, by default -1
step (int, optional) – frames to skip, by default 1
area_size (bool, optional) – If true return the areas of the different defects, by default True
- Returns:
pandas dataframe with the area information of packing defects over time and informationabout the size of the packing defects
- Return type:
pd.DataFrame, np.array
- voronoi_apl(layer='top', working_lip=None, lipid_list=None)[source]
Computes the APL for membranes with different lipids
- Parameters:
layer (str, optional) – layer to compute the apl, by default ‘top’
working_lip (dict, optional) – dictionary mapping lipid and atoms to work for APL, by default None
lipid_list (list, optional) – list of lipids to be considered for APL, by default None
- Returns:
dictionary with vertices, areas, and APL
- Return type:
- map_voronoi(voronoi_points, voronoi_areas, nbins, edges)[source]
Function to map voronoi APL to a 2D plane
- Parameters:
voronoi_points (ndarray(:,2)) – [x,y] positions of the points to be considered in the voronoi plot
voronoi_areas (ndarray(:)) – Areas correspondng to the points
nbins (int) – number of bins for the grid
edges (list) – A list with the lipids of the grid [xmin,xmax,ymin,ymax]
- Returns:
numpy array (nbins,nbins), adn edges of this array
- Return type:
ndarray, edges
- grid_apl(layer='top', start=0, final=-1, step=1, lipid_list=None, nbins=180, edges=None)[source]
Function to compute and map the grid APL for several frames, map them to a 2D grid and average them
- Parameters:
layer (str, optional) – working lipid layer, by default “top”
start (int, optional) – Frame to start, by default 0
final (int, optional) – final frame, by default -1
step (int, optional) – Frames to skip, by default 1
lipid_list (list, optional) – lipids involved in the computation, by default None
nbins (int, optional) – number of bins for the grid, by default 180
edges (list, optional) – A list with the limits of the grid [xmin,xmax,ymin,ymax]
- Returns:
Array with the averaged 2D APL, edges
- Return type:
ndarray
- windows_apl(layer='top', start=0, final=-1, step=1, w_size=10, lipid_list=None, nbins=180, edges=None)[source]
Function to compute APL and map it to a 2D grid in windows of time defined by the user.
- Parameters:
layer (str, optional) – Wroking layer, by default “top”
start (int, optional) – Start Frame, by default 0
final (int, optional) – Final frame, by default -1
step (int, optional) – Frames to skip, by default 1
w_size (int, optional) – windows size (number of frames), by default 10
lipid_list (list, optional) – lipids to be included in the analysis, by default None
nbins (int, optional) – nimber of bins in the grid, by default 180
edges (list, optional) – list with the edges of the grid [xmin,xmax,ymin,ymax], by default None
- Returns:
list with the windows averages between the start time and the final time, and edges of these matrices
- Return type:
- class twodanalysis.BioPolymer2D.BioPolymer2D(obj)[source]
Bases:
object- property startT
- property endT
- property stepT
- getPositions(pos_type='COM', inplace=True, select=None, getselection=False)[source]
Computes positions of selection from self.startT to self.endT with self.stepT steps of frames. By default, these parameters are set to compute over the whole trajectory.
- Parameters:
pos_type (str, optional) – Computes the positions of “all” atoms of the object or the “COM” (center of mass) of residues, by default ‘COM’.
inplace (bool, optional) – If True, position values are assigned to the self.pos attribute and None is returned. If False, positions are returned, by default True
select (None or str, optional) – If None, all atoms in the Atom group are computed. Otherwise, it is a string selection analogue to MDAnalysis format. Selection must be a set of atoms of the Atom group. Defaults to None., by default None
getselection (bool, optional) – Whether or not to return the selected MDAnalysis AtomGroup as output.
- Returns:
None if inplace=True, numpy array if inplace=False with the positions of the center of mass of residues (if pos_type=”COM”)or positions of all atoms (pos_type=”all”)
- Return type:
None or np.ndarray
- getCOMs(inplace=True, select=None)[source]
Computes positions of selection from self.startT to self.endT with self.stepT steps of frames. By default, these parameters are set to compute over the whole trajectory.
- Parameters:
inplace (bool, optional) – If True, position values are assigned to the self.com attribute and None is returned. If False, center of mass at each frame are returned. By default True
select (None or str, optional) – If None, all atoms in the Atom group are computed. Otherwise, it is a string selection analogue to MDAnalysis format. Selection must be a set of atoms of the Atom group. By default None
- Returns:
None if inplace=True, numpy array if inplace=False with the center of mass of the AtomGroup.
- Return type:
None or np.ndarray
- static FilterMinFrames(pos, zlim, Nframes, control_plots=False)[source]
Selects a set of Nframes in which the AtomGroup is closer to the surface and bellow a zlim threshold distance to the surface.
- Parameters:
pos (list or np.ndarray (TotalFrames,Nresidues or Natoms,4 <t,x,y,z>)) – Positions over time to be filtered.
zlim (float) – Distance (in angstroms) threshold limit in which the AtomGroup is considered adsorped to the surface.
Nframes (int) – Nframes closest to the surface within the frames where the AtomGroup is < zlim.
control_plots (bool, optional) – If control plots are to be shown, by default False
- Returns:
Filtered positions (Nframes,Nresidues or Natoms,4 <t,x,y,z>)
- Return type:
np.ndarray
- PolarAnalysis(select_res, Nframes, max_hist=None, sort=None, plot=False, control_plots=False, zlim=14, Nbins=1000, resolution=5)[source]
Makes a Polar Histogram of the positions of the center of mass of select_res residues considering Nframes closest to the surface within the < zlim threshold. self.pos attribute is used to compute the center of mass of the AtomGroup, which will be the referential center of the histograms. The colors of the histogram are ordered according to sort parameter.
- Parameters:
select_res (str) – MDAnalysis string selection of the residues to which compute the histograms.
Nframes (int) – Nframes closest to the surface within the frames where the AtomGroup is < zlim.
max_hist (None or float, optional) – Value to normalize the histograms. If None, highest histogram value is used to normalize the histograms., by default None
sort (str, list, ndarray or None, optional) – How to sort the histograms in the legend and the coloring. If “max”, histograms will be ploted descending from the residue with highest peak in its histogram to the flattest peak. If sort is a list or ndarray, sort is the index positions of the residues to which reorder the histograms. If None, they well be plotted by MDAnalysis default sort (ascending Resid values)., by default None
plot (bool, optional) – Show the polar plot (True) or only return the data (False), by default False
control_plots (bool, optional) – Show control plots of the different steps of the polar analysis calculation., by default False
zlim (float, optional) – Distance (in angstroms) threshold limit in which the AtomGroup is considered adsorped to the surface, by default 14
Nbins (int, optional) – How many bins to use in the histograms., by default 1000
resolution (float, optional) – One the position vectors of each residue are normalized, resolution is the value too which the normalized positions are multiplied. An increase in this value will make higher peaks in the histograms since position vector are further away. Reducing this value represents an increase of resolution of the histogram. By default 5
- Returns:
Histogram data (Nresidues, 2 <X_bin_values,Y_bin_values>, Nbins), Positions in order in which they were plotted (Nframes,Nresidues or Natoms,4 <t,x,y,z>)
- Return type:
list,np.ndarray
- computeRG2D(masses, total_mass=None)[source]
Computes parallel, perpendicular and 3D radius of gyration in 1 frame.
\[R_{\textrm{g}\parallel}= \sqrt{ \frac{1}{m_T}\sum_{i} m_{i}\left[ (x_i-x_{\textrm{CM}})^2+(y_i-y_{\text{CM}})^2\right]}\]\[R_{\textrm{g}\perp} = \sqrt{\frac{1}{m_T}\sum_{i} m_{i} (z_i-z_{\text{CM}})^2,}\]where \({\bf R}_{\textrm{CM}}=(x_{\textrm{CM}}\), \(y_{\textrm{CM}}\), \(z_{\textrm{CM}})\) is the position of the center of mass, \(m_{i}\) the mass of each residue and \(m_T\) the total mass of the residues.
- Parameters:
masses (np.ndarray (Natoms)) – Mass vallues of each atom.
total_mass (float, optional) – Sum of these masses. By default None
- Returns:
3D, perpendicular and parallel radius of gyration values (3, Natoms)
- Return type:
np.ndarray
- getRgs2D(plot=False)[source]
Computes the radii of gyration over the trajectory using computeRG2D method.
- Parameters:
plot (bool, optional) – If True, it plots the raw Rg data values in time, by default False
- Returns:
3D, perpendicular and parallel radius of gyration values at each frame (self.endF-self.startF frames,3, Natoms)
- Return type:
np.ndarray
- RgPerpvsRgsPar(rgs, color, marker='s', plot=True, show=False)[source]
Generates \(R_{g\perp}\) vs. \(R_{g\parallel}\) plots. Also, returns the \(\langle R_{g\perp}^2 \rangle /\langle R_{g\parallel}^2 \rangle\) ratio
- Parameters:
rgs (np.ndarray) – Radii of gyration data. It must have Rg data as [Rg 3D, Rg parallel, Rg perpendicular], analogue to getRgs2D functions
color (str) – Color used to plot points. Color names use the same of those of Matplotlib package.
marker (str, optional) – Marker used to plot. Marker names use the same of those of Matplotlib package. , by default ‘s’
plot (bool, optional) – If False, only the \(\langle R_{g\perp}^2 \rangle /\langle R_{g\parallel}^2 \rangle\) ir returned with out make plot, by default True
show (bool, optional) – If True, matplotlib.pyplot.show() is executed. This is left optional in case further characterization of plot is desired. Also, this enables showing multple data in the same figure. By default False.
- Returns:
\(\langle R_{g\perp}^2 \rangle /\langle R_{g\parallel}^2 \rangle\)
- Return type:
- static ListPathsInLevel(kde_plot, contour_level, plot_paths=False)[source]
Lists vertices of a path in a contour level of the KDE plot.
- Parameters:
kde_plot (kde_plot) – Results of seaborn.kde_plot function. Once computed getKDEAnalysis, self.kde stores this input.
contour_level (int) – Contour Level in which to enlist paths or vertices.
plot_paths (bool, optional) – If True,all the paths of a given contour level are plotted, by default False
- getKDEAnalysis(zlim, Nframes, inplace=True, control_plots=False)[source]
Computes KDE Contours using seaborn.kde_plot() function and extracts the paths of each contour level. The output of the seaborn.kde_plot() is stored in self.kdeanalysis.kde, and the paths of each contour level is stored in self.kdeanalysis.paths if inplace=True.
- Parameters:
zlim (float) – zlim of BioPolymer2D.FilterMinFrames(). Only use frames under a zlim threshold, to avoid using frames with desorbed molecule.
Nframes (int) – Nframes of BioPolymer2D.FilterMinFrames(). To ensure to have a controled number of frames under zlim threshold.
inplace (bool, optional) – If True, stores the paths of al contour levels in self.kdeanalysis.paths. Otherwise, it only returns it. By default True
control_plots (bool, optional) – Make control plots, by default False
- Returns:
List of all paths in all the contour levels.
- Return type:
- static getAreas(paths, contour_lvl, getTotal=False)[source]
Computes the area of each path a given contour level. Negative values of area are holes in the contour level. If getTotal=True, computes the area of the whole contour level.
- Parameters:
paths (list) – Paths of all contour levels.
contour_lvl (int) – Contour level to compute the area.
getTotal (bool, optional) – If False, gives the area of each path of the contour level. If getTotal=True, sums up the contribution of each path in the contour level returning the area of the whole contour level. By default False
- Returns:
A list with the area of each path in the contour level, or the total area of the contour level (if getTotal=True)
- Return type:
- KDEAnalysisSelection(select_res, Nframes=1000, zlim=15, show=False, legend=False)[source]
KDE Contours for a set of selected residues. This computes the paths of all the contour levels of each residue.
- Parameters:
select_res (str) – MDAnalaysis-like selection of residues to compute their KDE Contour paths
Nframes (int, optional) – Number of frames to use. This fills value of
self.FilterMinFrames, by default 1000zlim (float, optional) – Height limit to consider as adsorted frames. This fills value of
self.FilterMinFrames, by default 15show (bool, optional) – Where or not to show plot. Convinient to use False if you want modify the default plot, by default False
legend (bool, optional) – Whether or not to make the default legend, by default False
- Returns:
Returns a list with the contour levels paths of each selected residue, and selected AtomGroup. The list of contour levels paths and the reisudes in the AtomGroup are ordered consistently.
- Return type:
- getHbonds(selection1, selection2, update_selections=True, trj_plot=False, inplace=True)[source]
Computes H-bonds between to selection1 and selection2 of the trajectory using MDAnalysis.analysis.hydrogenbonds.HydrogenBondAnalysis.
- Parameters:
selection1 (str) – First selection to which compute H-bonds
selection2 (str) – Second selection to which compute H-bonds
update_selections (bool, optional) – Fills parameter update_selection from MDAnalysis.analysis.hydrogenbonds.HydrogenBondAnalysis. If True, it updates donor and acceptor at each frame. , by default True
trj_plot (bool, optional) – True to have a look at the Hbonds over the trajectory. By default False
inplace (bool, optional) – If True, it stores results of H-bond run in self.hbonds. by default True
- Returns:
A list with the area of each path in the contour level, or the total area of the contour level (if getTotal=True)
- Return type:
MDAnalysis.analysis.base.Results
- HbondsPerResidues(sorted=True)[source]
Computes the number of H-bonds of each residue during the simulation. self.getHbonds(inplace=True) must be computed prior to the use this function.
- Parameters:
sorted (bool, optional) – If True, returns data sorted by number of H-bonds. By default True
- Returns:
DataFrame showing all the residues with H-bonds.
- Return type:
pandas.DataFrame
- plotHbondsPerResidues(paths_for_contour, top=-1, contour_lvls_to_plot=None, filter=None, print_table=True, show=False)[source]
Makes a figure showing the center of mass of the residues with H-bonds. Figure shows a contour plot as a reference of position of the whole molecule. Legend of the Figure shows the percentage of time in which there were Hbonds during the simulation of the plotted residues.
- Parameters:
paths_for_contour (list) – List of paths of all the contour levels.
top (int, optional) – Residues are plotted ranked by residues with most contact to least. This parameters indicates how many residues to plot of these ranked residues, e.g. top=5 wil plot the 5 residues with most Hbonds during the simulations. By default -1, plots all the residues with H-bonds.
contour_lvls_to_plot (list, optional) – Contour Levels to show in plot, by default None
contour_lvls_to_plot (str or list, optional) – Residue names to be filtered out of the plot and the output table.
print_table (bool, optional) – Whether or not to print the pandas.DataFrame table with the data shown in figure, by default True
show (bool, optional) – Whether or not to show the figure. Convinient to use False if want to do further tunning the plot. By default False
- Returns:
Sorted DataFrame from the residues with most contact to the residue with least contacts.
- Return type:
pandas.DataFrame
- static plotPathsInLevel(paths, contour_lvl, color='k', alpha=0.3, show=False)[source]
Plots the paths of a given contour level.
- Parameters:
paths (list) – List with all the paths of all the contour levels.
contour_lvl (int) – Contour level to plot
color (str, optional) – Color to plot the contour level , by default ‘k’, corresponding to a black color.
alpha (float, optional) – Sets trasparency. Fills parameter alpha of matplolib.pyplot.plot method by default 0.3
show (bool, optional) – Where to show or not the plot yet with matplolib.pyplot.plot, by default False