protdata 0.1.1__tar.gz → 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: protdata
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Proteomics data loaders for AnnData format.
5
5
  Author: Max Frank
6
6
  License-Expression: MIT
@@ -9,7 +9,7 @@ Classifier: Operating System :: OS Independent
9
9
  Classifier: Development Status :: 3 - Alpha
10
10
  Classifier: Intended Audience :: Science/Research
11
11
  Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
12
- Requires-Python: >=3.10
12
+ Requires-Python: <4.0,>=3.9
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
  Requires-Dist: anndata
@@ -18,6 +18,25 @@ Requires-Dist: numpy
18
18
  Requires-Dist: pyteomics
19
19
  Provides-Extra: dev
20
20
  Requires-Dist: pytest>=7.0.0; extra == "dev"
21
+ Requires-Dist: black~=25.1; extra == "dev"
22
+ Requires-Dist: flake8~=7.0; extra == "dev"
23
+ Requires-Dist: isort~=5.0; extra == "dev"
24
+ Requires-Dist: pre-commit~=3.0; extra == "dev"
25
+ Requires-Dist: pylint~=3.0; extra == "dev"
26
+ Requires-Dist: pytest~=8.0; extra == "dev"
27
+ Provides-Extra: docs
28
+ Requires-Dist: sphinx>=8.2.1; extra == "docs"
29
+ Requires-Dist: sphinx-book-theme>=1.1.0; extra == "docs"
30
+ Requires-Dist: sphinx-autodoc-typehints>=2.2.0; extra == "docs"
31
+ Requires-Dist: sphinx-issues>=5.0.1; extra == "docs"
32
+ Requires-Dist: sphinx-copybutton; extra == "docs"
33
+ Requires-Dist: sphinx-toolbox>=3.8.0; extra == "docs"
34
+ Requires-Dist: sphinxext.opengraph; extra == "docs"
35
+ Requires-Dist: myst-nb; extra == "docs"
36
+ Requires-Dist: scanpydoc[theme,typehints]>=0.15.3; extra == "docs"
37
+ Requires-Dist: awkward>=2.3; extra == "docs"
38
+ Requires-Dist: IPython; extra == "docs"
39
+ Requires-Dist: myst_parser; extra == "docs"
21
40
  Dynamic: license-file
22
41
 
23
42
  # protdata
