Helpful python functions aggregated into one place
- Functions that I tend to use a lot to make life easier
Infers what Pandas dataframe loader to use based on the file extension (or you can override), and returns the loaded dataframe.
Returns index positions to break up an iterable into chunks
Get linear index of an upper triangle of a square matrix (nxn) while ignoring the main diagonal
Get coordinates from a linear index of a square matrix while ignoring the main diagonal
Makes a JSON-like dictionary from an xml file.
- MetAtlas is an import, but is not required for most functions
- rdkit is an import, but is currently not required for any functions
- Most of these functions are designed to work with MetAtlas, Pactolus, or MAGI outputs
Returns ppm error between two masses
Returns mass-ppm and mass+ppm
Given a mass and ppm error, and optionally a retention time and window, gives you dataframe row(s) that have features that match your search
Converts a Pandas.Series object into dataframe for easier plotting
Removes peaks that were found in two samples
Uses MetAtlas database to get a compound object from an InChI-key
Color maps one liner cmap example Notebook
Makes plotting lots of subplots easy
Calculates a point on a line perpendicular to an arbitrary point
Calculates distance between two 2D points
Finds the elbow point of an elbow plot
Calculates a polynomial fit, optionally gives you confidence intervals for the polynomial
Calculates the linear regression of a 2D dataset, and gives you the vertical distance from the trendline that encompasses n-standard deviations of the data
Draws an ellipse around multivariate data that encompasses n-sigma of the data




