Skip to content

A small Python package to aid morphometric analysis. Automates allometric correction and principal component analysis.

License

Notifications You must be signed in to change notification settings

holsfastagz/morphostuff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

morphostuff

coverage version MIT License

A small Python package to aid morphometric analysis. Automates allometric correction and principal component analysis.

Table of Contents

Installation

morphostuff can be installed using pip like so:

python3 -m pip install morphostuff

You should also install the required dependencies:

python3 -m pip install polars scikit-learn seaborn

Execution / Usage

Importing

You can import morphostuff into a Python script like so:

import morphostuff as mstuff

allom Function

Ensure your data are in the proper format. The first column (index 0) should consist of the species name or other identifying information. The second column (index 1) should consist of a standard body length measurement such as SVL. The following columns (indices 2:) should consist of other measurements.

The allom function only requires a data frame as input. A Polars data frame is recommended, but it can also take a Pandas data frame as input. Example:

morph_data = pl.read_csv('morph_data.csv')

allom_data = mstuff.allom(morph_data)

This function outputs a table of allometrically corrected features.

Use help(mstuff.allom) for more information.

morph_pca Function

The input of this function should be a data frame of allometrically corrected characters (i.e., the output of allom). It should follow the same structure as the allom inputs.

morpho_data = mstuff.morph_pca(allom_data)

This function outputs a table containing allometric size corrections, a table containing PCA results, and a PCA biplot.

Use help(mstuff.morph_pca) for more information.

significant_features Function

This function will determine how many principal components account for at least 90% of explained variance and which characters weigh heavily on each PC according to the following formula:

$$ \sqrt{\frac{1} {\mathrm{no. \ of\ characters}}} $$

The input of this function should be the data frame generated as output of morph_pca.

significant_features = mstuff.significant_features(morpho_data)

This function outputs a scree plot, barplots for each PC, a table of loadings of the significant PCS, and a table of significance of each character by PC. These outputs are all written to the disk.

Use help(mstuff.significant_features) for more information.

Technologies

morphostuff uses the following technologies and tools:

Contributing

To contribute to the development of morphostuff, follow the steps below:

  1. Fork morphostuff from https://github.com/holsfastagz/morphostuff/fork
  2. Create your feature branch (git checkout -b feature-new)
  3. Make your changes
  4. Commit your changes (git commit -am 'Add some new feature')
  5. Push to the branch (git push origin feature-new)
  6. Create a new pull request

Author

Holsen B. Moore - @h0ls.bsky.social - holsenmoore@utexas.edu

Change Log

  • 0.1
    • First working version.

License

morphostuff is distributed under the MIT license. See LICENSE for more details.

About

A small Python package to aid morphometric analysis. Automates allometric correction and principal component analysis.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages