Skip to content

Commit cab11ed

Browse files
committed
style: update of docstrings
1 parent 27475ca commit cab11ed

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

asmc/utils.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ def __init__(self, pos: int, limit: int) -> None:
3535
super().__init__(self.message)
3636

3737
class AminoAcidTypeError(Exception):
38-
"""Execption raised for Amino Acid does not correspond to a 1-letter code or
39-
a valid amino acid type
38+
"""Exception raised for Amino Acid which does not correspond to a 1-letter
39+
code or a valid amino acid type
4040
4141
valid amino acid type : 'aromatic', 'acidic', 'basic', 'polar', 'hydrophobic'
4242
4343
Attribute:
44-
aa (str): the amino acid string wich caused the error
44+
aa (str): the amino acid string which caused the error
4545
"""
4646

4747
def __init__(self, aa: str) -> None:
@@ -87,14 +87,14 @@ def get_seq_from_pdb(pdb: Path) -> str:
8787
def read_models(models: Path) -> Dict[str, str]:
8888
"""Reads the model file
8989
90-
For each model, add its id as key in a dictionnary and add as value the
90+
For each model, add its id as key in a dictionary and add as value the
9191
sequence return by get_seq_from_pdb().
9292
9393
Args:
9494
models (pathlib.Path): The file containing the model paths
9595
9696
Returns:
97-
all_seq (dict): A dictionnary with each pair of id - seq
97+
all_seq (dict): A dictionary with each pair of id - seq
9898
"""
9999

100100
all_seq = {}
@@ -110,13 +110,13 @@ def read_models(models: Path) -> Dict[str, str]:
110110
def read_multi_fasta(fasta: Path) -> Dict[str, str]:
111111
"""Reads a multi fasta file
112112
113-
Add in a dictionnary all pair id - sequence.
113+
Add in a dictionary all pair id - sequence.
114114
115115
Args:
116116
fasta (pathlib.Path): The multi fasta file
117117
118118
Returns:
119-
all_seq (dict): A dictionnary with each pair of id - seq
119+
all_seq (dict): A dictionary with each pair of id - seq
120120
"""
121121

122122
all_seq = {}
@@ -141,11 +141,11 @@ def read_multi_fasta(fasta: Path) -> Dict[str, str]:
141141
def get_identity(ref_seq: Dict[str, str], target: str) -> Tuple[str, float]:
142142
"""Get the % identity between two sequences
143143
144-
For each pair reference - target, build a global alignment and calculates
144+
For each pair reference - target, build a global alignment and calculate
145145
the percentage of identity.
146146
147147
Args:
148-
ref_seq (dict): Dictionnary with ids of reference as key and their
148+
ref_seq (dict): Dictionary with ids of reference as key and their
149149
sequences as value
150150
target (str): The target sequence
151151
@@ -184,13 +184,13 @@ def get_identity(ref_seq: Dict[str, str], target: str) -> Tuple[str, float]:
184184
def build_comparison_data(id_dict: Optional[Dict[str, Union[str, int, None]]],
185185
file: Path,
186186
empty=True) -> Dict[str, Union[str, int, None]]:
187-
"""Read the ASMC groups.tsv and load information in a dictionnary
187+
"""Read the ASMC groups.tsv and load information in a dictionary
188188
189189
Args:
190-
id_dict (dict): An empty dictionnary or contaning sub dict as value of
190+
id_dict (dict): An empty dictionary or containing sub dict as value of
191191
seqID (key)
192192
file (pathlib.Path): The ASMC groups.tsv
193-
empty (bool, optional): Defaults to True.
193+
empty (bool, optional): Default to True.
194194
195195
Returns:
196196
id_dict (dict): The updated id_dict
@@ -232,15 +232,15 @@ def build_comparison_data(id_dict: Optional[Dict[str, Union[str, int, None]]],
232232

233233
def add_ref_data_to_comparison_data(id_dict:Dict[str, Union[str, int, None]],
234234
file:Path) -> Tuple[Dict[str, Union[str, int, None]], Set[str]]:
235-
"""Reads the identity_target_ref.tsv file and add information to a
235+
"""Reads the identity_targets_refs.tsv file and add information to a
236236
comparison data
237237
238238
Args:
239239
id_dict (dict): Dict with sub dict as value and seqID as key
240-
file (pathlib.Path): The identity_target_ref.tsv
240+
file (pathlib.Path): The identity_targets_refs.tsv
241241
242242
Returns:
243-
id_dict (dict): The updated id_dict,
243+
id_dict (dict): The updated id_dict
244244
ref_set (set): Set containing the reference IDs
245245
"""
246246

@@ -261,7 +261,7 @@ def add_ref_data_to_comparison_data(id_dict:Dict[str, Union[str, int, None]],
261261
return id_dict, ref_set
262262

263263
def LD_two_rows(s1: str, s2: str) -> int:
264-
"""Calcultes Levenshtein distance between two strings
264+
"""Calculates Levenshtein distance between two strings
265265
266266
Simple implementation of Levenshtein distance based on the two rows
267267
algorithm.
@@ -274,7 +274,7 @@ def LD_two_rows(s1: str, s2: str) -> int:
274274
int: The Levenshtein/edit distance
275275
"""
276276

277-
# Switch s1 and s2 for reduce the columns number
277+
# Switch s1 and s2 to reduce the columns number
278278
if len(s1) > len(s2):
279279
s1, s2 = s2, s1
280280

@@ -363,7 +363,7 @@ def build_active_site_checking_file(id_dict: Dict[str, Union[str, int, None]],
363363
g2 = id_dict[key]["g2"]
364364
ref_pid = id_dict[key]["ref_pid"]
365365

366-
# Add dictionnary items
366+
# Add dictionary items
367367
text += f"{key}\t{g1}\t{seq1}\t{g2}\t{seq2}\t{d}\t{ref}\t{ref_pid}\t"
368368
text += f"{seq_ref}\t{d1}\t{d2}\t"
369369

@@ -456,7 +456,7 @@ def extract_aa(file: Path, pos: int, aa: str, group: Optional[int]):
456456

457457
def get_unique(group_file: Path) -> Tuple[Dict[str, Tuple[str, Set[str]]],
458458
Dict[str, Tuple[int, int, float]]]:
459-
"""Calculates statistics on the number of unique sequences per groups
459+
"""Calculates statistics on the number of unique sequences per group
460460
461461
Args:
462462
group_file (Path): ASMC tsv output
@@ -465,8 +465,8 @@ def get_unique(group_file: Path) -> Tuple[Dict[str, Tuple[str, Set[str]]],
465465
FileFormatError: Raised if the tsv contains less than 3 columns
466466
467467
Returns:
468-
unique_seq (dict): Dict with seq as key and as value tuple containing
469-
the group id and a set of sequence ids
468+
unique_seq (dict): Dict with seq as key and a tuple containing
469+
the group id and a set of sequence ids as values
470470
471471
groups_stats (dict): Dict with group id as key and a tuple of int and
472472
float as value

0 commit comments

Comments
 (0)