Utility Functions

Structure

build_pdb_object(log, sses, loops, concat=True, outfile=None)

Make the parametrically build atoms in a Case into a PDB file.

Parameters:
  • log (Logger) – Job logger.
  • sses (List[Dict[~KT, ~VT]]) – List of the secondary structures to build. Each SSE dictionary must contain the metadata.atoms keys, already in the final expected position.
  • loops (Union[List[int], int]) – Number of residues between SSE. It can be one less than the number of structures, which assumes no N- or C-terminal, or one more, which assumes N- and C-terminal residues.
  • concat (Optional[bool]) – When True, return the full stucture as a single object, otherwise return a list of the individual parts.
  • outfile (Union[str, Path, None]) – If provided, write the structure to file.
Return type:

Tuple[Frame3D, List[int]]

get_loop_length(log, sse1, sse2, loop_step, loop_range)

Calculate the expected number of residues to join two SSE.

Parameters:
  • log (Logger) – Job Logger.
  • sse1 (Frame3D) – N-SSE.
  • sse2 (Frame3D) – C-SSE.
  • loop_step (int) – Assumption on how much distance a residue can cover.
  • loop_range (int) – Plus-minus range of residue length.
Return type:

Tuple[int, int]

pdb_geometry_from_rules(pdb_file, rules, log=None)

Calculates the geometry statistic from a PDB.

Parameters:
  • log (Optional[Logger]) – Job Logger.
  • pdb_file (Union[Path, str, Frame3D]) – The pdb file to calculate the geometry from.
  • rules (List[Tuple]) – The rules to be applied.
Return type:

DataFrame

Plot

plot_fragment_templates(log, dfsmall, dflarge, prefix, write=True)

Plots the fragment sources across the sequence.

Parameters:
  • log (Logger) – Job Logger.
  • dfsmall (Union[FragmentFrame, DataFrame]) – Small fragment set.
  • dflarge (Union[FragmentFrame, DataFrame]) – Large fragment set.
  • prefix (Union[Path, str]) – Prefix for plot name.
  • write (bool) – Shall the plot by saved (default: True).
Return type:

Tuple[Figure, Path]

plot_loop_length_distribution(log, dfloop, pick, prefix, title, write=True)

Plots the loop length count distribution for a jump.

Parameters:
  • log (Logger) – Job Logger.
  • dfloop (DataFrame) – Loop set for a particular jump.
  • pick (int) – The selected length that was picked (for annotation on the plot).
  • prefix (Union[Path, str]) – Prefix for plot name.
  • title (str) – Plot title.
  • write (bool) – Shall the plot by saved (default: True).
Return type:

Tuple[Figure, Path]

plot_match_bin(log, master_match, prefix, expected, groupby=None, write=True)

Plots the number of matches per defined bin of the MASTER search.

Parameters:
  • log (Logger) – Job Logger.
  • master_match (DataFrame) – Collected MASTER matches.
  • prefix (Union[Path, str]) – Prefix for plot name.
  • expected (Union[int, float]) – Limitation of y-axis height.
  • groupby (Optional[List[~T]]) – Groups to order by (e.g. close, mid, far, extreme).
  • write (bool) – Shall the plot by saved (default: True).
Return type:

Tuple[Figure, Path]

plot_geometric_distributions(log, df, prefix, write=True)

Plots the per SSE geometrical distributions from the MASTER search.

Parameters:
  • log (Logger) – Job Logger.
  • df (DataFrame) – Calculated geometric statistics from the MASTER search.
  • prefix (Union[Path, str]) – Prefix for plot name.
  • write (bool) – Shall the plot by saved (default: True).
Return type:

Tuple[Figure, Path]

plot_angle_network(log, network, node_positions, sse_list, prefix, write=True)

Plots the per SSE geometrical distributions from the MASTER search.

Parameters:
  • log (Logger) – Job Logger.
  • network (DiGraph) – Network Graph to use for angle network.
  • node_positions (Dict[~KT, ~VT]) – Positions of the nodes (SSEs).
  • sse_list (List[str]) – The SSEs to be considered.
  • prefix (Union[Path, str]) – Prefix for plot name.
  • write (bool) – Shall the plot by saved (default: True).
Return type:

Tuple[Figure, Path]

MASTER

pds_database(log, filter=None)

Provide the list of target PDS as a file and a list.

Note

Depends on the master.pds configuration option.

Parameters:
  • log (Logger) – Job logger.
  • filter (Union[str, Path, None]) – File containting the target subset, otherwise all PDS database is considered.
Return type:

Tuple[Path, List[~T]]

createPDS(infile, outfile=None)

Make the createPDS command call.

Note

Depends on the master.create configuration option.

Parameters:
  • infile (Union[Path, str]) – PDB file to convert.
  • outfile (Optional[str]) – Name of the expected PDS output.
Return type:

List[str]

master_best_each(log, infile, outdir, rmsd=5.0)

Create one MASTER call for each PDS file with the –topN 1 flag.

Note

Depends on the master.master configuration option Depends on the master.pds configuration option

