rstoolbox.components.DesignSeries.apply_resfile

DesignSeries.apply_resfile(seqID, filename, rscript=None, keep_input_scores=False)

Apply a generated Rosetta resfile to the decoy.

This function needs to be created after the appropiate mutant variants have been created and their corresponding resfiles have been written.

Note

Depends on rosetta.path and rosetta.compilation, if the filename does not exist.

Attention

This function REQUIRES a local installation of Rosetta.

To execute this function it is important that the source_file assigned to the DesignFrame is an original silent file and not a minisilent, as the original structure of the decoy needs to be used in order to generate the variants. If that is not the case, use DesignFrame.replace_source_files.

Parameters:
  • seqID (str) – Identifier of the sequence of interest
  • filename (str) – Name of the final silent file that will contain all the variant’s data. If the file exists, it is assumed that the data was already created and data will be directly loaded from that file.
  • rscript (str) – By default, the script executed will be the one generated by mutations(). One can provide its own script (either as the file name of the script or as a string of the content itself) as long as it fulfills two conditions: (1) It must contain the AddJobPairData Mover and (2) it should accept the script variable resfile. An example on how to use these two conditions can be extrapolated from mutations().
  • keep_input_scores (bool) – When True (default False), it will keep the score terms present in the source decoy (as they appear in the original silent file) for the variants.
Returns:

DesignFrame with the scores for the mutants.

Raise:
SystemError:If all variants faile to be generated or if they cannot be merged.
IOError:If Rosetta path cannot be found.
AttributeError:If the resfiles for the variants were not previously created.

Example

In [1]: from rstoolbox.io import parse_rosetta_file
   ...: import pandas as pd
   ...: pd.set_option('display.width', 1000)
   ...: df = parse_rosetta_file("../rstoolbox/tests/data/input_2seq.minisilent.gz",
   ...:                         {'scores': ['score', 'description'], 'sequence': 'B'})
   ...: df.add_reference_sequence('B', df.get_sequence('B').values[0])
   ...: dfwt = df.iloc[0].generate_mutant_variants('B', [(1, "TGP"), (6, "ERG"),
   ...:                                                  (14, "MAT")])
   ...: # Call in test-mode
   ...: dfwt = dfwt.make_resfile("B", "NATAA", "mutants.resfile", write=False )
   ...: dfwt2 = dfwt.iloc[:3].apply_resfile("B",
   ...:                                     "../rstoolbox/tests/data/variants.silent.gz")
   ...: dfwt2
   ...: 
Out[1]: 
                                                                                                             sequence_B                           description mutants_B mutant_positions_B  mutant_count_B             resfile_B    score    fa_atr   fa_rep    fa_sol  fa_intra_rep  fa_intra_sol_xover4  lk_ball_wtd  fa_elec  pro_close  hbond_sr_bb  hbond_lr_bb  hbond_bb_sc  hbond_sc  dslf_fa13   omega   fa_dun  p_aa_pp  yhh_planarity     ref  rama_prepro  B_ni_mtcontacts  B_ni_rmsd  B_ni_rmsd_threshold  B_ni_trials  GRMSD2Target  GRMSD2Template  LRMSD2Target  LRMSDH2Target  LRMSDLH2Target  design_score  silent_score  time
0  TRPEEARERAWRLAEIAMRKGWEEHEREWEWWKRASKGREERDMLPERMIAAALRAIGEIFNAEWQMRLEMEKERKNPNAGEEKMKEQKKEAWKIAYYWGLMAAYWIKQHREKERK  test_3lhp_binder_labeled_00001                                     0               mutants_0000.resfile -103.093 -1737.208  705.964  1198.941  3.131         63.940              -30.387      -500.969  39.037    -199.416     -3.191       -18.159      -34.962    0.0        36.828  367.855 -27.951   0.0            38.222 -4.768        54.0             0.164      5.0                  1.0          2.192         1.607           5.601         4.96           3.001          -240.251      -103.094       6.0 
1  TRPEEERERAWRLMEIAMRKGWEEHEREWEWWKRASKGREERDMLPERMIAAALRAIGEIFNAEWQMRLEMEKERKNPNAGEEKMKEQKKEAWKIAYYWGLMAAYWIKQHREKERK  test_3lhp_binder_labeled_00001_v0001  A6E,A14M  6,14               2               mutants_0001.resfile -97.919  -1738.503  719.811  1197.301  3.099         64.070              -29.545      -504.421  39.037    -199.416     -3.191       -18.159      -36.017    0.0        36.828  367.395 -28.282   0.0            36.873 -4.799        54.0             0.164      5.0                  1.0          2.192         1.607           5.601         4.96           3.001          -240.251      -97.921        7.0 
2  TRPEEERERAWRLAEIAMRKGWEEHEREWEWWKRASKGREERDMLPERMIAAALRAIGEIFNAEWQMRLEMEKERKNPNAGEEKMKEQKKEAWKIAYYWGLMAAYWIKQHREKERK  test_3lhp_binder_labeled_00001_v0002  A6E       6                  1               mutants_0002.resfile -65.317  -1735.618  743.511  1203.036  3.086         65.985              -32.607      -500.559  35.213    -199.416     -3.191       -16.619      -33.651    0.0        36.828  367.085 -28.339   0.0            34.915 -4.976        54.0             0.164      5.0                  1.0          2.192         1.607           5.601         4.96           3.001          -240.251      -65.318        6.0