Skip to content

Commit

Permalink
Misc spellings flagged by codespell (#4716)
Browse files Browse the repository at this point in the history
Note the childs to children changes in Bio/Phylo/Consensus.py
included fixing internal variable names only.

Not applying all the catergories ==> categories fixes
to the (deprecated) EMBOSS wrappers as some would be
functional changes.

Also no more LaTeX files (for spell checking)
  • Loading branch information
peterjc committed May 1, 2024
1 parent f6c6c6a commit a47460e
Show file tree
Hide file tree
Showing 44 changed files with 86 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ repos:
rev: v2.2.6
hooks:
- id: codespell
files: \.(rst|md|tex)$
files: \.(rst|md)$
args: [
--ignore-regex,
'(^|\W)([A-Z]{2,3})(\W|$)',
Expand Down
2 changes: 1 addition & 1 deletion Bio/Align/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4290,7 +4290,7 @@ def parse(source, fmt):
- source - File or file-like object to read from, or filename as string.
- fmt - String describing the file format (case-insensitive).
Typical usage, opening a file to read in, and looping over the aligments:
Typical usage, opening a file to read in, and looping over the alignments:
>>> from Bio import Align
>>> filename = "Exonerate/exn_22_m_ner_cigar.exn"
Expand Down
2 changes: 1 addition & 1 deletion Bio/Align/exonerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def _parse_vulgar(words):
% (query_step, target_step)
)
elif operation == "N": # Non-equivalenced (unaligned) region
operation = "U" # 'N' is alread used for introns in SAM/BAM
operation = "U" # 'N' is already used for introns in SAM/BAM
if target_step > 0:
ts += target_step
coordinates[0, i + 1] = ts
Expand Down
2 changes: 1 addition & 1 deletion Bio/Alphabet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# package.
"""Alphabets were previously used to declare sequence type and letters (OBSOLETE).
The design of Bio.Aphabet included a number of historic design choices
The design of Bio.Alphabet included a number of historic design choices
which, with the benefit of hindsight, were regretable. Bio.Alphabet was
therefore removed from Biopython in release 1.78. Instead, the molecule type is
included as an annotation on SeqRecords where appropriate.
Expand Down
2 changes: 1 addition & 1 deletion Bio/Data/PDBData.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
"8MG": "G", "8OG": "G", "8PY": "G", "8AA": "G", "85Y": "U", "8OS": "G",
}

# Solvent accesibility scales
# Solvent accessibility scales
residue_sasa_scales = {
# Ahmad: Ahmad et al. 2003 https://doi.org/10.1002/prot.10328
"Ahmad": {
Expand Down
12 changes: 4 additions & 8 deletions Bio/Emboss/Applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,7 @@ def __init__(self, cmd="fdnadist", **kwargs):
),
_Option(["-method", "method"], "sub. model [f,k,j,l,s]", is_required=True),
_Option(["-gamma", "gamma"], "gamma [g, i,n]"),
_Option(
["-ncategories", "ncategories"], "number of rate catergories (1-9)"
),
_Option(["-ncategories", "ncategories"], "number of rate categories (1-9)"),
_Option(["-rate", "rate"], "rate for each category"),
_Option(
["-categories", "categories"], "File of substitution rate categories"
Expand All @@ -371,7 +369,7 @@ def __init__(self, cmd="fdnadist", **kwargs):
),
_Option(["-invarfrac", "invarfrac"], "proportoin of invariant sites"),
_Option(["-ttratio", "ttratio"], "ts/tv ratio"),
_Option(["-freqsfrom", "freqsfrom"], "use emprical base freqs"),
_Option(["-freqsfrom", "freqsfrom"], "use empirical base freqs"),
_Option(["-basefreq", "basefreq"], "specify basefreqs"),
_Option(["-lower", "lower"], "lower triangle matrix (y/N)"),
]
Expand Down Expand Up @@ -579,9 +577,7 @@ def __init__(self, cmd="fprotdist", **kwargs):
filename=True,
is_required=True,
),
_Option(
["-ncategories", "ncategories"], "number of rate catergories (1-9)"
),
_Option(["-ncategories", "ncategories"], "number of rate categories (1-9)"),
_Option(["-rate", "rate"], "rate for each category"),
_Option(["-catergories", "catergories"], "file of rates"),
_Option(["-weights", "weights"], "weights file"),
Expand All @@ -596,7 +592,7 @@ def __init__(self, cmd="fprotdist", **kwargs):
),
_Option(["-aacateg", "aacateg"], "Choose the category to use [G,C,H]"),
_Option(["-whichcode", "whichcode"], "genetic code [c,m,v,f,y]"),
_Option(["-ease", "ease"], "Pob change catergory (float between -0 and 1)"),
_Option(["-ease", "ease"], "Pob change category (float between -0 and 1)"),
_Option(["-ttratio", "ttratio"], "Transition/transversion ratio (0-1)"),
_Option(
["-basefreq", "basefreq"], "DNA base frequencies (space separated list)"
Expand Down
2 changes: 1 addition & 1 deletion Bio/File.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def __init__(
self._build_index()

def _load_index(self):
"""Call from __init__ to re-use an existing index (PRIVATE)."""
"""Call from __init__ to reuse an existing index (PRIVATE)."""
index_filename = self._index_filename
relative_path = self._relative_path
filenames = self._filenames
Expand Down
8 changes: 4 additions & 4 deletions Bio/HMM/MarkovModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,12 @@ def get_blank_transitions(self):
return self._transition_pseudo

def get_blank_emissions(self):
"""Get the starting default emmissions for each sequence.
"""Get the starting default emissions for each sequence.
This returns a dictionary of the default emmissions for each
This returns a dictionary of the default emissions for each
letter. The dictionary is structured with keys as
(seq_letter, emmission_letter) and values as the starting number
of emmissions.
(seq_letter, emission_letter) and values as the starting number
of emissions.
"""
return self._emission_pseudo

Expand Down
4 changes: 2 additions & 2 deletions Bio/HMM/Trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ def log_likelihood(self, probabilities):
return total_likelihood

def estimate_params(self, transition_counts, emission_counts):
"""Get a maximum likelihood estimation of transition and emmission.
"""Get a maximum likelihood estimation of transition and emission.
Arguments:
- transition_counts -- A dictionary with the total number of counts
of transitions between two states.
- emissions_counts -- A dictionary with the total number of counts
of emmissions of a particular emission letter by a state letter.
of emissions of a particular emission letter by a state letter.
This then returns the maximum likelihood estimators for the
transitions and emissions, estimated by formulas 3.18 in
Expand Down
2 changes: 1 addition & 1 deletion Bio/LogisticRegression.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- classify Classify an observation into a class.
This module has been deprecated, please consider an alternative like scikit-learn
insead.
instead.
"""

import warnings
Expand Down
2 changes: 1 addition & 1 deletion Bio/NaiveBayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@


def _contents(items):
"""Return a dictionary where the key is the item and the value is the probablity associated (PRIVATE)."""
"""Return a dictionary where the key is the item and the value is the probability associated (PRIVATE)."""
term = 1.0 / len(items)
counts = {}
for item in items:
Expand Down
2 changes: 1 addition & 1 deletion Bio/PDB/DSSP.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def dssp_dict_from_pdb_file(in_file, DSSP="dssp", dssp_version="3.9.9"):
DSSP executable (argument to subprocess)
dssp_version : string
Version of DSSP excutable
Version of DSSP executable
Returns
-------
Expand Down
16 changes: 8 additions & 8 deletions Bio/PDB/PICIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ def process_hedron(
"""Create Hedron on current (sbcic) Chain.internal_coord."""
ek = (akcache(a1), akcache(a2), akcache(a3))
atmNdx = AtomKey.fields.atm
accpt = IC_Residue.accept_atoms
if not all(ek[i].akl[atmNdx] in accpt for i in range(3)):
accept = IC_Residue.accept_atoms
if not all(ek[i].akl[atmNdx] in accept for i in range(3)):
return
hl12[ek] = float(l12)
ha[ek] = float(ang)
Expand Down Expand Up @@ -295,8 +295,8 @@ def process_dihedron(
akcache(a4),
)
atmNdx = AtomKey.fields.atm
accpt = IC_Residue.accept_atoms
if not all(ek[i].akl[atmNdx] in accpt for i in range(4)):
accept = IC_Residue.accept_atoms
if not all(ek[i].akl[atmNdx] in accept for i in range(4)):
return
dangle = float(dangle)
dangle = dangle if (dangle <= 180.0) else dangle - 360.0
Expand Down Expand Up @@ -454,7 +454,7 @@ def dihedra_check(ric: IC_Residue) -> None:

# rnext should be set
def ake_recurse(akList: List) -> List:
"""Bulid combinatorics of AtomKey lists."""
"""Build combinatorics of AtomKey lists."""
car = akList[0]
if len(akList) > 1:
retList = []
Expand Down Expand Up @@ -1104,9 +1104,9 @@ def write_PIC(
hdr.upper(), (dd or ""), (pdbid or "")
)
)
nam = entity.header.get("name", None)
if nam:
fp.write("TITLE " + nam.upper() + "\n")
name = entity.header.get("name", None)
if name:
fp.write("TITLE " + name.upper() + "\n")
for mdl in entity:
write_PIC(
mdl,
Expand Down
10 changes: 5 additions & 5 deletions Bio/PDB/ic_rebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def report_IC(
hdr = entity.header.get("head", None)
if hdr:
reportDict["hdr"] += 1
nam = entity.header.get("name", None)
if nam:
name = entity.header.get("name", None)
if name:
reportDict["hdr"] += 1
for mdl in entity:
reportDict = report_IC(mdl, reportDict)
Expand Down Expand Up @@ -492,9 +492,9 @@ def write_PDB(
hdr.upper(), (dd or ""), (pdbid or "")
)
)
nam = entity.header.get("name", None)
if nam:
fp.write("TITLE " + nam.upper() + "\n")
name = entity.header.get("name", None)
if name:
fp.write("TITLE " + name.upper() + "\n")
io = PDBIO()
io.set_structure(entity)
io.save(fp, preserve_atom_numbering=True)
Expand Down
16 changes: 8 additions & 8 deletions Bio/PDB/internal_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ def init_atom_coords(self) -> None:
"""

if np.any(self.hAtoms_needs_update):
# hedra inital coords
# hedra initial coords

# sar = supplementary angle radian: angles which add to 180
sar = np.deg2rad(180.0 - self.hedraAngle[self.hAtoms_needs_update]) # angle
Expand Down Expand Up @@ -2058,7 +2058,7 @@ def dihedral_signs(self) -> np.ndarray:
def distplot_to_dh_arrays(
self, distplot: np.ndarray, dihedra_signs: np.ndarray
) -> None:
"""Load di/hedra distance arays from distplot.
"""Load di/hedra distance arrays from distplot.
Fill :class:`IC_Chain` arrays hedraL12, L23, L13 and dihedraL14
distance value arrays from input distplot, dihedra_signs array from
Expand All @@ -2069,7 +2069,7 @@ def distplot_to_dh_arrays(
Call :meth:`atom_to_internal_coordinates` (or at least :meth:`init_edra`)
to generate a2ha_map and d2a_map before running this.
Explcitly removed from :meth:`.distance_to_internal_coordinates` so
Explicitly removed from :meth:`.distance_to_internal_coordinates` so
user may populate these chain di/hedra arrays by other
methods.
"""
Expand Down Expand Up @@ -2116,7 +2116,7 @@ def distance_to_internal_coordinates(
:param bool resetAtoms: default True.
Mark all atoms in di/hedra and atomArray for updating by
:meth:`.internal_to_atom_coordinates`. Alternatvely set this to
:meth:`.internal_to_atom_coordinates`. Alternatively set this to
False and manipulate `atomArrayValid`, `dAtoms_needs_update` and
`hAtoms_needs_update` directly to reduce computation.
""" # noqa
Expand Down Expand Up @@ -3727,12 +3727,12 @@ def set_angle(self, angle_key: Union[EKT, str], v: float, overlap=True):
protein chain definitions in :mod:`.ic_data` and :meth:`_create_edra`
(e.g. psi overlaps N-CA-C-O).
Te default overlap=True is probably what you want for:
The default overlap=True is probably what you want for:
`set_angle("chi1", val)`
The default is probably NOT what you want when processing all dihedrals
in a chain or residue (such as copying from another structure), as the
overlaping dihedra will likely be in the set as well.
overlapping dihedra will likely be in the set as well.
N.B. setting e.g. PRO chi2 is permitted without error or warning!
Expand Down Expand Up @@ -3775,7 +3775,7 @@ def bond_rotate(self, angle_key: Union[EKT, str], delta: float):
Changes a dihedral angle by a given delta, i.e.
new_angle = current_angle + delta
Values are adjusted so new_angle iwll be within +/-180.
Values are adjusted so new_angle will be within +/-180.
Changes overlapping dihedra as in :meth:`.set_angle`
Expand Down Expand Up @@ -3911,7 +3911,7 @@ class Edron:
re_class: str
sequence of residue, atoms comprising di/hedron for statistics
cre_class: str
sequence of covalent radii classses comprising di/hedron for statistics
sequence of covalent radii classes comprising di/hedron for statistics
edron_re: compiled regex (Class Attribute)
A compiled regular expression matching string IDs for Hedron
and Dihedron objects
Expand Down
2 changes: 1 addition & 1 deletion Bio/Phylo/Applications/_Raxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def __init__(self, cmd="raxmlHPC", **kwargs):
e: Optimize model+branch lengths for given input tree under
GAMMA/GAMMAI only.
g: Compute per site log Likelihoods for one ore more trees
g: Compute per site log Likelihoods for one or more trees
passed via '-z' and write them to a file that can be read
by CONSEL.
Expand Down
21 changes: 10 additions & 11 deletions Bio/Phylo/Consensus.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,8 @@ def strict_consensus(trees):
if bs.contains(bitstr):
# remove old bitstring
del bitstr_clades[bs]
# update clade childs
new_childs = [child for child in c.clades if child not in clade_terms]
c.clades = new_childs
# update clade children
c.clades = [child for child in c.clades if child not in clade_terms]
# set current clade as child of c
c.clades.append(clade)
# update bitstring
Expand Down Expand Up @@ -324,7 +323,7 @@ def majority_consensus(trees, cutoff=0):
# record its possible parent and child clades.
compatible = True
parent_bitstr = None
child_bitstrs = [] # multiple independent childs
child_bitstrs = [] # multiple independent children
for bs in bsckeys:
if not bs.iscompatible(bitstr):
compatible = False
Expand All @@ -347,7 +346,7 @@ def majority_consensus(trees, cutoff=0):
if parent_bitstr:
# insert current clade; remove old bitstring
parent_clade = bitstr_clades.pop(parent_bitstr)
# update parent clade childs
# update parent clade children
parent_clade.clades = [
c for c in parent_clade.clades if c not in clade_terms
]
Expand Down Expand Up @@ -457,15 +456,15 @@ def _sub_clade(clade, term_names):
for c in sub_clade.find_clades(terminal=False, order="preorder"):
if c == sub_clade.root:
continue
childs = set(c.find_clades(terminal=True)) & set(term_clades)
if childs:
children = set(c.find_clades(terminal=True)) & set(term_clades)
if children:
for tc in temp_clade.find_clades(terminal=False, order="preorder"):
tc_childs = set(tc.clades)
tc_new_clades = tc_childs - childs
if childs.issubset(tc_childs) and tc_new_clades:
tc_children = set(tc.clades)
tc_new_clades = tc_children - children
if children.issubset(tc_children) and tc_new_clades:
tc.clades = list(tc_new_clades)
child_clade = BaseTree.Clade()
child_clade.clades.extend(list(childs))
child_clade.clades.extend(list(children))
tc.clades.append(child_clade)
sub_clade = temp_clade
return sub_clade
Expand Down
2 changes: 1 addition & 1 deletion Bio/PopGen/GenePop/Controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def test_pop_hz_deficiency(
):
"""Use Hardy-Weinberg test for heterozygote deficiency.
Returns a population iterator containing a dictionary wehre
Returns a population iterator containing a dictionary where
dictionary[locus]=(P-val, SE, Fis-WC, Fis-RH, steps).
Some loci have a None if the info is not available.
Expand Down
4 changes: 2 additions & 2 deletions Bio/Restriction/Restriction.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ def _search(cls):

@classmethod
def is_palindromic(cls):
"""Return if the enzyme has a palindromic recoginition site."""
"""Return if the enzyme has a palindromic recognition site."""
return True


Expand Down Expand Up @@ -991,7 +991,7 @@ def _search(cls):

@classmethod
def is_palindromic(cls):
"""Return if the enzyme has a palindromic recoginition site."""
"""Return if the enzyme has a palindromic recognition site."""
return False


Expand Down
2 changes: 1 addition & 1 deletion Bio/SeqFeature.py
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ def extract(self, parent_sequence, references=None):
return f_seq


FeatureLocation = SimpleLocation # OBSOLETE; for backward compatability only.
FeatureLocation = SimpleLocation # OBSOLETE; for backward compatibility only.


class CompoundLocation(Location):
Expand Down
2 changes: 1 addition & 1 deletion Bio/SeqIO/PhdIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def PhdIterator(source: _TextIOSource) -> Iterator[SeqRecord]:
seq_record = SeqRecord(
phd_record.seq, id=name, name=name, description=phd_record.file_name
)
# Just re-use the comments dictionary as the SeqRecord's annotations
# Just reuse the comments dictionary as the SeqRecord's annotations
seq_record.annotations = phd_record.comments
seq_record.annotations["molecule_type"] = "DNA"
# And store the qualities and peak locations as per-letter-annotation
Expand Down

0 comments on commit a47460e

Please sign in to comment.