Path B - Module 51: Writing Your Own Form-Agnostic Functions#
As an Enzyme Engineer, you will develop your own analysis tools. Using the @arg_digest decorator, you can make your tools accept any molecular form automatically.
import molsysmt as msm
from molsysmt._private.argdigest import arg_digest
@arg_digest()
def calculate_enzyme_charge(molecular_system, selection='protein'):
# This custom tool will work with files, objects, or strings!
return msm.physchem.get_charge(molecular_system, selection=selection)
print(f"Charge from PDB ID: {calculate_enzyme_charge('pdb:6EQE')}")
print(f"Charge from native object: {calculate_enzyme_charge(msm.build.build_peptide('ACD'))}")