diff --git a/package/MDAnalysis/coordinates/MMCIF.py b/package/MDAnalysis/coordinates/MMCIF.py index ee8df98d781..0107a52c210 100644 --- a/package/MDAnalysis/coordinates/MMCIF.py +++ b/package/MDAnalysis/coordinates/MMCIF.py @@ -15,7 +15,7 @@ logger = logging.getLogger("MDAnalysis.coordinates.MMCIF") -def get_coordinates(model: 'gemmi.Model') -> np.ndarray: +def get_coordinates(model: "gemmi.Model") -> np.ndarray: """Get coordinates of all atoms in the `gemmi.Model` object. Parameters diff --git a/package/MDAnalysis/topology/MMCIFParser.py b/package/MDAnalysis/topology/MMCIFParser.py index 2a0adb71704..6367cb88f9f 100644 --- a/package/MDAnalysis/topology/MMCIFParser.py +++ b/package/MDAnalysis/topology/MMCIFParser.py @@ -61,10 +61,14 @@ def _into_idx(arr: list) -> list[int]: .. versionadded:: 2.8.0 """ - return [idx for idx, (_, group) in enumerate(itertools.groupby(arr)) for _ in group] + return [ + idx + for idx, (_, group) in enumerate(itertools.groupby(arr)) + for _ in group + ] -def get_Atomattrs(model: 'gemmi.Model') -> tuple[list[AtomAttr], np.ndarray]: +def get_Atomattrs(model: "gemmi.Model") -> tuple[list[AtomAttr], np.ndarray]: """Extract all attributes that are subclasses of :class:`..core.topologyattrs.AtomAttr` from a ``gemmi.Model`` object, and a `residx` index with indices of all atoms in residues. @@ -165,7 +169,9 @@ def get_Atomattrs(model: 'gemmi.Model') -> tuple[list[AtomAttr], np.ndarray]: return attrs, residx -def get_Residueattrs(model: 'gemmi.Model') -> tuple[list[ResidueAttr], np.ndarray]: +def get_Residueattrs( + model: "gemmi.Model", +) -> tuple[list[ResidueAttr], np.ndarray]: """Extract all attributes that are subclasses of :class:`..core.topologyattrs.ResidueAttr` from a ``gemmi.Model`` object, and a `segidx` index witn indices of all residues in segments. @@ -214,7 +220,7 @@ def get_Residueattrs(model: 'gemmi.Model') -> tuple[list[ResidueAttr], np.ndarra return attrs, segidx -def get_Segmentattrs(model: 'gemmi.Model') -> SegmentAttr: +def get_Segmentattrs(model: "gemmi.Model") -> SegmentAttr: """Extract all attributes that are subclasses of :class:`..core.topologyattrs.SegmentAttr` from a ``gemmi.Model`` object. Parameters diff --git a/testsuite/MDAnalysisTests/topology/test_mmcif.py b/testsuite/MDAnalysisTests/topology/test_mmcif.py index b4ff08a8a55..0498fc2feed 100644 --- a/testsuite/MDAnalysisTests/topology/test_mmcif.py +++ b/testsuite/MDAnalysisTests/topology/test_mmcif.py @@ -35,7 +35,10 @@ def test_chains(mmcif_filename, n_chains): @pytest.mark.parametrize( "mmcif_filename,sequence", [ - (f"{MMCIF_FOLDER}/1YJP.cif", ["GLY", "ASN", "ASN", "GLN", "GLN", "ASN", "TYR"]), + ( + f"{MMCIF_FOLDER}/1YJP.cif", + ["GLY", "ASN", "ASN", "GLN", "GLN", "ASN", "TYR"], + ), ( f"{MMCIF_FOLDER}/1YJP.cif.gz", ["GLY", "ASN", "ASN", "GLN", "GLN", "ASN", "TYR"], @@ -47,6 +50,7 @@ def test_chains(mmcif_filename, n_chains): def test_sequence(mmcif_filename, sequence): u = mda.Universe(mmcif_filename) in_structure = [ - str(res.resname) for res in u.select_atoms("protein and chainid A").residues + str(res.resname) + for res in u.select_atoms("protein and chainid A").residues ] assert in_structure == sequence, ":".join(in_structure)