@@ -29,8 +48,9 @@ Proteomics data loaders for the [AnnData](https://anndata.readthedocs.io/) forma
29
48
  This package provides loader functions to import proteomics data (e.g., MaxQuant) into the AnnData structure for downstream analysis and integration with single-cell and multi-omics workflows.
30
49
 
31
50
  ## Features
32
- - Load MaxQuant output into AnnData
33
- - Designed for extensibility (other loaders coming soon)
51
+
52
+ - **Multiple formats**: Support for MaxQuant, FragPipe, DIA-NN, and mzTab files
53
+ - **Reads metadata**: Automatically extracts and organizes sample and protein metadata
34
54
 
35
55
  ## Installation
36
56
  ```bash
@@ -7,8 +7,9 @@ Proteomics data loaders for the [AnnData](https://anndata.readthedocs.io/) forma
7
7
  This package provides loader functions to import proteomics data (e.g., MaxQuant) into the AnnData structure for downstream analysis and integration with single-cell and multi-omics workflows.
8
8
 
9
9
  ## Features
10
- - Load MaxQuant output into AnnData
11
- - Designed for extensibility (other loaders coming soon)
10
+
11
+ - **Multiple formats**: Support for MaxQuant, FragPipe, DIA-NN, and mzTab files
12
+ - **Reads metadata**: Automatically extracts and organizes sample and protein metadata
12
13
 
13
14
  ## Installation
14
15
  ```bash
@@ -0,0 +1,101 @@
1
+ from __future__ import annotations
2
+
3
+ import sys
4
+ from datetime import datetime
5
+ from importlib import metadata
6
+ from pathlib import Path
7
+
8
+ from sphinx.application import Sphinx
9
+
10
+ HERE = Path(__file__).parent
11
+ sys.path.insert(0, str(HERE.parent.parent))
12
+
13
+ import protdata
14
+
15
+
16
+ # -- General configuration ------------------------------------------------
17
+
18
+ project = "protdata"
19
+ author = "Max Frank"
20
+ copyright = f"{datetime.now():%Y}, Max Frank"
21
+ release = version = metadata.version("protdata")
22
+
23
+ templates_path = ["_templates"]
24
+ html_static_path = ["_static"]
25
+ source_suffix = {".rst": "restructuredtext", ".md": "myst-nb"}
26
+ master_doc = "index"
27
+ default_role = "literal"
28
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**.ipynb_checkpoints"]
29
+ pygments_style = "sphinx"
30
+
31
+ extensions = [
32
+ "myst_nb",
33
+ "sphinx_copybutton",
34
+ "sphinx.ext.autodoc",
35
+ "sphinx.ext.intersphinx",
36
+ "sphinx.ext.doctest",
37
+ "sphinx.ext.coverage",
38
+ "sphinx.ext.mathjax",
39
+ "sphinx.ext.napoleon",
40
+ "sphinx.ext.autosummary",
41
+ "sphinx_autodoc_typehints",
42
+ "sphinx_issues",
43
+ "sphinx_design",
44
+ "sphinxext.opengraph",
45
+ "scanpydoc",
46
+ "IPython.sphinxext.ipython_console_highlighting",
47
+ ]
48
+
49
+ myst_enable_extensions = ["colon_fence", "dollarmath"]
50
+ myst_heading_anchors = 3
51
+ nb_execution_mode = "off"
52
+
53
+ autosummary_generate = True
54
+ autodoc_member_order = "bysource"
55
+ napoleon_google_docstring = False
56
+ napoleon_numpy_docstring = True
57
+ napoleon_use_rtype = True
58
+ napoleon_use_param = True
59
+ typehints_defaults = "braces"
60
+ issues_github_path = "czbiohub-sf/protdata"
61
+
62
+ nitpicky = True
63
+ nitpick_ignore = []
64
+
65
+ intersphinx_mapping = dict(
66
+ python=("https://docs.python.org/3", None),
67
+ numpy=("https://numpy.org/doc/stable", None),
68
+ pandas=("https://pandas.pydata.org/pandas-docs/stable", None),
69
+ anndata=("https://anndata.readthedocs.io/en/stable/", None),
70
+ scipy=("https://docs.scipy.org/doc/scipy", None),
71
+ h5py=("https://docs.h5py.org/en/latest", None),
72
+ )
73
+
74
+ # qualname_overrides = {
75
+ # "h5py._hl.group.Group": "h5py.Group",
76
+ # "h5py._hl.files.File": "h5py.File",
77
+ # "h5py._hl.dataset.Dataset": "h5py.Dataset",
78
+ # "anndata._core.anndata.AnnData": "anndata.AnnData",
79
+ # }
80
+
81
+
82
+ # -- Social cards ---------------------------------------------------------
83
+
84
+ # ogp_site_url = "https://protdata.readthedocs.io/"
85
+
86
+
87
+ # -- Options for HTML output ----------------------------------------------
88
+
89
+ html_theme = "scanpydoc"
90
+ html_theme_options = dict(
91
+ use_repository_button=True,
92
+ repository_url="https://github.com/czbiohub-sf/protdata",
93
+ repository_branch="main",
94
+ navigation_with_keys=False,
95
+ )
96
+ html_show_sphinx = False
97
+ html_logo = "_static/img/protdata_schema.svg"
98
+
99
+
100
+ def setup(app: Sphinx):
101
+ app.add_css_file("css/custom.css")
@@ -0,0 +1 @@
1
+ from . import io
@@ -1,8 +1,11 @@
1
- import pandas as pd
2
- import numpy as np
3
- import anndata as ad
4
- from typing import Union
5
1
  import os
2
+ from typing import Union
3
+
4
+ import anndata as ad
5
+ import numpy as np
6
+ import pandas as pd
7
+
8
+ from .utils import cleanup_obsvar
6
9
 
7
10
 
8
11
  def read_diann(
@@ -13,17 +16,23 @@ def read_diann(
13
16
  """
14
17
  Load DIA-NN protein group matrix (report.pg_matrix.tsv) into an AnnData object.
15
18
 
16
- Args:
17
- file: Path to DIA-NN report.pg_matrix.tsv or a pandas DataFrame.
18
- intensity_suffix: Suffix for intensity columns (default: '_Intensity').
19
- index_column: Column name for protein group IDs (default: 'Protein.Group').
20
- sep: File separator (default: tab).
19
+ Parameters
20
+ ----------
21
+ file
22
+ Path to DIA-NN report.pg_matrix.tsv file or a pandas DataFrame containing the data.
23
+ index_column
24
+ Column name for protein group IDs.
25
+ sep
26
+ File separator.
21
27
 
22
- Returns:
28
+ Returns
29
+ -------
30
+ anndata.AnnData
23
31
  AnnData object with:
24
- - X: intensity matrix (proteins x samples)
25
- - var: protein metadata
26
- - obs: sample metadata
32
+
33
+ - X: intensity matrix (samples x proteins)
34
+ - var: protein metadata (indexed by protein group IDs)
35
+ - obs: sample metadata (indexed by sample names)
27
36
  """
28
37
  if isinstance(file, pd.DataFrame):
29
38
  df = file.copy()
@@ -46,9 +55,11 @@ def read_diann(
46
55
  ]
47
56
 
48
57
  df.columns = [
49
- os.path.basename(col)
50
- if isinstance(col, str) and col not in no_sample_column
51
- else str(col)
58
+ (
59
+ os.path.basename(col)
60
+ if isinstance(col, str) and col not in no_sample_column
61
+ else str(col)
62
+ )
52
63
  for col in df.columns
53
64
  ]
54
65
 
@@ -59,7 +70,7 @@ def read_diann(
59
70
  # Find intensity columns (all columns not in no_sample_column)
60
71
  intensity_cols = df.columns.difference(no_sample_column, sort=False).tolist()
61
72
  if not intensity_cols:
62
- raise ValueError(f"No intensity columns found.")
73
+ raise ValueError("No intensity columns found.")
63
74
 
64
75
  # Build X matrix (proteins x samples)
65
76
  X = df[intensity_cols].to_numpy(dtype=np.float32).T
@@ -67,12 +78,18 @@ def read_diann(
67
78
  # Build var (proteins)
68
79
  var = df[df.columns.intersection(no_sample_column, sort=False)].copy()
69
80
  var.index = df[index_column]
81
+ var = cleanup_obsvar(var)
70
82
 
71
83
  # Build obs (samples)
72
84
  obs = pd.DataFrame(index=intensity_cols)
85
+ obs = cleanup_obsvar(obs)
73
86
 
74
87
  # Build uns
75
- uns = {"Search_Engine": "DIANN"}
88
+ uns = {
89
+ "RawInfo": {
90
+ "Search_Engine": "DIANN",
91
+ },
92
+ }
76
93
 
77
94
  # Create AnnData
78
95
  adata = ad.AnnData(X=X, obs=obs, var=var)
@@ -3,6 +3,7 @@ import numpy as np
3
3
  import anndata as ad
4
4
  from typing import Union
5
5
  import warnings
6
+ from .utils import cleanup_obsvar
6
7
 
7
8
 
8
9
  def read_fragpipe(
@@ -16,21 +17,29 @@ def read_fragpipe(
16
17
  sep: str = "\t",
17
18
  ) -> ad.AnnData:
18
19
  """
19
- Load FragPipe-Philosopher protein group matrix into an AnnData object.
20
+ Load a FragPipe protein group matrix into an AnnData object.
20
21
 
21
- Args:
22
- file: Path to combined_protein.tsv or a pandas DataFrame.
23
- intensity_column_prefix: Prefix for intensity columns (default: '[sample] MaxLFQ Intensity ').
24
- index_column: Column name for protein IDs (default: 'Protein').
25
- gene_names_column: Column name for gene names (default: 'Gene Names').
26
- confidence_column: Column name for protein probability (default: 'Protein Probability').
27
- sep: File separator (default: tab).
22
+ Parameters
23
+ ----------
24
+ file
25
+ Path to the FragPipe combined_protein.tsv file or a pandas DataFrame containing the data.
26
+ intensity_column_suffixes
27
+ Suffix(es) for intensity columns to extract.
28
+ The first suffix is used for the main matrix (X), others are stored as layers if present.
29
+ index_column
30
+ Column name to use as protein index.
31
+ sep
32
+ File separator if reading from file.
28
33
 
29
- Returns:
34
+ Returns
35
+ -------
36
+ anndata.AnnData
30
37
  AnnData object with:
31
- - X: intensity matrix (proteins x samples)
32
- - var: protein metadata
33
- - obs: sample metadata
38
+
39
+ - X: intensity matrix (samples x proteins)
40
+ - var: protein metadata (indexed by protein IDs)
41
+ - obs: sample metadata (indexed by sample names)
42
+ - layers: additional intensity matrices if multiple intensity column suffixes are provided
34
43
  """
35
44
  if isinstance(intensity_column_suffixes, str):
36
45
  intensity_column_suffixes = [intensity_column_suffixes]
@@ -74,12 +83,18 @@ def read_fragpipe(
74
83
  )
75
84
  var = df.loc[:, ~sample_columns].copy()
76
85
  var.index = df[index_column]
86
+ var = cleanup_obsvar(var)
77
87
 
78
88
  # Build obs (samples)
79
89
  obs = pd.DataFrame(index=sample_names)
90
+ obs = cleanup_obsvar(obs)
80
91
 
81
92
  # Build uns
82
- uns = {"Search_Engine": "FragPipe_Philosopher"}
93
+ uns = {
94
+ "RawInfo": {
95
+ "Search_Engine": "FragPipe",
96
+ },
97
+ }
83
98
 
84
99
  # Create AnnData
85
100
  adata = ad.AnnData(X=X, obs=obs, var=var, layers=layers)
@@ -1,13 +1,22 @@
1
- import pandas as pd
2
- import numpy as np
3
- import anndata as ad
4
- from typing import Optional, Union, List
1
+ from __future__ import annotations
2
+
5
3
  import warnings
4
+ from typing import List, Union
5
+
6
+ import anndata as ad
7
+ import numpy as np
8
+ import pandas as pd
9
+
10
+ from .utils import cleanup_obsvar
6
11
 
7
12
 
8
13
  def read_maxquant(
9
14
  file: Union[str, pd.DataFrame],
10
- intensity_column_prefixes: List[str] | str = ["LFQ intensity ", "Intensity "],
15
+ intensity_column_prefixes: List[str] | str = [
16
+ "LFQ intensity ",
17
+ "Intensity ",
18
+ "MS/MS count ",
19
+ ],
11
20
  index_column: str = "Protein IDs",
12
21
  filter_columns: list[str] = [
13
22
  "Only identified by site",
@@ -20,18 +29,29 @@ def read_maxquant(
20
29
  """
21
30
  Load MaxQuant proteinGroups.txt into an AnnData object.
22
31
 
23
- Args:
24
- file: Path to proteinGroups.txt or a pandas DataFrame.
25
- intensity_column_prefix: Prefix for intensity columns (default: 'LFQ intensity ').
26
- index_column: Column name for protein IDs (default: 'Protein IDs').
27
- gene_names_column: Column name for gene names (default: 'Gene names').
28
- sep: File separator (default: tab).
32
+ Parameters
33
+ ----------
34
+ file
35
+ Path to the MaxQuant proteinGroups.txt file or a pandas DataFrame containing the data.
36
+ intensity_column_prefixes
37
+ Prefix(es) for intensity columns to extract.
38
+ The first prefix is used for the main matrix (X), others are stored as layers if present.
39
+ index_column
40
+ Column name to use as protein index.
41
+ filter_columns
42
+ Columns to use for filtering out contaminants or unwanted entries.
43
+ sep
44
+ File separator if reading from file.
29
45
 
30
- Returns:
46
+ Returns
47
+ -------
48
+ anndata.AnnData
31
49
  AnnData object with:
32
- - X: intensity matrix (proteins x samples)
33
- - var: protein metadata
34
- - obs: sample metadata
50
+
51
+ - X: intensity matrix (samples x proteins)
52
+ - var: protein metadata (indexed by protein IDs)
53
+ - obs: sample metadata (indexed by sample names)
54
+ - layers: additional intensity matrices if multiple intensity column prefixes are provided
35
55
  """
36
56
  if isinstance(intensity_column_prefixes, str):
37
57
  intensity_column_prefixes = [intensity_column_prefixes]
@@ -65,7 +85,10 @@ def read_maxquant(
65
85
  if col in [prefix + sample_name for sample_name in sample_names]
66
86
  ]
67
87
  if len(prefix_cols) == len(sample_names):
68
- layers[prefix.strip()] = df[prefix_cols].to_numpy(dtype=np.float32).T
88
+ # Cannot have '/' in the key (hdf5 interprets as a group for serialization)
89
+ layers[prefix.strip().replace("/", "_")] = (
90
+ df[prefix_cols].to_numpy(dtype=np.float32).T
91
+ )
69
92
  else:
70
93
  warnings.warn(
71
94
  f"Number of columns for prefix '{prefix}' does not match number of samples."
@@ -78,12 +101,19 @@ def read_maxquant(
78
101
  )
79
102
  var = df.loc[:, ~sample_columns].copy()
80
103
  var.index = df[index_column]
104
+ var = cleanup_obsvar(var)
81
105
 
82
106
  # Build obs (samples)
83
107
  obs = pd.DataFrame(index=sample_names)
108
+ obs = cleanup_obsvar(obs)
84
109
 
85
110
  # Build uns
86
- uns = {"Search_Engine": "MaxQuant"}
111
+ uns = {
112
+ "RawInfo": {
113
+ "Search_Engine": "MaxQuant",
114
+ "filter_columns": filter_columns,
115
+ },
116
+ }
87
117
 
88
118
  # Create AnnData
89
119
  adata = ad.AnnData(X=X, obs=obs, var=var, layers=layers, uns=uns)
@@ -1,9 +1,12 @@
1
- import pandas as pd
2
- import numpy as np
3
- import anndata as ad
4
1
  from typing import Union
2
+
3
+ import anndata as ad
4
+ import numpy as np
5
+ import pandas as pd
5
6
  from pyteomics import mztab
6
7
 
8
+ from .utils import cleanup_obsvar
9
+
7
10
 
8
11
  def read_mztab(
9
12
  file: Union[str, pd.DataFrame],
@@ -12,16 +15,21 @@ def read_mztab(
12
15
  """
13
16
  Load mzTab protein table into an AnnData object.
14
17
 
15
- Args:
16
- file: Path to mzTab file or a pandas DataFrame (protein table).
17
- intensity_column_prefix: Prefix for intensity columns (default: 'protein_abundance_').
18
- index_column: Column indicating the protein groups (default: 'accession').
18
+ Parameters
19
+ ----------
20
+ file
21
+ Path to mzTab file or a pandas DataFrame containing the protein table.
22
+ index_column
23
+ Column indicating the protein groups.
19
24
 
20
- Returns:
25
+ Returns
26
+ -------
27
+ anndata.AnnData
21
28
  AnnData object with:
22
- - X: intensity matrix (proteins x samples)
23
- - var: protein metadata
24
- - obs: sample metadata
29
+
30
+ - X: intensity matrix (proteins x samples)
31
+ - var: protein metadata (indexed by protein accession)
32
+ - obs: sample metadata (indexed by sample names)
25
33
  """
26
34
  if isinstance(file, pd.DataFrame):
27
35
  df = file.copy()
@@ -35,26 +43,25 @@ def read_mztab(
35
43
  ]
36
44
  if not intensity_cols:
37
45
  raise ValueError(
38
- f"No columns starting with 'protein_abundance_study_variable' found."
46
+ "No columns starting with 'protein_abundance_study_variable' found."
39
47
  )
40
48
 
41
- # Extract sample names from intensity columns
42
- sample_names = [col.split("[")[1].split("]")[0] for col in intensity_cols]
43
-
44
49
  # Build X matrix (proteins x samples)
45
50
  X = df[intensity_cols].to_numpy(dtype=np.float32).T
46
51
 
47
52
  # Build var (proteins)
48
53
  var = df.drop(columns=intensity_cols).copy()
49
54
  var.index = df[index_column].astype(str)
55
+ var = cleanup_obsvar(var)
50
56
 
51
57
  # Build obs (samples)
52
58
  obs = pd.DataFrame.from_dict(tables.study_variables, orient="index")
53
59
  obs.index.name = "sample"
54
60
  obs.index = obs.index.astype(str)
61
+ obs = cleanup_obsvar(obs)
55
62
 
56
63
  # Build uns
57
- uns = {"Search_Engine": df.search_engine.iloc[0]}
64
+ uns = {"RawInfo": {"Search_Engine": str(df.search_engine.iloc[0])}}
58
65
 
59
66
  # Create AnnData
60
67
  adata = ad.AnnData(X=X, obs=obs, var=var, uns=uns)
@@ -0,0 +1,8 @@
1
+ def cleanup_obsvar(df):
2
+ """
3
+ Convert object columns to strings to avoid h5ad serialization issues.
4
+ """
5
+ for col in df.columns:
6
+ if df[col].dtype == "object":
7
+ df[col] = df[col].astype(str)
8
+ return df
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: protdata
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Proteomics data loaders for AnnData format.
5
5
  Author: Max Frank
6
6
  License-Expression: MIT
@@ -9,7 +9,7 @@ Classifier: Operating System :: OS Independent
9
9
  Classifier: Development Status :: 3 - Alpha
10
10
  Classifier: Intended Audience :: Science/Research
11
11
  Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
12
- Requires-Python: >=3.10
12
+ Requires-Python: <4.0,>=3.9
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
15
  Requires-Dist: anndata
@@ -18,6 +18,25 @@ Requires-Dist: numpy
18
18
  Requires-Dist: pyteomics
19
19
  Provides-Extra: dev
20
20
  Requires-Dist: pytest>=7.0.0; extra == "dev"
21
+ Requires-Dist: black~=25.1; extra == "dev"
22
+ Requires-Dist: flake8~=7.0; extra == "dev"
23
+ Requires-Dist: isort~=5.0; extra == "dev"
24
+ Requires-Dist: pre-commit~=3.0; extra == "dev"
25
+ Requires-Dist: pylint~=3.0; extra == "dev"
26
+ Requires-Dist: pytest~=8.0; extra == "dev"
27
+ Provides-Extra: docs
28
+ Requires-Dist: sphinx>=8.2.1; extra == "docs"
29
+ Requires-Dist: sphinx-book-theme>=1.1.0; extra == "docs"
30
+ Requires-Dist: sphinx-autodoc-typehints>=2.2.0; extra == "docs"
31
+ Requires-Dist: sphinx-issues>=5.0.1; extra == "docs"
32
+ Requires-Dist: sphinx-copybutton; extra == "docs"
33
+ Requires-Dist: sphinx-toolbox>=3.8.0; extra == "docs"
34
+ Requires-Dist: sphinxext.opengraph; extra == "docs"
35
+ Requires-Dist: myst-nb; extra == "docs"
36
+ Requires-Dist: scanpydoc[theme,typehints]>=0.15.3; extra == "docs"
37
+ Requires-Dist: awkward>=2.3; extra == "docs"
38
+ Requires-Dist: IPython; extra == "docs"
39
+ Requires-Dist: myst_parser; extra == "docs"
21
40
  Dynamic: license-file
22
41
 
23
42
  # protdata
@@ -29,8 +48,9 @@ Proteomics data loaders for the [AnnData](https://anndata.readthedocs.io/) forma
29
48
  This package provides loader functions to import proteomics data (e.g., MaxQuant) into the AnnData structure for downstream analysis and integration with single-cell and multi-omics workflows.
30
49
 
31
50
  ## Features
32
- - Load MaxQuant output into AnnData
33
- - Designed for extensibility (other loaders coming soon)
51
+
52
+ - **Multiple formats**: Support for MaxQuant, FragPipe, DIA-NN, and mzTab files
53
+ - **Reads metadata**: Automatically extracts and organizes sample and protein metadata
34
54
 
35
55
  ## Installation
36
56
  ```bash
@@ -0,0 +1,19 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.cfg
5
+ docs/source/conf.py
6
+ protdata/__init__.py
7
+ protdata.egg-info/PKG-INFO
8
+ protdata.egg-info/SOURCES.txt
9
+ protdata.egg-info/dependency_links.txt
10
+ protdata.egg-info/requires.txt
11
+ protdata.egg-info/top_level.txt
12
+ protdata/io/__init__.py
13
+ protdata/io/diann_loader.py
14
+ protdata/io/fragpipe_loader.py
15
+ protdata/io/maxquant_loader.py
16
+ protdata/io/mztab_loader.py
17
+ protdata/io/utils.py
18
+ tests/test_loaders.py
19
+ tests/test_maxquant_loader.py
@@ -0,0 +1,27 @@
1
+ anndata
2
+ pandas
3
+ numpy
4
+ pyteomics
5
+
6
+ [dev]
7
+ pytest>=7.0.0
8
+ black~=25.1
9
+ flake8~=7.0
10
+ isort~=5.0
11
+ pre-commit~=3.0
12
+ pylint~=3.0
13
+ pytest~=8.0
14
+
15
+ [docs]
16
+ sphinx>=8.2.1
17
+ sphinx-book-theme>=1.1.0
18
+ sphinx-autodoc-typehints>=2.2.0
19
+ sphinx-issues>=5.0.1
20
+ sphinx-copybutton
21
+ sphinx-toolbox>=3.8.0
22
+ sphinxext.opengraph
23
+ myst-nb
24
+ scanpydoc[theme,typehints]>=0.15.3
25
+ awkward>=2.3
26
+ IPython
27
+ myst_parser
@@ -0,0 +1,5 @@
1
+ data
2
+ dist
3
+ docs
4
+ protdata
5
+ tests
@@ -1,12 +1,12 @@
1
1
  [project]
2
2
  name = "protdata"
3
- version = "0.1.1"
3
+ version = "0.1.3"
4
4
  description = "Proteomics data loaders for AnnData format."
5
+ requires-python = ">=3.9, <4.0"
5
6
  authors = [
6
7
  { name = "Max Frank" }
7
8
  ]
8
9
  readme = "README.md"
9
- requires-python = ">=3.10"
10
10
  dependencies = [
11
11
  "anndata",
12
12
  "pandas",
@@ -25,7 +25,27 @@ license-files = ["LICENSE"]
25
25
 
26
26
  [project.optional-dependencies]
27
27
  dev = [
28
- "pytest>=7.0.0"
28
+ "pytest>=7.0.0",
29
+ "black~=25.1",
30
+ "flake8~=7.0",
31
+ "isort~=5.0",
32
+ "pre-commit~=3.0",
33
+ "pylint~=3.0",
34
+ "pytest~=8.0",
35
+ ]
36
+ docs = [
37
+ "sphinx>=8.2.1",
38
+ "sphinx-book-theme>=1.1.0",
39
+ "sphinx-autodoc-typehints>=2.2.0",
40
+ "sphinx-issues>=5.0.1",
41
+ "sphinx-copybutton",
42
+ "sphinx-toolbox>=3.8.0",
43
+ "sphinxext.opengraph",
44
+ "myst-nb",
45
+ "scanpydoc[theme,typehints] >=0.15.3",
46
+ "awkward>=2.3",
47
+ "IPython", # For syntax highlighting in notebooks
48
+ "myst_parser",
29
49
  ]
30
50
 
31
51
  [build-system]
@@ -33,4 +53,4 @@ requires = ["setuptools>=61.0"]
33
53
  build-backend = "setuptools.build_meta"
34
54
 
35
55
  [tool.setuptools.packages.find]
36
- where = ["protdata"]
56
+ where = ["."]
@@ -0,0 +1,26 @@
1
+ [flake8]
2
+ max-line-length = 95
3
+ ignore =
4
+ E203,
5
+ W503,
6
+ E128,
7
+ E226,
8
+ E501,
9
+ per-file-ignores =
10
+ */__init__.py: F401
11
+ exclude =
12
+ .git,
13
+ __pycache__,
14
+ build,
15
+ dist,
16
+ docs,
17
+ notebooks,
18
+ ignore,
19
+ .venv,
20
+ .eggs,
21
+ .tox,
22
+
23
+ [egg_info]
24
+ tag_build =
25
+ tag_date = 0
26
+
@@ -16,10 +16,24 @@ data_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../data"))
16
16
  ("SILAC_SQ.mzTab", read_mztab),
17
17
  ],
18
18
  )
19
- def test_loader(filename, loader):
19
+ def test_loader(filename, loader, tmp_path):
20
20
  path = os.path.join(data_dir, filename)
21
21
  if not os.path.isfile(path):
22
22
  pytest.skip(f"Test data file {filename} not found.")
23
23
  adata = loader(path)
24
24
  assert isinstance(adata, ad.AnnData)
25
25
  assert adata.shape[0] > 0 and adata.shape[1] > 0
26
+ # Make sure the anndata file can be saved and loaded
27
+ test_file = tmp_path / "test.h5ad"
28
+ adata.write_h5ad(test_file)
29
+ adata2 = ad.read_h5ad(test_file)
30
+ assert adata2.shape == adata.shape
31
+ assert (
32
+ adata2.uns["RawInfo"]["Search_Engine"] == adata.uns["RawInfo"]["Search_Engine"]
33
+ )
34
+ if "filter_columns" in adata.uns["RawInfo"]:
35
+ assert list(adata2.uns["RawInfo"]["filter_columns"]) == list(
36
+ adata.uns["RawInfo"]["filter_columns"]
37
+ )
38
+ assert adata2.var.equals(adata.var)
39
+ assert adata2.obs.equals(adata.obs)
@@ -1,15 +0,0 @@
1
- LICENSE
2
- README.md
3
- pyproject.toml
4
- protdata/io/__init__.py
5
- protdata/io/diann_loader.py
6
- protdata/io/fragpipe_loader.py
7
- protdata/io/maxquant_loader.py
8
- protdata/io/mztab_loader.py
9
- protdata/protdata.egg-info/PKG-INFO
10
- protdata/protdata.egg-info/SOURCES.txt
11
- protdata/protdata.egg-info/dependency_links.txt
12
- protdata/protdata.egg-info/requires.txt
13
- protdata/protdata.egg-info/top_level.txt
14
- tests/test_loaders.py
15
- tests/test_maxquant_loader.py
@@ -1,7 +0,0 @@
1
- anndata
2
- pandas
3
- numpy
4
- pyteomics
5
-
6
- [dev]
7
- pytest>=7.0.0
protdata-0.1.1/setup.cfg DELETED
@@ -1,4 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
File without changes