rstoolbox.components.DesignFrame.make_resfile

DesignFrame.make_resfile(seqID, header, filename, write=True)

Generate a Rosetta resfile to match the design’s sequence assuming the reference_sequence as the starting point.

The function picks the mutant positions between the design sequence and the reference_sequence and generates a resfile that will transform one into the other.

If more than one design is provided, the resfile name (filename) is going to be modified with a counter. A new column will be added to the data container in order to keep track of the filename assignation:

New Column Data Content
resfile_<seqID> Name of the resfile
Parameters:
  • seqID (str) – Identifier of the sequence of interest.
  • header (str) – Header content for the resfile; defines default behaviour.
  • filename (str) – Identifier of the resfile. Will be altered with a numerical suffix if the data container holds more thant one sequence.
  • write (bool) – Testing attribute. When False, resfiles are not actually created
Returns:

Union[DesignSeries, DesignFrame] - Itself with the new column.

Raise:
NotImplementedError:
 if the data container is not DataFrame or Series.
KeyError:if there is no reference_sequence for chain seqID of the decoys
IOError:if output file exists and system.overwrite is False

Note

Depends on system.overwrite and system.output.

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 )
   ...: dfwt.head()
   ...: 
Out[1]: 
                                                                                                             sequence_B                           description mutants_B mutant_positions_B  mutant_count_B             resfile_B
0  TRPEEARERAWRLAEIAMRKGWEEHEREWEWWKRASKGREERDMLPERMIAAALRAIGEIFNAEWQMRLEMEKERKNPNAGEEKMKEQKKEAWKIAYYWGLMAAYWIKQHREKERK  test_3lhp_binder_labeled_00001                                     0               mutants_0000.resfile
1  TRPEEERERAWRLMEIAMRKGWEEHEREWEWWKRASKGREERDMLPERMIAAALRAIGEIFNAEWQMRLEMEKERKNPNAGEEKMKEQKKEAWKIAYYWGLMAAYWIKQHREKERK  test_3lhp_binder_labeled_00001_v0001  A6E,A14M  6,14               2               mutants_0001.resfile
2  TRPEEERERAWRLAEIAMRKGWEEHEREWEWWKRASKGREERDMLPERMIAAALRAIGEIFNAEWQMRLEMEKERKNPNAGEEKMKEQKKEAWKIAYYWGLMAAYWIKQHREKERK  test_3lhp_binder_labeled_00001_v0002  A6E       6                  1               mutants_0002.resfile
3  TRPEEERERAWRLTEIAMRKGWEEHEREWEWWKRASKGREERDMLPERMIAAALRAIGEIFNAEWQMRLEMEKERKNPNAGEEKMKEQKKEAWKIAYYWGLMAAYWIKQHREKERK  test_3lhp_binder_labeled_00001_v0003  A6E,A14T  6,14               2               mutants_0003.resfile
4  TRPEERRERAWRLMEIAMRKGWEEHEREWEWWKRASKGREERDMLPERMIAAALRAIGEIFNAEWQMRLEMEKERKNPNAGEEKMKEQKKEAWKIAYYWGLMAAYWIKQHREKERK  test_3lhp_binder_labeled_00001_v0004  A6R,A14M  6,14               2               mutants_0004.resfile