Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d7e9ac9
feat: add .gitignore file
ilypopv Jul 31, 2026
b883514
chore: update author email
ilypopv Jul 31, 2026
ed5b7ed
chore: ignore uv.lock file to prevent unnecessary commits
ilypopv Aug 5, 2026
b2e7cdd
feat: expose clustermap in krakenparser for easier module access
ilypopv Aug 5, 2026
60e0473
refactor(krakenparser): update type hints to use Annotated for better…
ilypopv Aug 5, 2026
0e677e4
refactor: use Annotated for typer options to improve type hinting cla…
ilypopv Aug 5, 2026
93794ed
refactor(krakenparser): update type hints in split_mpa to use Annotat…
ilypopv Aug 5, 2026
474e042
refactor: update __all__ list in kpplot to include KpPlotBase and cor…
ilypopv Aug 5, 2026
3127a68
refactor(kpplot): update type hints in KpPlotBase for modern Python s…
ilypopv Aug 5, 2026
c6139de
refactor(clustermap): update type hints for improved Python 3.10 comp…
ilypopv Aug 5, 2026
ed41b0e
refactor: update type hints and function signatures to modern Python …
ilypopv Aug 5, 2026
b660e02
refactor(streamgraph): update type hints in function signature to use…
ilypopv Aug 5, 2026
44f7117
refactor(krakenparser): update type hints to use Annotated and union …
ilypopv Aug 5, 2026
19124d3
refactor: update type hints to use Annotated for better clarity in CL…
ilypopv Aug 5, 2026
a15b349
refactor(krakenparser/mpa): update type hints in transform2mpa.py to …
ilypopv Aug 5, 2026
d0b7517
refactor(pipeline): update type hints and argument definitions for mo…
ilypopv Aug 5, 2026
b4b9d41
refactor(krakenparser): update type hints and argument definitions fo…
ilypopv Aug 5, 2026
f700320
refactor(relabund): update type hints in relabund module for modern P…
ilypopv Aug 5, 2026
7fef873
style: remove shebang line from krakenparser/utils.py
ilypopv Aug 5, 2026
5614bf6
test: rename unused variables in test_units.py to underscore convention
ilypopv Aug 5, 2026
c73a8f6
build: add pythonpath to pyproject.toml for improved dependency resol…
ilypopv Aug 5, 2026
fefc51c
chore: bump version to 1.1.3
ilypopv Aug 13, 2026
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
139 changes: 139 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
.env
.venv
venv/
ENV/
env/

# Jupyter Notebook
.ipynb_checkpoints/
*.nbconvert.ipynb

# PyCharm
.idea/

# VSCode
.vscode/

# macOS
.DS_Store

# Linux
*~

# Logs
logs/
*.log

# Testing
.pytest_cache/
.coverage
htmlcov/
.tox/
.mypy_cache/
.ruff_cache/

# Type checking
.pyre/

# Data files
data/
datasets/
*.csv
*.tsv
*.parquet
*.feather
*.h5
*.hdf5
*.db

# Model artifacts
models/
checkpoints/
*.ckpt
*.pt
*.pth
*.onnx
*.joblib
*.pkl

# Experiment tracking
mlruns/
wandb/
tensorboard/
runs/

# Outputs
outputs/
results/
figures/
plots/
reports/

# Temporary files
tmp/
temp/
*.tmp

# Secrets / credentials
.env.local
.env.*
!.env.example

# Package managers
Pipfile.lock

# Hatch
.hatch/

# DVC
.dvc/cache/
.dvc/tmp/

# Snakemake
.snakemake/

# R
.Rhistory
.RData
.Rproj.user/

# Docker
*.pid

# AWS / cloud
.aws/

# IDE-specific notebooks
.spyproject/

# Ignore large binaries
*.zip
*.tar.gz
*.7z
uv.lock
4 changes: 3 additions & 1 deletion krakenparser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env python3

from .kpplot.clustermap import clustermap
from .kpplot.stackedbar import stacked_barplot
from .kpplot.streamgraph import streamgraph

__all__: list[str] = [
"clustermap",
"stacked_barplot",
"streamgraph",
"clustermap",
]
30 changes: 17 additions & 13 deletions krakenparser/counts/convert2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import logging
from pathlib import Path
from typing import Optional
from typing import Annotated

import pandas as pd
import typer
Expand Down Expand Up @@ -57,18 +57,22 @@ def convert_to_csv(input_file: Path, output_file: Path) -> None:
@app.callback(invoke_without_command=True)
def main(
ctx: typer.Context,
input_file: Optional[Path] = typer.Option(
None,
"-i",
"--input",
help="Path to the input tab-delimited TXT file (samples in columns, taxa in rows).",
),
output_file: Optional[Path] = typer.Option(
None,
"-o",
"--output",
help="Path to the output transposed CSV file.",
),
input_file: Annotated[
Path | None,
typer.Option(
"-i",
"--input",
help="Path to the input tab-delimited TXT file (samples in columns, taxa in rows).",
),
] = None,
output_file: Annotated[
Path | None,
typer.Option(
"-o",
"--output",
help="Path to the output transposed CSV file.",
),
] = None,
) -> None:
"""Reads a TXT file, reorganizes the data, and converts it into a CSV file."""
logging.basicConfig(level=logging.INFO, format="%(message)s")
Expand Down
30 changes: 17 additions & 13 deletions krakenparser/counts/processing_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sys
import tempfile
from pathlib import Path
from typing import Optional
from typing import Annotated

import typer

