Skip to content

RCI

RCI

RCI

RCI(shifts=None, sequence=None, first_resid=None, entry_id=None, entity_id=None, entry=None, neighbor_table='schwarzinger', algorithm='wishart')

Per-residue backbone flexibility from assigned chemical shifts. Pure Python — no external binary, unlike :class:~makeshift.talosn.TalosN.

r = RCI.from_bmrb(4403)
r.run()
r.results     # Seq_ID, Comp_ID, RCI, S2

Or, from a :class:~makeshift.chemshift.ChemicalShifts you already have, in one step:

cs = ChemicalShifts.from_bmrb(4403, keep_download=True)
RCI.calc(cs).results

Parameters:

Name Type Description Default
algorithm (wishart, talosn)

Which calculation to run. 'wishart' ports the reference script rci_v_1c.py; 'talosn' ports the separate RCI-S2 module bundled inside TALOS-N, which reproduces its quirks so the output matches the compiled binary (see :mod:makeshift.rci._talosn). The two agree closely on RCI but report S2 on different scales — see docs/rci_validation.md.

'wishart'
neighbor_table (schwarzinger, wang, schwartz_wang)

Which preceding/next-residue corrections to use; see :data:makeshift.data.tables.RCI_NEIGHBOR_TABLES. Nothing here predicts secondary structure, so all three resolve to their coil-state values. Ignored when algorithm='talosn', whose tables are compiled into the binary.

'schwarzinger'
Source code in makeshift/rci/engine.py
def __init__(self, shifts=None, sequence=None, first_resid=None, entry_id=None,
             entity_id=None, entry=None, neighbor_table="schwarzinger",
             algorithm="wishart"):
    if algorithm not in _ALGORITHMS:
        raise ValueError(f"algorithm must be one of {_ALGORITHMS}, got {algorithm!r}")
    self.shifts = shifts
    self.sequence = sequence
    self.first_resid = first_resid
    self.entry_id = entry_id
    self.entity_id = entity_id
    self.entry = entry
    self.neighbor_table = neighbor_table
    self.algorithm = algorithm
    self.results = None

calc classmethod

calc(chemshifts, entity_id=None, sequence=None, neighbor_table='schwarzinger', algorithm='wishart')

Build from a :class:ChemicalShifts, run, and return the populated :class:RCI. The sequence comes from the ChemicalShifts' entry unless sequence is passed.

Source code in makeshift/rci/engine.py
@classmethod
def calc(cls, chemshifts, entity_id=None, sequence=None,
         neighbor_table="schwarzinger", algorithm="wishart"):
    """
    Build from a :class:`ChemicalShifts`, run, and return the populated
    :class:`RCI`. The sequence comes from the ChemicalShifts' entry
    unless `sequence` is passed.
    """
    entry = chemshifts.entry
    if sequence is None:
        if entry is None:
            raise ValueError(
                "chemshifts has no associated entry; pass sequence=... explicitly"
            )
        sequence, entity_id = cls._resolve_sequence(entry, entity_id)

    shifts = chemshifts.data
    if shifts.empty:
        raise ValueError("chemshifts has no chemical shift data")
    if entry is not None:
        first_resid = entry.resolve_first_resid(entity_id, sequence, shifts)
    else:
        first_resid = int(shifts["Seq_ID"].min())
    obj = cls(shifts, sequence, first_resid=first_resid,
              entry_id=getattr(entry, "entry_id", None),
              entity_id=entity_id, entry=entry, neighbor_table=neighbor_table,
              algorithm=algorithm)
    obj.run()
    return obj

run

run()

Run the selected algorithm and populate :attr:results.

Source code in makeshift/rci/engine.py
def run(self):
    """Run the selected algorithm and populate :attr:`results`."""
    if self.algorithm == "talosn":
        self._run_talosn()
    else:
        self._run_wishart()
    return self

Lookup tables

get_rci_tables

get_rci_tables(neighbor_table='schwarzinger')

