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

improve docstrings #20

Merged
merged 1 commit into from
Mar 12, 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
Empty file modified src/blosum/__init__.py
100755 → 100644
Empty file.
50 changes: 30 additions & 20 deletions src/blosum/_blosum.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,27 @@ def __init__(self, n: Union[int, str], default: float = float("-inf")):
Object to easily access a blosum matrix.
This reader supports asymetric data.

Input
-----
Either n ϵ {45,50,62,80,90} or path

n: int, which BLOSUM Matrix to use.
Choice between: 45,50,62,80 and 90
Data gathered from https://www.ncbi.nlm.nih.gov/IEB/ToolBox/C_DOC/lxr/source/data/

path: string, path to a Blosum matrix.
File in a format like:
https://www.ncbi.nlm.nih.gov/IEB/ToolBox/C_DOC/lxr/source/data/BLOSUM62

default: float, default -inf
Parameters
----------
n: int or str
* If an integer (45, 50, 62, 80, or 90), selects the corresponding
standard BLOSUM matrix.
* If a string, provides a filepath to a custom BLOSUM matrix file.
default: float
The default value for missing entries in the matrix.
Defaults to -inf.

Attributes
----------
n: int or str
The BLOSUM matrix identifier (version number or filepath).
default: float
The default value for missing entries.

Examples
--------
>>> blosum62 = BLOSUM(62)
>>> score = blosum62['W']['Y'] # Get the score for substituting W with Y
"""

self.n = n
Expand Down Expand Up @@ -85,17 +93,19 @@ def loadMatrix(
) -> DefaultDict[str, DefaultDict[str, float]]:
"""
Reads a Blosum matrix from file.
File in a format like:
https://www.ncbi.nlm.nih.gov/IEB/ToolBox/C_DOC/lxr/source/data/BLOSUM62
File in a format like: https://www.ncbi.nlm.nih.gov/IEB/ToolBox/C_DOC/lxr/source/data/BLOSUM62

Input
-----
path: str, path to a file.
default: float, default value "-inf"
Parameters
----------
path: str
Path to the file.
default: float
Default value "-inf".

Returns
-------
blosumDict: Dictionary, The blosum dict
blosumDict: dict
The blosum dict.
"""

with open(path, "r") as f:
Expand Down
Empty file modified src/blosum/_data.py
100755 → 100644
Empty file.
Loading