Expand Down Expand Up @@ -106,18 +106,22 @@ def process_files(source_file: Path, destination_file: Path) -> None:
@app.callback(invoke_without_command=True)
def main(
ctx: typer.Context,
input_file: Optional[Path] = typer.Option(
None,
"-i",
"--input",
help="Path to the source file (used to extract and truncate header labels).",
),
output_file: Optional[Path] = typer.Option(
None,
"-o",
"--output",
help="Path to the destination matrix undergoing taxonomic name sanitation.",
),
input_file: Annotated[
Path | None,
typer.Option(
"-i",
"--input",
help="Path to the source file (used to extract and truncate header labels).",
),
] = None,
output_file: Annotated[
Path | None,
typer.Option(
"-o",
"--output",
help="Path to the destination matrix undergoing taxonomic name sanitation.",
),
] = None,
) -> None:
"""Reads a source file, processes its first line, modifies taxa names in a destination file, and updates it."""
logging.basicConfig(level=logging.INFO, format="%(message)s")
Expand Down
31 changes: 17 additions & 14 deletions krakenparser/counts/split_mpa.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""Decomposition utility to partition master MPA matrices into rank-specific text tables.

This module splits combined multi-sample MetaPhlAn files into separate tables grouped
Expand All @@ -11,7 +10,7 @@
import re
import sys
from pathlib import Path
from typing import Optional
from typing import Annotated

import typer

Expand Down Expand Up @@ -172,18 +171,22 @@ def split_mpa(
@app.callback(invoke_without_command=True)
def main(
ctx: typer.Context,
input_file: Optional[Path] = typer.Option(
None,
"-i",
"--input",
help="Input combined MPA file.",
),
output_dir: Optional[Path] = typer.Option(
None,
"-o",
"--output",
help="Output directory root pathway.",
),
input_file: Annotated[
Path | None,
typer.Option(
"-i",
"--input",
help="Input combined MPA file.",
),
] = None,
output_dir: Annotated[
Path | None,
typer.Option(
"-o",
"--output",
help="Output directory root pathway.",
),
] = None,
viruses_only: bool = typer.Option(
False,
"--viruses",
Expand Down
6 changes: 3 additions & 3 deletions krakenparser/kpplot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from .streamgraph import KpStreamgraph, streamgraph

__all__: list[str] = [
"KpPlotBase",
"KpClustermap",
"clustermap",
"KpPlotBase",
"KpStackedBarplot",
"stacked_barplot",
"KpStreamgraph",
"clustermap",
"stacked_barplot",
"streamgraph",
]
6 changes: 2 additions & 4 deletions krakenparser/kpplot/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
"""Base classes and data aggregation utilities for metagenomic visualization.

This module provides structural baselines for managing Matplotlib canvas states
Expand All @@ -7,7 +6,6 @@
"""

from pathlib import Path
from typing import Optional, Union

import matplotlib.pyplot as plt
import pandas as pd
Expand Down Expand Up @@ -37,10 +35,10 @@ def plotfig(self) -> plt.Figure:

def savefig(
self,
path: Union[Path, str],
path: Path | str,
dpi: int = 300,
transparent: bool = False,
bbox_inches: Optional[str] = "tight",
bbox_inches: str | None = "tight",
) -> None:
"""Commit the current canvas state atomically to a physical image file.

Expand Down
26 changes: 13 additions & 13 deletions krakenparser/kpplot/clustermap.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python3
"""Hierarchical clustering and heatmap visualization module for metagenomic profiles.

This module leverages Seaborn's ClusterGrid matrix engine to compute and render
dendrogram-driven abundance clusterings, enabling rapid detection of co-occurrence
taxonomic patterns and sample cohort similarities.
"""

from typing import Literal, Optional, Sequence, Tuple
from collections.abc import Sequence
from typing import Literal

import matplotlib.pyplot as plt
import pandas as pd
Expand All @@ -33,22 +33,22 @@ def __init__(self, fig: plt.Figure, ax: plt.Axes, grid: ClusterGrid) -> None:

def clustermap(
df: pd.DataFrame,
metadata: Optional[pd.DataFrame] = None,
metadata_group: Optional[str] = None,
sample_order: Optional[Sequence[str]] = None,
metadata: pd.DataFrame | None = None,
metadata_group: str | None = None,
sample_order: Sequence[str] | None = None,
clust_linewidths: float = 0.5,
clust_linecolor: str = "grey",
x_axis: str = "Sample_id",
y_axis: str = "taxon",
figsize: Optional[Tuple[float, float]] = None,
figsize: tuple[float, float] | None = None,
cmap: str = "Greens",
title: Optional[str] = None,
title: str | None = None,
title_fontsize: float = 16.0,
title_color: str = "black",
title_weight: Literal["normal", "bold", "heavy", "light"] = "normal",
title_style: Literal["normal", "italic", "oblique"] = "normal",
xlabel: Optional[str] = None,
ylabel: Optional[str] = None,
xlabel: str | None = None,
ylabel: str | None = None,
xlabel_fontsize: float = 12.0,
ylabel_fontsize: float = 12.0,
xlabel_color: str = "black",
Expand All @@ -69,11 +69,11 @@ def clustermap(
yticks_color: str = "black",
yticks_weight: Literal["normal", "bold", "heavy", "light"] = "normal",
yticks_style: Literal["normal", "italic", "oblique"] = "normal",
standard_scale: Optional[int] = None,
z_score: Optional[int] = None,
standard_scale: int | None = None,
z_score: int | None = None,
legend_title: str = "Relative abundance (%)",
cbar_pos: Tuple[float, float, float, float] = (1.02, 0.3, 0.03, 0.4),
background_color: Optional[str] = "white",
cbar_pos: tuple[float, float, float, float] = (1.02, 0.3, 0.03, 0.4),
background_color: str | None = "white",
) -> KpClustermap:
"""Generate a highly customizable, publication-grade hierarchical clustermap.

Expand Down
Loading
Loading