Skip to content

Commit

Permalink
docs: remove types from docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniBodor committed Jul 12, 2024
1 parent fe0bdfa commit e1f2de6
Show file tree
Hide file tree
Showing 25 changed files with 245 additions and 304 deletions.
113 changes: 52 additions & 61 deletions deeprank2/dataset.py

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions deeprank2/domain/aminoacidlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,8 @@ def convert_aa_nomenclature(aa: str, output_format: Literal[0, 1, 3] = 0) -> str
codes, and full names of amino acids.
Args:
aa (str): The amino acid to be converted in any of its formats. The
length of the string is used to determine which format is used.
output_format (Literal[0, 1, 3], optional): Nomenclature style to return:
aa: The amino acid to be converted in any of its formats. The length of the string is used to determine which format is used.
output_format: Nomenclature style to return:
0 (default) returns the full name,
1 returns the 1-letter code,
3 returns the 3-letter code.
Expand All @@ -397,7 +396,7 @@ def convert_aa_nomenclature(aa: str, output_format: Literal[0, 1, 3] = 0) -> str
ValueError: If aa is not recognized or an invalid output format was given
Returns:
str: amino acid in the selected nomenclature system.
Amino acid identifier in the selected nomenclature system.
"""
try:
if len(aa) == 1:
Expand Down
4 changes: 2 additions & 2 deletions deeprank2/features/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def _get_nonbonded_energy(
However, the potential tends to 0 at large distance.
Args:
atoms (list[Atom]): list of all atoms in the structure
distances (NDArray[np.float64]): matrix of pairwise distances between all atoms in the structure
atoms: list of all atoms in the structure
distances: matrix of pairwise distances between all atoms in the structure
in the format that is the output of scipy.spatial's distance_matrix (i.e. a diagonally symmetric matrix)
Returns:
Expand Down
8 changes: 4 additions & 4 deletions deeprank2/features/irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def _id_from_residue(residue: tuple[str, int, str]) -> str:
"""Create and id from pdb2sql rendered residues that is similar to the id of residue nodes.
Args:
residue (tuple): Input residue as rendered by pdb2sql: ( str(<chain>), int(<residue_number>), str(<three_letter_code> )
residue: Input residue as rendered by pdb2sql: ( str(<chain>), int(<residue_number>), str(<three_letter_code> )
For example: ('A', 27, 'GLU').
Returns:
Expand All @@ -44,9 +44,9 @@ def get_IRCs(pdb_path: str, chains: list[str], cutoff: float = 5.5) -> dict[str,
"""Get all close contact residues from the opposite chain.
Args:
pdb_path (str): Path to pdb file to read molecular information from.
chains (Sequence[str]): list (or list-like object) containing strings of the chains to be considered.
cutoff (float, optional): Cutoff distance (in Ångström) to be considered a close contact. Defaults to 10.
pdb_path: Path to pdb file to read molecular information from.
chains: list (or list-like object) containing strings of the chains to be considered.
cutoff: Cutoff distance (in Ångström) to be considered a close contact. Defaults to 10.
Returns:
Dict[str, _ContactDensity]:
Expand Down
2 changes: 1 addition & 1 deletion deeprank2/features/secondary_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def _get_secstructure(pdb_path: str) -> dict:
"""Process the DSSP output to extract secondary structure information.
Args:
pdb_path (str): The file path of the PDB file to be processed.
pdb_path: The file path of the PDB file to be processed.
Returns:
dict: A dictionary containing secondary structure information for each chain and residue.
Expand Down
22 changes: 11 additions & 11 deletions deeprank2/molstruct/aminoacid.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ class AminoAcid:
"""An amino acid represents the type of `Residue` in a `PDBStructure`.
Args:
name (str): Full name of the amino acid.
three_letter_code (str): Three-letter code of the amino acid (as in PDB).
one_letter_code (str): One-letter of the amino acid (as in fasta).
charge (int): Charge of the amino acid.
polarity (:class:`Polarity`): The polarity of the amino acid.
size (int): The number of non-hydrogen atoms in the side chain.
mass (float): Average residue mass (i.e. mass of amino acid - H20) in Daltons.
pI (float): Isolectric point; pH at which the molecule has no net electric charge.
hydrogen_bond_donors (int): Number of hydrogen bond donors.
hydrogen_bond_acceptors (int): Number of hydrogen bond acceptors.
index (int): The rank of the amino acid, used for computing one-hot encoding.
name: Full name of the amino acid.
three_letter_code: Three-letter code of the amino acid (as in PDB).
one_letter_code: One-letter of the amino acid (as in fasta).
charge: Charge of the amino acid.
polarity: The polarity of the amino acid.
size: The number of non-hydrogen atoms in the side chain.
mass: Average residue mass (i.e. mass of amino acid - H20) in Daltons.
pI: Isolectric point; pH at which the molecule has no net electric charge.
hydrogen_bond_donors: Number of hydrogen bond donors.
hydrogen_bond_acceptors: Number of hydrogen bond acceptors.
index: The rank of the amino acid, used for computing one-hot encoding.
"""

def __init__(
Expand Down
10 changes: 5 additions & 5 deletions deeprank2/molstruct/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class Atom:
"""One atom in a PDBStructure.
Args:
residue (:class:`Residue`): The residue that this atom belongs to.
name (str): Pdb atom name.
element (:class:`AtomicElement`): The chemical element.
position (np.array): Pdb position xyz of this atom.
occupancy (float): Pdb occupancy value.
residue: The residue that this atom belongs to.
name: Pdb atom name.
element: The chemical element.
position: Pdb position xyz of this atom.
occupancy: Pdb occupancy value.
This represents the proportion of structures where the atom is detected at a given position.
Sometimes a single atom can be detected at multiple positions. In that case separate structures exist where sum(occupancy) == 1.
Note that only the highest occupancy atom is used by deeprank2 (see tools.pdb._add_atom_to_residue).
Expand Down
4 changes: 2 additions & 2 deletions deeprank2/molstruct/pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Pair:
"""A hashable, comparable object for any set of two inputs where order doesn't matter.
Args:
item1 (Any object): The pair's first object, must be convertable to string.
item2 (Any object): The pair's second object, must be convertable to string.
item1: The pair's first object, must be convertable to string.
item2: The pair's second object, must be convertable to string.
"""

def __init__(self, item1: Any, item2: Any): # noqa: ANN401
Expand Down
13 changes: 6 additions & 7 deletions deeprank2/molstruct/residue.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ def __init__(
Each `Residue` is of a certain `AminoAcid` type and consists of multiple `Atom`s.
Args:
chain (:class:`Chain`): The chain that this residue belongs to.
number (int): the residue number
amino_acid (:class:`AminoAcid`, optional): The residue's amino acid (if it's part of a protein).
Defaults to None.
insertion_code (str, optional): The pdb insertion code, if any. Defaults to None.
chain: The chain that this residue belongs to.
number: the residue number
amino_acid: The residue's amino acid (if it's part of a protein). Defaults to None.
insertion_code: The pdb insertion code, if any. Defaults to None.
"""
self._chain = chain
self._number = number
Expand Down Expand Up @@ -122,8 +121,8 @@ class SingleResidueVariant:
"""A single residue mutation of a PDBStrcture.
Args:
residue (Residue): the `Residue` object from the PDBStructure that is mutated.
variant_amino_acid (AminoAcid): the amino acid that the `Residue` is mutated into.
residue: the `Residue` object from the PDBStructure that is mutated.
variant_amino_acid: the amino acid that the `Residue` is mutated into.
"""

def __init__(self, residue: Residue, variant_amino_acid: AminoAcid):
Expand Down
7 changes: 3 additions & 4 deletions deeprank2/molstruct/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ def __init__(self, id_: str | None = None):
One PDBStructure consists of a number of `Residue`s, each of which is of a particular `AminoAcid` type and in turn consists of a number of `Atom`s.
Args:
id_ (str, optional): An unique identifier for this structure, can be the pdb accession code.
Defaults to None.
id_: An unique identifier for this structure, can be the pdb accession code. Defaults to None.
"""
self._id = id_
self._chains = {}
Expand Down Expand Up @@ -76,8 +75,8 @@ def __init__(self, model: PDBStructure, id_: str | None):
"""One chain of a PDBStructure.
Args:
model (:class:`PDBStructure`): The model that this chain is part of.
id_ (str): The pdb identifier of this chain.
model: The model that this chain is part of.
id_: The pdb identifier of this chain.
"""
self._model = model
self._id = id_
Expand Down
7 changes: 3 additions & 4 deletions deeprank2/neuralnets/gnn/foutnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ class FoutLayer(nn.Module):
by Alex Fout et al. NIPS 2018.
Args:
in_channels (int): Size of each input sample.
out_channels (int): Size of each output sample.
bias (bool, optional): If set to :obj:`False`, the layer will not learn
an additive bias. Defaults to True.
in_channels: Size of each input sample.
out_channels: Size of each output sample.
bias: If set to :obj:`False`, the layer will not learn an additive bias. Defaults to True.
"""

def __init__(self, in_channels: int, out_channels: int, bias: bool = True):
Expand Down
6 changes: 3 additions & 3 deletions deeprank2/neuralnets/gnn/naive_gnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def __init__(self, input_shape: int, output_shape: int, input_shape_edge: int):
"""NaiveNetwork.
Args:
input_shape (int): Number of node input features.
output_shape (int): Number of output value per graph.
input_shape_edge (int): Number of edge input features.
input_shape: Number of node input features.
output_shape: Number of output value per graph.
input_shape_edge: Number of edge input features.
"""
super().__init__()
self._external1 = NaiveConvolutionalLayer(input_shape, input_shape_edge)
Expand Down
8 changes: 4 additions & 4 deletions deeprank2/neuralnets/gnn/sgat.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class SGraphAttentionLayer(nn.Module):
Ni is the number of neighbor of node i
\\Sum_j runs over the neighbors of node i
a_ij is the edge attribute between node i and j
Args:
in_channels (int): Size of each input sample.
out_channels (int): Size of each output sample.
bias (bool, optional): If set to :obj:`False`, the layer will not learn
an additive bias. Defaults to True.
in_channels: Size of each input sample.
out_channels: Size of each output sample.
bias: If set to :obj:`False`, the layer will not learn an additive bias. Defaults to True.
""" # noqa: D301

def __init__(
Expand Down
Loading

0 comments on commit e1f2de6

Please sign in to comment.