Skip to content

Commit

Permalink
Merge pull request #20 from not-a-feature/dev
Browse files Browse the repository at this point in the history
improve docstrings
  • Loading branch information
not-a-feature authored Mar 12, 2024
2 parents b0e7a4f + ea094d5 commit d630ed7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 20 deletions.
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.

0 comments on commit d630ed7

Please sign in to comment.