diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..b2e992ee --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,21 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html new file mode 100644 index 00000000..36e0ab53 --- /dev/null +++ b/docs/_templates/layout.html @@ -0,0 +1,14 @@ +{% extends "!layout.html" %} + +{% block footer %} + {{ super() }} + + + +{% endblock %} diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..3304ea5b --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,104 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +import sphinx_rtd_theme + +sys.path.insert(0, os.path.abspath("..")) + + +# -- Project information ----------------------------------------------------- + +project = "ms-mint" +copyright = "2022, Soren Wacker" +author = "Soren Wacker" + +# The full version, including alpha/beta/rc tags +release = "0.1.6" + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +# extensions = [ +# "sphinx.ext.autodoc", +# "sphinx.ext.githubpages", +# ] + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.doctest", + "sphinx.ext.intersphinx", + "sphinx.ext.todo", + "sphinx.ext.coverage", + "sphinx.ext.mathjax", + "sphinx.ext.ifconfig", + "sphinx.ext.viewcode", + "sphinx.ext.githubpages", + "sphinx.ext.napoleon", + "myst_parser", +] + +# Napoleon settings +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_init_with_doc = True +napoleon_include_private_with_doc = True +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True + + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [ + "_build", + "Thumbs.db", + ".DS_Store", + "versioneer.py", + "setup.py", + "ms_mint/filelock.py", + "notebooks", + "**.ipynb_checkpoints", +] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# + +html_theme = "sphinx_rtd_theme" +# html_theme = "alabaster" + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +source_suffix = [".rst"] + +html_baseurl = "https://lewisresearchgroup.github.io/ms-mint" + +requirements_path = "docs/requirements.txt" diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..4ba7b392 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,22 @@ +.. ms-mint documentation master file, created by + sphinx-quickstart on Tue May 24 19:54:56 2022. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to ms-mint's documentation! +=================================== + +.. toctree:: + :maxdepth: 4 + :caption: Contents: + + readme + modules + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..32bb2452 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/modules.rst b/docs/modules.rst new file mode 100644 index 00000000..b85f7930 --- /dev/null +++ b/docs/modules.rst @@ -0,0 +1,7 @@ +ms_mint +======= + +.. toctree:: + :maxdepth: 4 + + ms_mint diff --git a/docs/ms_mint.rst b/docs/ms_mint.rst new file mode 100644 index 00000000..539b2cd8 --- /dev/null +++ b/docs/ms_mint.rst @@ -0,0 +1,125 @@ +ms_mint package +================ + +Submodules +---------- + +ms_mint.Mint module +-------------------- + +.. automodule:: ms_mint.Mint + :members: + :undoc-members: + :show-inheritance: + +ms_mint.Chromatogram module +---------------------------- + +.. automodule:: ms_mint.Chromatogram + :members: + :undoc-members: + :show-inheritance: + +ms_mint.filelock module +------------------------ + +.. automodule:: ms_mint.filelock + :members: + :undoc-members: + :show-inheritance: + +ms_mint.filters module +---------------------- + +.. automodule:: ms_mint.filters + :members: + :undoc-members: + :show-inheritance: + +ms_mint.io module +------------------ + +.. automodule:: ms_mint.io + :members: + :undoc-members: + :show-inheritance: + +ms_mint.matplotlib_tools module +--------------------------------- + +.. automodule:: ms_mint.matplotlib_tools + :members: + :undoc-members: + :show-inheritance: + +ms_mint.notebook module +------------------------ + +.. automodule:: ms_mint.notebook + :members: + :undoc-members: + :show-inheritance: + +ms_mint.pca module +------------------- + +.. automodule:: ms_mint.pca + :members: + :undoc-members: + :show-inheritance: + +ms_mint.plotly_tools module +----------------------------- + +.. automodule:: ms_mint.plotly_tools + :members: + :undoc-members: + :show-inheritance: + +ms_mint.plotting module +------------------------ + +.. automodule:: ms_mint.plotting + :members: + :undoc-members: + :show-inheritance: + +ms_mint.processing module +-------------------------- + +.. automodule:: ms_mint.processing + :members: + :undoc-members: + :show-inheritance: + +ms_mint.standards module +------------------------- + +.. automodule:: ms_mint.standards + :members: + :undoc-members: + :show-inheritance: + +ms_mint.targets module +----------------------- + +.. automodule:: ms_mint.targets + :members: + :undoc-members: + :show-inheritance: + +ms_mint.tools module +--------------------- + +.. automodule:: ms_mint.tools + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: ms_mint + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/readme.rst b/docs/readme.rst new file mode 100644 index 00000000..339dc8f4 --- /dev/null +++ b/docs/readme.rst @@ -0,0 +1,2 @@ +.. include:: ../README.md + :parser: myst_parser.sphinx_ diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 00000000..f68344e1 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,4 @@ +sphinx-rtd-theme +sphinx-materialdesign-theme +myst-parser +.. diff --git a/images/hierarchical-clustering.png b/images/hierarchical-clustering.png new file mode 100644 index 00000000..5a913ffc Binary files /dev/null and b/images/hierarchical-clustering.png differ diff --git a/images/peak-shapes.png b/images/peak-shapes.png new file mode 100644 index 00000000..fcac065f Binary files /dev/null and b/images/peak-shapes.png differ diff --git a/images/results-example.png b/images/results-example.png new file mode 100644 index 00000000..19df2195 Binary files /dev/null and b/images/results-example.png differ diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 00000000..22a100a3 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,4 @@ +setuptools_scm +pytest +pytest-cov +coverage-badge diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..e6b9d40b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,32 @@ +pytest +six +jsonschema +entrypoints +pygments +pexpect +decorator +pillow +lxml +pandas>=2 +matplotlib +seaborn +pyteomics +scikit-learn +molmass +pymzml +plotly +colorlover +tqdm +ipywidgets +openpyxl +pyarrow +tables +h5py +ipyfilechooser +hdf5plugin +nbformat>=4.2.0 +sphinx +sphinx-rtd-theme +myst-parser +psims +numpy<2.0.0 diff --git a/tests/test__notebook.py b/tests/test__notebook.py new file mode 100644 index 00000000..6a8f0e7d --- /dev/null +++ b/tests/test__notebook.py @@ -0,0 +1,17 @@ +from ms_mint.notebook import Mint + +mint = Mint(verbose=True) + + +class TestClass: + def test__mint_n_files(self): + ms_files = [ + "tests/data/ms_files/fileA.mzXML", + "tests/data/ms_files/fileB.mzxml", + "tests/data/ms_files/fileC.mzML", + "tests/data/ms_files/fileD.mzml", + ] + mint.ms_files = ms_files + result = mint.n_files + expect = len(ms_files) + assert result == expect, f"Expected ({expect}) != result ({result})"