labblouin.Ordination module

Ordination is a class designed to compute and plot ordination methods such as PCA and MDS. It is intended as a helper function to PDBnet, but have the functionality to work with gm files.

This file is based on Nelle Varoquaux <nelle.varoquaux@gmail.com> code plotmds.py, available at http://scikit-learn.org/stable/auto_examples/manifold/plot_mds.html, and recomendations in stackoverflow by Jaime Fernandez (http://numericalrecipes.wordpress.com/)

Dependencies: SKlearn, PDBnet, Scipy, matplotlib

Author: Jose Sergio Hleap email: jshleap@dal.ca

class labblouin.Ordination.ORD(prefix, data, fastafile=None, n_comp=2)[source]

A class for the most popular ordination methods using PDBnet instaces or gm files.

LDA(membership, options, group_labels=None)[source]

Perform a Linear discriminant analysis of the data and plot it. Membership must be an array of integers of the same lenght of the number of observations in the data.

LoadDataGMfile(data)[source]

Load the data to the class assuming is a GM file

MDS(options, typeof='classic', dist=False, groups=None)[source]

Perform Multidimensional Scaling wither classic (PCoA) or non-metric. If you have the upper triangle of a distance matrix as a dictionary, pass the dictionary as dist.

PCA(options, groups=None)[source]

Performs a principal coordinate analysis of the data

Plot(options, groups=None)[source]

Plot the components from an ordination method of the class ORD. If the number of components is greater than 3, it will plot the first three components. Components has to be a n x k numpy array of eigenvectors, where n is the observations/individuals and k the components. The option groups allow to pass a list (of the same lenght of the arrar, that is a lenght of n).

PlotXDA(membership, options, group_labels=None)[source]

Plots a Linear Discriminant Analysis (LDA) or a Quadratic Discriminan Analysis (QDA) with confidence ellipses at std (standard deviations)

PrepData4PDBnet(data)[source]

Load the data to the class assuming is a PDBnet instance file

QDA(membership, options, group_labels=None)[source]
Store()[source]
dict2array2matrix(dict)[source]

Giving an upper-triangle distance matrix in a dictionary, returns a distance-like array

ellipse(singlegroupx, singlegroupy, std=2, color='k')[source]

Create an ellipse given points with x coordinates in singlegroupx and singlegroupy

getEllipses(stds)[source]

will populate the ellipses attribute

pointsInEllipse(Xs, Ys, ellipse)[source]

Tests which set of points are within the boundaries defined by the ellipse. The set of points are defined in two arrays Xs and Ys for the x-coordinates and y-coordinates respectively

Previous topic

labblouin.MATT2GM module

Next topic

labblouin.PDBS2VMDstate module

This Page