Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

53 add sphinx #63

Merged
merged 4 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2
build:
os: "ubuntu-22.04"
tools:
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF
# formats: all

# conda:
# environment: misc/conda_dev_env.yaml

# # Optionally set the version of Python and requirements required to build your docs
python:
install:
- requirements: extra_requirements/development.txt
2 changes: 1 addition & 1 deletion alpharaw/ms_data_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ class MSData_HDF(MSData_Base):
"""
Wrapper of reader for alpharaw's HDF5 spectrum file.
This class is registered as "alpharaw", "raw.hdf", "alpharaw_hdf", "hdf" and "hdf5"
in :data:`ms_reader_provider` instance.
in :obj:`ms_reader_provider` instance.
"""

def import_raw(self, _path: str):
Expand Down
25 changes: 14 additions & 11 deletions alpharaw/thermo.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"faims_cv",
]

#: The auxiliary items and types that can be accessed from thermo RawFileReader.
__auxiliary_item_dtypes__ = {
auxiliary_item_dtypes: dict = {
jalew188 marked this conversation as resolved.
Show resolved Hide resolved
"injection_time": np.float32,
"cv": np.float32,
"max_ion_time": np.float32,
Expand All @@ -45,27 +44,31 @@
"scan_event_string": "U",
"multinotch": "O",
}
"""
The auxiliary items and types that can be accessed from thermo RawFileReader.
"""


class ThermoRawData(MSData_Base):
"""
Loading Thermo Raw data as MSData_Base data structure.
This class is registered "thermo" and "thermo_raw" in :data:`ms_reader_provider`.
This class is registered "thermo" and "thermo_raw" in
:obj:`alpharaw.ms_data_base.ms_reader_provider`.

Parameters
----------
centroided : bool, optional
If peaks will be centroided after loading. By defaults True.
process_count : int, optional
number of spectra to load in each batch, by default 10.
Number of processes to load RAW data, by default 10.
mp_batch_size : int, optional
automatically save hdf after load raw data, by default 5000.
Number of spectra to load in each batch, by default 5000.
save_as_hdf : bool, optional
is DDA data, by default False.
Automatically save hdf after load raw data, by default False.
dda : bool, optional
_description_, by default False.
Is DDA data, by default False.
auxiliary_items : list, optional
Additional spectrum items, candidates are in :data:`__auxiliary_item_dtypes__`.
Additional spectrum items, candidates are in :data:`auxiliary_item_dtypes`.
By default [].
"""

Expand All @@ -85,7 +88,7 @@ def __init__(
self.mp_batch_size = mp_batch_size
self.dda = dda
self.auxiliary_items = auxiliary_items
self.column_dtypes.update(__auxiliary_item_dtypes__)
self.column_dtypes.update(auxiliary_item_dtypes)

def _import(
self,
Expand Down Expand Up @@ -190,7 +193,7 @@ def _import_batch(
is dda data.

auxiliary_items : list
Candidates are in :data:`__auxiliary_item_dtypes__`.
Candidates are in :data:`auxiliary_item_dtypes`.

Returns
-------
Expand Down Expand Up @@ -357,7 +360,7 @@ def _import_batch(
"nce": np.array(ce_list, dtype=np.float32).copy(),
}
for key, val in list(auxiliary_dict.items()):
auxiliary_dict[key] = np.array(val, dtype=__auxiliary_item_dtypes__[key]).copy()
auxiliary_dict[key] = np.array(val, dtype=auxiliary_item_dtypes[key]).copy()
spec_dict.update(auxiliary_dict)
return spec_dict

Expand Down
10 changes: 5 additions & 5 deletions docs/build_docs.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
rm -rf build
conda env remove -n alphabasedocs
conda create -n alphabasedocs python=3.9 -y
# conda create -n alphatimsinstaller python=3.9
conda activate alphabasedocs
rm -rf _build
conda env remove -n alpharawdocs
conda create -n alpharawdocs python=3.10 -y
# conda create -n alphatimsinstaller python=3.10
conda activate alpharawdocs
# call conda install git -y
# call pip install 'git+https://github.com/MannLabs/alphatims.git#egg=alphatims[gui]' --use-feature=2020-resolver
# brew install freetype
Expand Down
7 changes: 6 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"sphinx.ext.intersphinx",
"sphinx.ext.linkcode",
"sphinx.ext.viewcode",
# 'sphinx.ext.autodoc',
"autodocsumm",
"nbsphinx",
"myst_parser",
Expand Down Expand Up @@ -80,7 +81,7 @@ def linkcode_resolve(domain, info):
# e.g. object is a typing.Union
return None
file = os.path.relpath(file, os.path.abspath(".."))
if not file.startswith("peptdeep"):
if not file.startswith("alpharaw"):
# e.g. object is a typing.NewType
return None
start, end = lines[1], lines[1] + len(lines[0]) - 1
Expand All @@ -100,6 +101,10 @@ def linkcode_resolve(domain, info):
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

html_css_files = [
"css/custom.css",
]

autodoc_default_options = {
"autosummary": True,
"special-members": "__init__", # Include __init__ methods.
Expand Down
9 changes: 6 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
Documentation for AlphaRaw
=====================================

The deep learning framework MS proteomics.
For more information, see AlphaPeptDeep on `GitHub <https://github.com/MannLabs/alpharaw/>`_.
AlphaRaw is a pure Python package which is designed to load MS data of different formats
(Thermo, Sciex, mzml, ...) into a standard DataFrame (tabular) format.
For more information, see AlphaRaw on `GitHub <https://github.com/MannLabs/alpharaw/>`_.

.. toctree::
:maxdepth: 2

notebooks
reader_modules
match_modules
viz_modules
7 changes: 7 additions & 0 deletions docs/match/match_utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alpharaw.match.match_utils
==========================

.. automodule:: alpharaw.match.match_utils
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/match/psm_match.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alpharaw.match.psm_match
==========================

.. automodule:: alpharaw.match.psm_match
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/match/spec_finder.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alpharaw.match.spec_finder
==========================

.. automodule:: alpharaw.match.spec_finder
:members:
:undoc-members:
:show-inheritance:
9 changes: 9 additions & 0 deletions docs/match_modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
match functionalities
===========================

.. toctree::
:maxdepth: 1

match/match_utils
match/psm_match
match/spec_finder
10 changes: 10 additions & 0 deletions docs/reader_modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
readers modules
===========================

.. toctree::
:maxdepth: 1

readers/ms_data_base
readers/thermo
readers/sciex
readers/mzml
7 changes: 7 additions & 0 deletions docs/readers/ms_data_base.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alpharaw.ms_data_base
==========================

.. automodule:: alpharaw.ms_data_base
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/readers/mzml.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alpharaw.mzml
==========================

.. automodule:: alpharaw.mzml
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/readers/sciex.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alpharaw.sciex
==========================

.. automodule:: alpharaw.sciex
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/readers/thermo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alpharaw.thermo
==========================

.. automodule:: alpharaw.thermo
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/viz/df_utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alpharaw.viz.df_utils
==========================

.. automodule:: alpharaw.viz.df_utils
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/viz/plot_utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alpharaw.viz.plot_utils
==========================

.. automodule:: alpharaw.viz.plot_utils
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/viz/psm_plot.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alpharaw.viz.psm_plot
==========================

.. automodule:: alpharaw.viz.psm_plot
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/viz/xic_plot.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
alpharaw.viz.xic_plot
==========================

.. automodule:: alpharaw.viz.xic_plot
:members:
:undoc-members:
:show-inheritance:
10 changes: 10 additions & 0 deletions docs/viz_modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
visualization
===========================

.. toctree::
:maxdepth: 1

viz/df_utils
viz/plot_utils
viz/psm_plot
viz/xic_plot
Loading