Return type:List[List[str]]
master_fixedgap(query, pds_list, master_out, mdis, Mdis, rmsd_cut)

Create the MASTER executable for a fixed residue distance between matches.

Parameters:
  • query (Path) – Query PDS file.
  • pds_list (Path) – File with the database list of PDS targets.
  • master_out (Path) – Output file with the MASTER results.
  • mdis (int) – Minimum distance.
  • Mdis (int) – Maximum distance.
  • rmsd_cut (float) – RMSD search cutoff.
Return type:

List[List[str]]

master_groupedgap(query, pds_list, master_out, gaps, rmsd_cut)

Create the MASTER executable for a fixed residue distance between matches.

Parameters:
  • query (Path) – Query PDS file.
  • pds_list (Path) – File with the database list of PDS targets.
  • master_out (Path) – Output file with the MASTER results.
  • gaps (str) – Allowed lengths between the gaps.
  • rmsd_cut (float) – RMSD search cutoff.
Return type:

List[List[str]]

master_nogap(query, pds_list, master_out, rmsd_cut)

Create the MASTER executable for a fixed residue distance between matches.

Parameters:
  • query (Path) – Query PDS file.
  • pds_list (Path) – File with the database list of PDS targets.
  • master_out (Path) – Output file with the MASTER results.
  • mdis – Minimum distance.
  • Mdis – Maximum distance.
  • rmsd_cut (float) – RMSD search cutoff.
Return type:

List[List[str]]

Plugins

plugin_title(plugin_path, cases)

Print on-screen the plugin’s name.

Parameters:
  • plugin_path (str) – __file__ of the plugin’s main file.
  • cases (int) – Number of cases to which the plugin will be applied.
plugin_case_count(cases, io='o')

Print on-screen the current number of cases.

Parameters:
  • cases (int) – Current number of cases.
  • io (str) – If i: input. If o: output
plugin_warning(text)

Format a warning and manage follow up behaviour.

Parameters:text (str) – Warning text.
plugin_filemaker(text)

Highlight the creation of new files.

Parameters:text (str) – File creation text.
plugin_imagemaker(text)

Highlight the creation of new plot files.

Parameters:text (str) – File creation text.
plugin_filereader(text)

Highlight the loading of files.

Parameters:text (str) – File reading text.
plugin_bash(text)

Show prepared bash statements to execute.

Parameters:text (Union[List[List[~T]], List[str]]) – List of statements to show.
plugin_conditions(metadata)

Check if the Case has reach the appropiate data content to be executed.

Parameters:metadata (dict) – Plugin requirements defined by its metadata function.

Rosetta

constraint_design(case, natbias, layer_design=True, motif=None, binder=None, hotspots=None, profile=False)

Creates the design script upon a Case with constraints.

Parameters:
  • case (Case) – The case to use for constraints.
  • motif (Optional[List[~T]]) – The motif to be inserted and kept fixed.
  • binder (Optional[List[~T]]) – The context structure to be added during design.
  • hotspots (Optional[List[~T]]) – Motif hotspot residue to keep completely fixed.
  • profile (Optional[bool]) – Sequence profile from fragments to guide design (default: False).
  • natbias (float) – The bias weight to favour correct SSE formation.
Return type:

ScriptPieces

funfoldes(case, motif=None, binder=None, hotspots=None)

The general FunFoldDesMover script where input pose is the template, where the motif will be grafted into. Thus, if a binder is present, one needs to remove that one before running the NubInitioMover. The binder will be parsed together with the motif. Note, that after the NubInitioMover, the binder will be in the pose. We remove the binder as it is easier to work with files containing only the design afterwards.

Parameters:
  • case (Case) – The case to use for constraints.
  • motif (Optional[List[~T]]) – The motif to be inserted and kept fixed.
  • binder (Optional[List[~T]]) – The context structure to be added during design.
  • hotspots (Optional[List[~T]]) – Motif hotspot residue to keep completely fixed.
Return type:

str

hybridize(case, template, natbias)

Creates the hybridize script upon a Case with constraints.

Caution

Please be careful with the energy function setup.

To Developers

This implementation has not been fully tested and optimized.

Parameters:
  • case (Case) – The case to use for constraints.
  • template (str) – The template apply the hybridization onto.
  • natbias (float) – The bias weight to favour correct SSE formation.
Return type:

str

rosettascript(data)

Global RosettaScripts XML template script.

Return type:str

Slurm

submit_slurm(log, slurm_file, condition_file=None)

Submits a slurm file.

Parameters:
  • log (Logger) – Job Logger.
  • slurm_file (Union[Path, str]) – Slurm file to be submitted.
  • condition_file (Union[str, Path, None]) – The name of the condition file to track status.
submit_nowait_slurm(log, slurm_file, dependency_mode=None, dependency_id=None)

Submits a slurm file with dependency on all arrays to finish.

Parameters:
  • log (Logger) – Job Logger.
  • slurm_file (Union[Path, str]) – Slurm file to be submitted.
  • dependency_mode (Optional[str]) – The dependency status.
  • dependency_id (Optional[int]) – The dependency ID for tracking the submitted job.
Return type:

int