Lookup tables for the RCI (Random Coil Index) flexibility predictor. neighbor_table selects which preceed/next-residue correction values to use -- see RCI_NEIGHBOR_TABLES for the options and what they mean. Each returned value is a DataFrame indexed by one-letter residue code with columns [N, CO, CA, CB, NH, HA]; NaN marks an atom that has no defined value for that residue (e.g. Gly CB, Pro N/NH).

Returns a dict with keys: random_coil, preceed_effect, next_effect, preceed_preceed_effect, next_next_effect.

Source code in makeshift/data/tables.py
def get_rci_tables(neighbor_table="schwarzinger"):
    """
    Lookup tables for the RCI (Random Coil Index) flexibility predictor.
    `neighbor_table` selects which preceed/next-residue correction values
    to use -- see RCI_NEIGHBOR_TABLES for the options and what they mean.
    Each returned value is a DataFrame indexed by one-letter residue code
    with columns [N, CO, CA, CB, NH, HA]; NaN marks an atom that has no
    defined value for that residue (e.g. Gly CB, Pro N/NH).

    Returns a dict with keys: random_coil, preceed_effect, next_effect,
    preceed_preceed_effect, next_next_effect.
    """
    if neighbor_table not in RCI_NEIGHBOR_TABLES:
        raise ValueError(
            f"neighbor_table={neighbor_table!r} not recognized; "
            f"choose one of {RCI_NEIGHBOR_TABLES}"
        )
    return {
        "random_coil": _load_rci_wide_table("random_coil.csv"),
        "preceed_effect": _load_rci_neighbor_table("preceed_effect", neighbor_table),
        "next_effect": _load_rci_neighbor_table("next_effect", neighbor_table),
        "preceed_preceed_effect": _load_rci_wide_table("preceed_preceed_effect.csv"),
        "next_next_effect": _load_rci_wide_table("next_next_effect.csv"),
    }

get_talosn_rc_tables

get_talosn_rc_tables()

TALOS-N's own random-coil-adjustment tables (randcoil.tab, rcadj.tab, rcprev.tab, rcnext.tab, bundled with the TALOS-N binary) -- a different table system from RCI's own Schwarzinger tables above, used by TALOS-N's RCI-S2 module (RCI.cpp) to synthesize a value for atoms that were never observed (see makeshift.rci._talosn). Each is a DataFrame indexed by one-letter residue code (plus "c" for TALOS-N's own oxidized-Cys variant, its own >=34.0ppm CB threshold -- distinct from RCI's 35.0ppm one) with columns [N, CO, CA, CB, NH, HA]; NaN marks an atom with no defined value (Gly CB, Pro NH in randcoil only).

Returns a dict with keys: randcoil, rcadj, rcprev, rcnext.

Source code in makeshift/data/tables.py
def get_talosn_rc_tables():
    """
    TALOS-N's own random-coil-adjustment tables (randcoil.tab, rcadj.tab,
    rcprev.tab, rcnext.tab, bundled with the TALOS-N binary) -- a
    different table system from RCI's own Schwarzinger tables above, used
    by TALOS-N's RCI-S2 module (RCI.cpp) to synthesize a value for atoms
    that were never observed (see makeshift.rci._talosn). Each is a
    DataFrame indexed by one-letter residue code (plus "c" for TALOS-N's
    own oxidized-Cys variant, its own >=34.0ppm CB threshold -- distinct
    from RCI's 35.0ppm one) with columns [N, CO, CA, CB, NH, HA]; NaN
    marks an atom with no defined value (Gly CB, Pro NH in randcoil only).

    Returns a dict with keys: randcoil, rcadj, rcprev, rcnext.
    """
    return {
        "randcoil": _load_rci_wide_table("talosn_randcoil.csv"),
        "rcadj": _load_rci_wide_table("talosn_rcadj.csv"),
        "rcprev": _load_rci_wide_table("talosn_rcprev.csv"),
        "rcnext": _load_rci_wide_table("talosn_rcnext.csv"),
    }