TalosN(shifts, sequence=None, entry_id=None, entity_id=None, entry=None, data_dir=None)
Predict backbone torsion angles, S2 order parameters, and secondary
structure from assigned chemical shifts using the NIH TALOS-N binary.
Build from a shift table:
tn = TalosN.from_bmrb(15000, data_dir="~/talosn_data")
tn.run(auto_install=True)
tn.order_parameters # predS2 table
tn.torsion_angles # pred.tab
tn.secondary_structure # predSS.tab
Source code in makeshift/talosn/engine.py
| def __init__(self, shifts, sequence=None, entry_id=None, entity_id=None,
entry=None, data_dir=None):
self.shifts = shifts
self.sequence = sequence
self.entry_id = entry_id
self.entity_id = entity_id
self.entry = entry
self.data_dir = data_dir
self.results = None
|
from_bmrb
classmethod
from_bmrb(bmrb_id, entity_id=None, sequence=None, data_dir=None, **fetch_kw)
Fetch a BMRB entry and build from its assigned chemical shifts.
Source code in makeshift/talosn/engine.py
| @classmethod
def from_bmrb(cls, bmrb_id, entity_id=None, sequence=None, data_dir=None, **fetch_kw):
"""Fetch a BMRB entry and build from its assigned chemical shifts."""
from ..entry import NMRStarEntry
entry = NMRStarEntry.from_bmrb(bmrb_id, **fetch_kw)
return cls.from_entry(entry, entity_id=entity_id, sequence=sequence,
data_dir=data_dir)
|
from_entry
classmethod
from_entry(entry, entity_id=None, sequence=None, data_dir=None)
Build from an already-parsed :class:NMRStarEntry.
Source code in makeshift/talosn/engine.py
| @classmethod
def from_entry(cls, entry, entity_id=None, sequence=None, data_dir=None):
"""Build from an already-parsed :class:`NMRStarEntry`."""
from ..chemshift import ChemicalShifts
if sequence is None:
seqs = entry.sequences()
if entity_id is not None:
sequence = entry.sequences(entity_id=entity_id)
else:
poly = seqs[
seqs["Polymer_type"].str.contains("polypeptide", case=False, na=False)
]
if poly.empty:
raise ValueError(
f"No polypeptide sequence found in entry {getattr(entry, 'entry_id', None)}"
)
sequence = poly.iloc[0]["Polymer_seq_one_letter_code"]
entity_id = poly.iloc[0]["ID"]
if not isinstance(sequence, str) or not sequence or pd.isna(sequence):
raise ValueError("could not resolve a sequence; pass sequence=... explicitly")
shifts = utils.filter_backbone(ChemicalShifts.from_entry(entry).data)
if shifts.empty:
raise ValueError(
f"No backbone chemical shifts in entry {getattr(entry, 'entry_id', None)}"
)
return cls(shifts, sequence,
entry_id=getattr(entry, "entry_id", None),
entity_id=entity_id, entry=entry, data_dir=data_dir)
|
predict_s2
Run if needed and return the predS2 table, raising if absent.
Source code in makeshift/talosn/engine.py
| def predict_s2(self, **run_kw):
"""Run if needed and return the predS2 table, raising if absent."""
if self.results is None:
self.run(**run_kw)
s2_df = self.results.get("s2")
if s2_df is None or len(s2_df) == 0:
raise RuntimeError(
"TALOS-N did not produce predS2.tab. Ensure backbone carbon "
"shifts (CA/CB/C) are present and that TALOS-N data are "
"installed via install_talosn_data()."
)
return s2_df
|