pyrosetta_help.common_ops package

Submodules

pyrosetta_help.common_ops.constraints module

pyrosetta_help.common_ops.constraints.constraints2pandas(pose)[source]
pyrosetta_help.common_ops.constraints.get_AtomID(pose: Pose, chain: str, resi: int, atomname: str) AtomID[source]
pyrosetta_help.common_ops.constraints.get_AtomID_by_NGL_sele(pose: Pose, selection: str) AtomID[source]

23:A.CA

pyrosetta_help.common_ops.constraints.get_AtomID_from_pymol_line(pose: Pose, line: None | str = None) AtomID[source]

Given a copypaste from the console in pymol following an atom selection in edit mode: (You clicked /1amq/B/A/PMP`413/N1 -> (pk2)) returns that atom in PyRosetta.

If the line argument is blank the clipboard is read.

Parameters:
  • pose

  • line

Returns:

pyrosetta_help.common_ops.constraints.get_NGL_selection_from_AtomID(pose: Pose, atom_id: AtomID, named: bool = False)[source]

Given a pyrosetta AtomID give an NGL selection. NB named gives the residue name ('[SER]3:A.CA') but is not a valid selection.

Parameters:
  • pose

  • atom_id

  • named

Returns:

pyrosetta_help.common_ops.constraints.make_constraint_from_pymol_line(pose: Pose, lines: str) AtomPairConstraint[source]

two atoms clicked… You clicked /1amq/A/A/ASP`222/OD2 -> (pk1) You clicked /1amq/B/A/PMP`413/N1 -> (pk2) distance measured in PyRosetta hence the pose.

Parameters:
  • lines

  • pose

Returns:

pyrosetta_help.common_ops.constraints.print_bad_constraint_scores(pose, cutoff=0.5)[source]
pyrosetta_help.common_ops.constraints.print_constraint_score(pose: Pose, con)[source]

Print the constraint details. atoms and score

Parameters:
  • pose

  • con

Returns:

pyrosetta_help.common_ops.constraints.print_constraint_scores(pose: Pose)[source]

Prints the scores for each constraint in the pose

Parameters:

pose

Returns:

pyrosetta_help.common_ops.distances module

pyrosetta_help.common_ops.distances.measure_distance_matrix(pose) ndarray[source]

Note the distance matrix is zero indexed as it would be confusing using numpy with one indexed data.

Parameters:

pose

Returns:

pyrosetta_help.common_ops.distances.measure_inter_residue_distance(pose: Pose, query_residue_idx: int, target_residue_idx: int) float[source]

Get the distances between two residues —closest atom, not centroid. Virtual residues may cause problems.

pyrosetta_help.common_ops.distances.measure_ligand_distances(pose: Pose, target_residue_idx: int) List[dict][source]

Get the distances to the ligand from the target residue —closest atom, not centroid. Returns a list of dictionaries, one for each ligand, like: {'ligand_name': ' CA', 'ligand_idx': 430, 'distance': 23.06283024797271} example:

pyrosetta_help.common_ops.downloads module

pyrosetta_help.common_ops.downloads.download_cif(code: str)[source]

Download CIF. Pyrosetta has issues importing Cifs (hetatms). This is just a note to self as PyMOL fetch can do it.

pyrosetta_help.common_ops.downloads.download_map(code: str)[source]

This is two functions. EMD database for cryoEM files

Parameters:

code

Returns:

pyrosetta_help.common_ops.downloads.download_opm(code: str)[source]

Download OPM PDB

pyrosetta_help.common_ops.downloads.download_pdb(pdbcode: str) str[source]

pyrosetta_help.common_ops.faux_selectors module

class pyrosetta_help.common_ops.faux_selectors.AlteredSelector(threader: ThreadingMover)[source]

Bases: object

Select residues that were altered in the threading. NB> This is not actually a residue selector. The logical selectors will not accept it.

__init__(threader: ThreadingMover)[source]
apply(pose: Pose) vector1_bool[source]
pyrosetta_help.common_ops.faux_selectors.OrListSelector(*selectors) OrResidueSelector[source]

OrResidueSelector but 2+ (not a class, but returns a Or :param selectors: :return:

class pyrosetta_help.common_ops.faux_selectors.RingSelector(radius=12)[source]

Bases: object

Select all residues in the “ring” based upon 12A from origin. There is probably a saner way.

NB> This is not actually a residue selector. The logical selectors will not accept it.

__init__(radius=12)[source]
apply(pose: Pose) vector1_bool[source]
class pyrosetta_help.common_ops.faux_selectors.UnalteredSelector(threader: ThreadingMover)[source]

Bases: object

Select residues that were unaltered in the threading. NB> This is not actually a residue selector. The logical selectors will not accept it.

__init__(threader: ThreadingMover)[source]
apply(pose: Pose) vector1_bool[source]
pyrosetta_help.common_ops.faux_selectors.get_bfactor_vector(pose: Pose, cutoff: float, above: bool = True, include_ligands: bool = False) vector1_bool[source]

Return a selection vector based on b-factors. above = get all above. So to select bad b-factors above is True, but to select AF2 bad ones. above is False

pyrosetta_help.common_ops.minimize module

pyrosetta_help.common_ops.minimize.do_chainwise_relax(pose: Pose, scorefxn: ScoreFunction | None = None, cycles: int = 5) None[source]
pyrosetta_help.common_ops.minimize.do_local_relax(pose: Pose, scorefxn: ScoreFunction | None = None) None[source]
pyrosetta_help.common_ops.minimize.get_local_relax(scorefxn: ScoreFunction | None = None, ncyc: int = 3, nexp: int = 2) LocalRelax[source]
pyrosetta_help.common_ops.minimize.get_local_scorefxn() ScoreFunction[source]
pyrosetta_help.common_ops.minimize.prep_ED(pose: Pose, map_filename: str) ElectronDensity[source]

pyrosetta_help.common_ops.nglview module

pyrosetta_help.common_ops.ss_changes module

There is likely a mover that does this already and better…

pyrosetta_help.common_ops.ss_changes.make_310_helical(pose, begin: int = 1, end: int = -1)[source]

Given a pose, likely one made via pyrosetta.pose_from_sequence, make the fortran-indexed range [begin, end] (inclusive) into that SS.

In this case 3.10-helix with phi=-74.0, psi=-4.0

pyrosetta_help.common_ops.ss_changes.make_alpha_helical(pose, begin: int = 1, end: int = -1)[source]

Given a pose, likely one made via pyrosetta.pose_from_sequence, make the fortran-indexed range [begin, end] (inclusive) into that SS.

In this case alpha-helix with phi=-57.8, psi=-47.0

pyrosetta_help.common_ops.ss_changes.make_pi_helical(pose, begin: int = 1, end: int = -1)[source]

Given a pose, likely one made via pyrosetta.pose_from_sequence, make the fortran-indexed range [begin, end] (inclusive) into that SS.

In this case pi-helix with phi=-57.1, psi=-69.7

pyrosetta_help.common_ops.ss_changes.make_sheet(pose, begin: int = 1, end: int = -1)[source]

Given a pose, likely one made via pyrosetta.pose_from_sequence, make the fortran-indexed range [begin, end] (inclusive) into that SS.

In this case sheet with phi=-139, psi=+135

pyrosetta_help.common_ops.ss_changes.make_ss(pose, begin: int = 1, end: int = -1, phi: float = 180, psi: float = 180)[source]

Given a pose, likely one made via pyrosetta.pose_from_sequence, make the fortran-indexed range [begin, end] (inclusive) into that SS.

pyrosetta_help.common_ops.utils module

pyrosetta_help.common_ops.utils.add_bfactor_from_score(pose: Pose)[source]

Adds the bfactors from total_score. Snippet for testing in Jupyter

>>> import nglview as nv
>>> view = nv.show_rosetta(pose)
>>> # view = nv.show_file('test.cif')
>>> view.clear_representations()
>>> view.add_tube(radiusType="bfactor", color="bfactor", radiusScale=0.10, colorScale="RdYlBu")
>>> view

replace_res_remap_bfactors may have been a cleaner strategy. This was quicker to write.

If this fails, it may be because the pose was not scored first.

pyrosetta_help.common_ops.utils.assign_chain_letter(pose, chain_i: int, new_letter: str)[source]

Assign a new letter to chain number chain_i

pyrosetta_help.common_ops.utils.clarify_selector(selector: ResidueSelector, pose: Pose) List[str][source]

Given a selector and pose return a list of residues in NGL selection format Example, [CMP]787:H

Parameters:
  • selector

  • pose

Returns:

list of residues in NGL selection format

pyrosetta_help.common_ops.utils.correct_numbering(pose, chain_references: None | str = None, allow_insertions: bool = False)[source]

A fresh PDBInfo has the PDB residue number the same as the pose one as opposed to restarting per chain this fixes it.

Additionaly, if the list chain_references is provided, any element as None is ignored, but any element with a sequence (str) where the first char is pos 1, will be used for numbering by calling fix_offset.

Parameters:

pose

Returns:

pyrosetta_help.common_ops.utils.count_ligands(pose: Pose) List[Tuple[str, int]][source]
pyrosetta_help.common_ops.utils.fix_offset(pose, chain_i: int, ref_sequence: str, allow_insertions: bool = False) HTML[source]

Fix the pose numbering on chain_i based on ref_sequence No gaps accepted in ref_sequence if allow_insertions is False, so pad with Xs appropriately if only termini. If allow_insertions is True, insertion codes are used.

pyrosetta_help.common_ops.utils.get_last_res_in_chain(pose, chain='A') int[source]

Returns last residue index in a chain. THere is probably a mover that does this.

Parameters:
  • pose

  • chain – letter or number

Returns:

pyrosetta_help.common_ops.utils.get_pdbstr(pose)[source]
pyrosetta_help.common_ops.utils.make_blank_pose(params_filenames: vector1_std_string | List[str] | None = None) Pose[source]

Returns an empty pose, but with params from files.

Parameters:

params_filenames

Returns:

pyrosetta_help.common_ops.utils.pose2pandas(pose: Pose, scorefxn: ScoreFunction) DataFrame[source]

Return a pandas dataframe from the scores of the pose

Parameters:

pose

Returns:

pyrosetta_help.common_ops.utils.pose_from_file(pdb_filename: str, params_filenames: vector1_std_string | List[str] | None = None) Pose[source]

Return a pose like pose_from_file but with params.

Parameters:
  • pdb_filename

  • params_filenames

Returns:

pyrosetta_help.common_ops.utils.pose_range(pose: Pose, protein_only=True) Iterable[source]

range but for the pose… For now naive of chains, non-amino acid residues etc.

pyrosetta_help.common_ops.utils.what_is_chain(pose: Pose, chain: str | int)[source]

Given a pose and a chain integer or character, return the character or integer of that chain

Parameters:
  • pose

  • chain – str –> pdb_info based. int –> pyrosetta.Pose based

Returns:

Module contents