plinder.core.structure.atoms#
- plinder.core.structure.atoms.atom_array_from_cif_file(structure: Path | AtomArray | AtomArrayStack, use_author_fields: bool = True) AtomArray | None[source]#
- plinder.core.structure.atoms.write_cif(arr: AtomArray, filepath: Path) None[source]#
Write an AtomArray to an mmCIF file whose data block is the file stem.
- plinder.core.structure.atoms.apply_mask(atoms: AtomArray | AtomArrayStack, mask: NDArray[bool]) AtomArray | AtomArrayStack[source]#
Filter the atoms of an AtomArray or AtomArrayStack with a boolean mask.
- plinder.core.structure.atoms.resn2seq(resn: Iterable[str]) str[source]#
Convert residue names to one-letter code, with
Xfor unknown names.Selenocysteine and pyrrolysine become cysteine and lysine because biotite’s protein alphabet has no
UorO.
- plinder.core.structure.atoms.align_sequences(ref_seq: str, subject_seq: str, ref_numbering: Sequence[int] | None = None, subject_numbering: Sequence[int] | None = None) tuple[str, str, list[int], list[int]][source]#
Globally align two sequences and return their matched residues.
The alignment uses BLOSUM62 with affine gap penalties and no terminal penalty. Only positions where both sequences carry a known residue are kept, and returned as the two mapped sequences plus their residue numbering (1-based unless numbering is given).
- plinder.core.structure.atoms.get_residue_index_mapping_mask(ref_seqs: dict[str, str], subject_arr: AtomArray | AtomArrayStack) dict[str, NDArray[float64]][source]#
Mark which reference-sequence positions are resolved in each chain.
- plinder.core.structure.atoms.get_per_residue_mask(residue_reference_atom_list: Sequence[str], atom_list: Sequence[str]) list[int][source]#