diff --git a/chilife/RotamerEnsemble.py b/chilife/RotamerEnsemble.py index 5c625d15..741a3673 100755 --- a/chilife/RotamerEnsemble.py +++ b/chilife/RotamerEnsemble.py @@ -33,6 +33,61 @@ class RotamerEnsemble: rotlib : str Rotamer library to use for constructing the RotamerEnsemble **kwargs : dict + + minimize: bool + Switch to turn on/off minimization. During minimization each rotamer is optimized in dihedral space + with respect to both internal and external clashes, and deviation from the starting conformation in + dihedral space. + min_method: str + Name of the minimization algorithm to use. All ``scipy.optimize.minimize`` algorithms are available + and include: ‘Nelder-Mead’, ‘Powell’, ‘CG’, ‘BFGS’, ‘Newton-CG’, ‘L-BFGS-B’, ‘TNC’, ‘COBYLA’, ‘SLSQP’, + ‘trust-constr’, ‘dogleg’, ‘trust-ncg’, ‘trust-exact’, ‘trust-krylov’, and custom. + exclude_nb_interactions: int: + When calculating internal clashes, ignore 1-``exclude_nb_interactions`` interactions and below. Defaults + to ignore 1-3 interactions, i.e. atoms that are connected by 2 bonds or fewer will not have a steric + effect on each other. + eval_clash : bool + Switch to turn clash evaluation on (True) and off (False). + energy_func : callable + Python function or callable object that takes a protein and a RotamerEnsemble object as input and + returns an energy value (kcal/mol) for each atom of each rotamer in the ensemble. See also + :mod:`Scoring ` . Defaults to :mod:`chiLife.get_lj_rep ` . + forgive : float + Softening factor to be passed to ``energy_func``. Only used if ``energy_func`` uses a softening factor. + Defaults to 1.0. See :mod:`Scoring ` . + temp : float + Temperature to use when running ``energy_func``. Only used if ``energy_func`` accepts a temperature + argument Defaults to 298 K. + clash_radius : float + Cutoff distance (angstroms) for inclusion of atoms in clash evaluations. This distance is measured from + ``clash_ori`` Defaults to the longest distance between any two atoms in the rotamer ensemble plus 5 + angstroms. + clash_ori : str + Atom selection to use as the origin when finding atoms within the ``clash_radius``. Defaults to 'cen', + the centroid of the rotamer ensemble heavy atoms. + protein_tree : Scipy.spatial.cKDTree + KDTree of atom positions for fast distance calculations and neighbor detection. Defaults to None + trim: bool + When true, the lowest `trim_tol` fraction of rotamers in the ensemble will be removed. + trim_tol: float + Tolerance for trimming rotamers from the ensemble. trim_tol=0.005 means the bottom 0.5% of rotamers + will be removed. + alignment_method : str + Method to use when attaching or aligning the rotamer ensemble backbone with the protein backbone. + Defaults to ``'bisect'`` which aligns the CA atom, the vectors bisecting the N-CA-C angle and the + N-CA-C plane. + dihedral_sigmas : float, numpy.ndarray + Standard deviations of dihedral angles (degrees) for off rotamer sampling. Can be a single number for + isotropic sampling, a vector to define each dihedral individually or a matrix to define a value for + each rotamer and each dihedral. Setting this value to np.inf will force uniform (accessible volume) + sampling. Defaults to 35 degrees. + weighted_sampling : bool + Determines whether the rotamer ensemble is sampled uniformly or based off of their intrinsic weights. + Defaults to False. + use_H : bool + Determines if hydrogen atoms are used or not. Defaults to False. + + protein_tree : Scipy.spatial.cKDTree KDTree of atom positions for fast distance calculations and neighbor detection. Defaults to None forgive : float @@ -62,8 +117,7 @@ class RotamerEnsemble: Defaults to False. use_H : bool Determines if hydrogen atoms are used or not. Defaults to False. - eval_clash : bool - Switch to turn clash evaluation on (True) and off (False). + sample : int, bool Argument to use the off-rotamer sampling method. If ``False`` or ``0`` the off-rotamer sampling method will not be used. If ``int`` the ensemble will be generated with that many off-rotamer samples. diff --git a/chilife/dRotamerEnsemble.py b/chilife/dRotamerEnsemble.py index b27ac4de..447d3544 100755 --- a/chilife/dRotamerEnsemble.py +++ b/chilife/dRotamerEnsemble.py @@ -16,6 +16,80 @@ class dRotamerEnsemble: + """Create new dRotamerEnsemble object. + + Parameters + ---------- + res : string + 3-character name of desired residue, e.g. RXA. + site : tuple[int, int] + Protein residue numbers to attach the bifunctional library to. + protein : MDAnalysis.Universe, MDAnalysis.AtomGroup + Object containing all protein information (coords, atom types, etc.) + chain : str + Protein chain identifier to attach spin label to. + rotlib : str + Rotamer library to use for constructing the RotamerEnsemble + **kwargs : dict + restraint_weight: float + Force constant (kcal/mol/A^2) for calculating energetic penalty of restraint satisfaction, i.e. the + alignment of the overlapping atoms of the two mono-functional subunits of the bifunctional label. + torsion_weight: float + Force constant (kcal/mol/radian^2) for calculating energetic penalty of the deviation from rotamer + starting dihedral angles. + minimize: bool + Switch to turn on/off minimization. During minimization each rotamer is optimized in dihedral space + with respect to alignment of the "cap" atoms of the two mono-functional subunits, internal clashes + and deviation from the starting conformation in dihedral space. + min_method: str + Name of the minimization algorithm to use. All ``scipy.optimize.minimize`` algorithms are available + and include: ‘Nelder-Mead’, ‘Powell’, ‘CG’, ‘BFGS’, ‘Newton-CG’, ‘L-BFGS-B’, ‘TNC’, ‘COBYLA’, ‘SLSQP’, + ‘trust-constr’, ‘dogleg’, ‘trust-ncg’, ‘trust-exact’, ‘trust-krylov’, and custom. + exclude_nb_interactions: int: + When calculating internal clashes, ignore 1-``exclude_nb_interactions`` interactions and below. Defaults + to ignore 1-3 interactions, i.e. atoms that are connected by 2 bonds or fewer will not have a steric + effect on each other. + eval_clash : bool + Switch to turn clash evaluation on (True) and off (False). + energy_func : callable + Python function or callable object that takes a protein and a RotamerEnsemble object as input and + returns an energy value (kcal/mol) for each atom of each rotamer in the ensemble. See also + :mod:`Scoring ` . Defaults to :mod:`chiLife.get_lj_energy ` . + forgive : float + Softening factor to be passed to ``energy_func``. Only used if ``energy_func`` uses a softening factor. + Defaults to 0.95. See :mod:`Scoring ` . + temp : float + Temperature to use when running ``energy_func``. Only used if ``energy_func`` accepts a temperature + argument Defaults to 298 K. + clash_radius : float + Cutoff distance (angstroms) for inclusion of atoms in clash evaluations. This distance is measured from + ``clash_ori`` Defaults to the longest distance between any two atoms in the rotamer ensemble plus 5 + angstroms. + clash_ori : str + Atom selection to use as the origin when finding atoms within the ``clash_radius``. Defaults to 'cen', + the centroid of the rotamer ensemble heavy atoms. + protein_tree : Scipy.spatial.cKDTree + KDTree of atom positions for fast distance calculations and neighbor detection. Defaults to None + trim: bool + When true, the lowest `trim_tol` fraction of rotamers in the ensemble will be removed. + trim_tol: float + Tolerance for trimming rotamers from the ensemble. trim_tol=0.005 means the bottom 0.5% of rotamers + will be removed. + alignment_method : str + Method to use when attaching or aligning the rotamer ensemble backbone with the protein backbone. + Defaults to ``'bisect'`` which aligns the CA atom, the vectors bisecting the N-CA-C angle and the + N-CA-C plane. + dihedral_sigmas : float, numpy.ndarray + Standard deviations of dihedral angles (degrees) for off rotamer sampling. Can be a single number for + isotropic sampling, a vector to define each dihedral individually or a matrix to define a value for + each rotamer and each dihedral. Setting this value to np.inf will force uniform (accessible volume) + sampling. Defaults to 35 degrees. + weighted_sampling : bool + Determines whether the rotamer ensemble is sampled uniformly or based off of their intrinsic weights. + Defaults to False. + use_H : bool + Determines if hydrogen atoms are used or not. Defaults to False. + """ backbone_atoms = ["H", "N", "CA", "HA", "C", "O"] def __init__(self, res, sites, protein=None, chain=None, rotlib=None, **kwargs): @@ -28,22 +102,10 @@ def __init__(self, res, sites, protein=None, chain=None, rotlib=None, **kwargs): self.protein = protein self.chain = chain if chain is not None else self.guess_chain() - self.protein_tree = self.kwargs.setdefault("protein_tree", None) - - self.forgive = kwargs.setdefault("forgive", 0.95) - self._clash_ori_inp = kwargs.setdefault("clash_ori", "cen") - self.restraint_weight = kwargs.pop("restraint_weight") if "restraint_weight" in kwargs else 222 - self.torsion_weight = kwargs.pop("torsion_weight") if "torsion_weight" in kwargs else 5 - self.alignment_method = kwargs.setdefault("alignment_method", "bisect".lower()) - self.dihedral_sigmas = kwargs.setdefault("dihedral_sigmas", 25) - self._exclude_nb_interactions = kwargs.setdefault('exclude_nb_interactions', 3) - self._minimize = kwargs.pop("minimize", True) - self.min_method = kwargs.pop('min_method', 'L-BFGS-B') - self.trim_tol = kwargs.pop('trim_tol', 0.005) - self._do_trim = kwargs.pop('trim', True) - self.eval_clash = kwargs.pop("eval_clash", True) - self.energy_func = kwargs.setdefault("energy_func", chilife.get_lj_energy) - self.temp = kwargs.setdefault("temp", 298) + + self.input_kwargs = kwargs + self.__dict__.update(dassign_defaults(kwargs)) + self.get_lib(rotlib) self.create_ensembles() @@ -72,13 +134,10 @@ def __init__(self, res, sites, protein=None, chain=None, rotlib=None, **kwargs): if self.chain is not None: self.name += f"_{self.chain}" - self.selstr = ( - f"resid {self.site1} {self.site2} and segid {self.chain} and not altloc B" - ) + self.selstr = f"resid {self.site1} {self.site2} and segid {self.chain} and not altloc B" self._graph = ig.Graph(edges=self.bonds) - self.clash_radius = kwargs.setdefault("clash_radius", None) if self.clash_radius is None: self.clash_radius = np.linalg.norm(self.clash_ori - self.coords, axis=-1).max() + 5 @@ -274,9 +333,9 @@ def minimize(self, callback=None): self.cap_MSDs = MSD self.RE1.backbone_to_site() self.RE2.backbone_to_site() - + self.score_base = scores.min() scores -= scores.min() - self.rotamer_scores = scores + self.rotamer_scores = scores + self.score_base self.weights *= np.exp(-scores / (chilife.GAS_CONST * self.temp) / np.exp(-scores).sum()) self.weights /= self.weights.sum() @@ -545,3 +604,63 @@ def copy(self): else: new_copy.__dict__[item] = deepcopy(self.__dict__[item]) return new_copy + + +def dassign_defaults(kwargs): + """ + Helper function to assign default values to kwargs that have not been explicitly assigned by the user. Also + checks to make sure that the user provided kwargs are real kwargs. + Parameters + ---------- + kwargs : dict + Dictionary of user supplied keyword arguments. + + + Returns + ------- + kwargs : dict + Dictionary of user supplied keyword arguments augmented with defaults for all kwargs the user did not supply. + """ + + # Make all string arguments lowercase + for key, value in kwargs.items(): + if isinstance(value, str): + kwargs[key] = value.lower() + + # Default parameters + defaults = { + "eval_clash": True, + + "forgive": 0.95, + "temp": 298, + "clash_radius": None, + "protein_tree": None, + "_clash_ori_inp": kwargs.pop("clash_ori", "cen"), + + "alignment_method": "bisect", + "dihedral_sigmas": 25, + + "use_H": False, + "_exclude_nb_interactions": kwargs.pop('exclude_nb_interactions', 3), + + "energy_func": chilife.get_lj_energy, + "_minimize": kwargs.pop('minimize', True), + "min_method": 'L-BFGS-B', + "_do_trim": kwargs.pop('trim', True), + "trim_tol": 0.005, + + "restraint_weight": kwargs.pop('restraint_weight', 222), + "torsion_weight": 5, + } + + # Overwrite defaults + kwargs_filled = {**defaults, **kwargs} + + # Make sure there are no unused parameters + if len(kwargs_filled) != len(defaults): + raise TypeError( + f"Got unexpected keyword argument(s): " + f'{", ".join(key for key in kwargs if key not in defaults)}' + ) + + return kwargs_filled.items() \ No newline at end of file diff --git a/chilife/data/dihedral_defs.json b/chilife/data/dihedral_defs.json index 992e10df..1fee29f1 100644 --- a/chilife/data/dihedral_defs.json +++ b/chilife/data/dihedral_defs.json @@ -1 +1 @@ -{"ARG": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD"], ["CB", "CG", "CD", "NE"], ["CG", "CD", "NE", "CZ"], ["CD", "NE", "CZ", "NH1"]], "ASN": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "OD1"]], "ASP": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "OD1"]], "CYS": [["N", "CA", "CB", "SG"]], "GLN": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD"], ["CB", "CG", "CD", "OE1"]], "GLU": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD"], ["CB", "CG", "CD", "OE1"]], "HIS": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "ND1"]], "ILE": [["N", "CA", "CB", "CG1"], ["CA", "CB", "CG1", "CD1"]], "LEU": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD1"]], "LYS": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD"], ["CB", "CG", "CD", "CE"], ["CG", "CD", "CE", "NZ"]], "MET": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "SD"], ["CB", "CG", "SD", "CE"]], "PHE": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD1"]], "PRO": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD"]], "SER": [["N", "CA", "CB", "OG"]], "THR": [["N", "CA", "CB", "OG1"]], "TRP": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD1"]], "TYR": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD1"]], "VAL": [["N", "CA", "CB", "CG1"]], "R1C": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "SD"], ["CB", "SG", "SD", "CE"], ["SG", "SD", "CE", "C3"], ["SD", "CE", "C3", "C2"]], "CYR1": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "S1L"], ["CB", "SG", "S1L", "C1L"], ["SG", "S1L", "C1L", "C1R"], ["S1L", "C1L", "C1R", "C1"]], "MTN": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "S1"], ["CB", "SG", "S1", "C4"], ["SG", "S1", "C4", "C3"], ["S1", "C4", "C3", "C2"]], "R1M": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "SD"], ["CB", "SG", "SD", "CE"], ["SG", "SD", "CE", "C3"], ["SD", "CE", "C3", "C2"]], "ALA": [], "GLY": [], "DHC": [[["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "ND1"]], [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "ND1"]]], "TRT": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "SD"], ["CB", "SG", "SD", "CAD"], ["SG", "SD", "CAD", "CAE"], ["SD", "CAD", "CAE", "OAC"]], "R1A": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "SD"], ["CB", "SG", "SD", "CE"], ["SG", "SD", "CE", "C3"], ["SD", "CE", "C3", "C2"]], "I1A": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "CD"], ["CB", "SG", "CD", "CE"], ["SG", "CD", "CE", "NZ"], ["CD", "CE", "NZ", "C3"], ["CE", "NZ", "C3", "C2"]], "M1A": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "C4"], ["CB", "SG", "C4", "C5"], ["C5", "N2", "C8", "C13"]], "R7A": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "S2"], ["CB", "SG", "S2", "C4"], ["SG", "S2", "C4", "C5"], ["S2", "C4", "C5", "C6"]], "V1A": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "S2"], ["CB", "SG", "S2", "C4"], ["SG", "S2", "C4", "C8"]]} \ No newline at end of file +{"ARG": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD"], ["CB", "CG", "CD", "NE"], ["CG", "CD", "NE", "CZ"], ["CD", "NE", "CZ", "NH1"]], "ASN": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "OD1"]], "ASP": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "OD1"]], "CYS": [["N", "CA", "CB", "SG"]], "GLN": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD"], ["CB", "CG", "CD", "OE1"]], "GLU": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD"], ["CB", "CG", "CD", "OE1"]], "HIS": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "ND1"]], "ILE": [["N", "CA", "CB", "CG1"], ["CA", "CB", "CG1", "CD1"]], "LEU": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD1"]], "LYS": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD"], ["CB", "CG", "CD", "CE"], ["CG", "CD", "CE", "NZ"]], "MET": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "SD"], ["CB", "CG", "SD", "CE"]], "PHE": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD1"]], "PRO": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD"]], "SER": [["N", "CA", "CB", "OG"]], "THR": [["N", "CA", "CB", "OG1"]], "TRP": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD1"]], "TYR": [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "CD1"]], "VAL": [["N", "CA", "CB", "CG1"]], "R1C": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "SD"], ["CB", "SG", "SD", "CE"], ["SG", "SD", "CE", "C3"], ["SD", "CE", "C3", "C2"]], "CYR1": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "S1L"], ["CB", "SG", "S1L", "C1L"], ["SG", "S1L", "C1L", "C1R"], ["S1L", "C1L", "C1R", "C1"]], "MTN": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "S1"], ["CB", "SG", "S1", "C4"], ["SG", "S1", "C4", "C3"], ["S1", "C4", "C3", "C2"]], "R1M": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "SD"], ["CB", "SG", "SD", "CE"], ["SG", "SD", "CE", "C3"], ["SD", "CE", "C3", "C2"]], "ALA": [], "GLY": [], "TRT": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "SD"], ["CB", "SG", "SD", "CAD"], ["SG", "SD", "CAD", "CAE"], ["SD", "CAD", "CAE", "OAC"]], "R1A": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "SD"], ["CB", "SG", "SD", "CE"], ["SG", "SD", "CE", "C3"], ["SD", "CE", "C3", "C2"]], "I1A": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "CD"], ["CB", "SG", "CD", "CE"], ["SG", "CD", "CE", "NZ"], ["CD", "CE", "NZ", "C3"], ["CE", "NZ", "C3", "C2"]], "M1A": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "C4"], ["CB", "SG", "C4", "C5"], ["C5", "N2", "C8", "C13"]], "R7A": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "S2"], ["CB", "SG", "S2", "C4"], ["SG", "S2", "C4", "C5"], ["S2", "C4", "C5", "C6"]], "V1A": [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "S2"], ["CB", "SG", "S2", "C4"], ["SG", "S2", "C4", "C8"]]} \ No newline at end of file diff --git a/chilife/data/dihedral_defs.toml b/chilife/data/dihedral_defs.toml index d47bd3fc..58f7835e 100755 --- a/chilife/data/dihedral_defs.toml +++ b/chilife/data/dihedral_defs.toml @@ -22,10 +22,10 @@ MTN = [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "S1"], ["CB", "SG", "S1", "C4 R1M = [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "SD"], ["CB", "SG", "SD", "CE"], ["SG", "SD", "CE", "C3"], ["SD", "CE", "C3", "C4"]] ALA = [] GLY = [] -DHC = [[["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "ND1"]], [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "ND1"]]] TRT = [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "SD"], ["CB", "SG", "SD", "CAD"], ["SG", "SD", "CAD", "CAE"], ["SD", "CAD", "CAE", "OAC"]] R7M = [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "S2"], ["CB", "SG", "S2", "C4"], ["SG", "S2", "C4", "C5"], ["S2", "C4", "C5", "C6"]] V1M = [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "S2"], ["CB", "SG", "S2", "C4"], ["SG", "S2", "C4", "N2"]] M1M = [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "C4"], ["CB", "SG", "C4", "C5"], ["C5", "N2", "C8", "C9"]] I1M = [["N", "CA", "CB", "SG"], ["CA", "CB", "SG", "CD"], ["CB", "SG", "CD", "CE"], ["SG", "CD", "CE", "NZ"], ["CD", "CE", "NZ", "C3"], ["CE", "NZ", "C3", "C2"]] TOC = [["N", "CA", "CB1", "CG1"]] +DCN = [["N", "CA", "CB", "CG"], ["CA", "CB", "CG", "ND1"], ["CD2", "NE2", "Cu1", "N01"]] diff --git a/chilife/data/rotamer_libraries/defaults.toml b/chilife/data/rotamer_libraries/defaults.toml index c6ea2d1b..0e9fd654 100755 --- a/chilife/data/rotamer_libraries/defaults.toml +++ b/chilife/data/rotamer_libraries/defaults.toml @@ -1,4 +1,3 @@ -DHC = ["DHC"] I1M = ["I1M"] M1M = ["M1M"] R1M = ["R1M"] @@ -6,3 +5,4 @@ R7M = ["R7M"] TOC = ["TOC"] TRT = ["TRT"] V1M = ["V1M"] +DCN = ["DCN"] diff --git a/chilife/data/rotamer_libraries/spin_atoms.json b/chilife/data/rotamer_libraries/spin_atoms.json index 119ad000..fff1f585 100755 --- a/chilife/data/rotamer_libraries/spin_atoms.json +++ b/chilife/data/rotamer_libraries/spin_atoms.json @@ -77,14 +77,6 @@ 0.5 ] }, - "DHC": { - "spin_atoms": [ - "Cu1" - ], - "spin_weights": [ - 1.0 - ] - }, "V1A": { "spin_atoms": [ "N3", diff --git a/chilife/data/rotamer_libraries/user_rotlibs/DCNip2_drotlib.zip b/chilife/data/rotamer_libraries/user_rotlibs/DCNip2_drotlib.zip new file mode 100644 index 00000000..e9781a8d Binary files /dev/null and b/chilife/data/rotamer_libraries/user_rotlibs/DCNip2_drotlib.zip differ diff --git a/chilife/data/rotamer_libraries/user_rotlibs/DCNip4_drotlib.zip b/chilife/data/rotamer_libraries/user_rotlibs/DCNip4_drotlib.zip new file mode 100644 index 00000000..f949f640 Binary files /dev/null and b/chilife/data/rotamer_libraries/user_rotlibs/DCNip4_drotlib.zip differ diff --git a/tests/test_Scoring.py b/tests/test_Scoring.py index 2857f2c8..56521e43 100644 --- a/tests/test_Scoring.py +++ b/tests/test_Scoring.py @@ -34,7 +34,7 @@ def test_efunc(func): @pytest.mark.parametrize('func', lj_funcs) def test_efunc_dlabel(func): - dSL = chilife.dSpinLabel('DHC', (28, 32), protein, eval_clash=False) + dSL = chilife.dSpinLabel('DHC', (28, 32), protein, eval_clash=False, rotlib='test_data/DHC') test = func(dSL) ans = np.load(f'test_data/d{func.__name__}.npy') np.testing.assert_almost_equal(test, ans, decimal=4) diff --git a/tests/test_chiLife.py b/tests/test_chiLife.py index f98972bf..347bb39b 100755 --- a/tests/test_chiLife.py +++ b/tests/test_chiLife.py @@ -116,7 +116,7 @@ def test_distance_distribution(args, kws, expected): def test_distance_distribution_dep(): ans = np.load('test_data/dependent_dist.npy') SL1 = chilife.SpinLabel('R1M', 295, anf) - SL2 = chilife.dSpinLabel('DHC', (233, 237), anf) + SL2 = chilife.dSpinLabel('DHC', (233, 237), anf, rotlib='test_data/DHC') r = np.linspace(2.5, 35, 256) P1 = chilife.distance_distribution(SL1, SL2, r) P2 = chilife.distance_distribution(SL1, SL2, r, dependent=True) @@ -308,7 +308,7 @@ def test_MMM_dd(key): def test_save(): L20R1 = chilife.SpinLabel("R1C", 20, protein) S238T = chilife.RotamerEnsemble("THR", 238, protein) - A318DHC = chilife.dSpinLabel("DHC", [318, 322], protein) + A318DHC = chilife.dSpinLabel("DHC", [318, 322], protein, rotlib='test_data/DHC') chilife.save(L20R1, S238T, A318DHC, protein, KDE=False) @@ -481,4 +481,4 @@ def test_rl_speed(): def test_rotlib_info(): chilife.rotlib_info('R1M') - chilife.rotlib_info('DHC') + chilife.rotlib_info('DCN') diff --git a/tests/test_dSpinLabel.py b/tests/test_dSpinLabel.py index 42c0bc2a..10995e8d 100755 --- a/tests/test_dSpinLabel.py +++ b/tests/test_dSpinLabel.py @@ -7,7 +7,7 @@ protein = mda.Universe("test_data/1ubq.pdb", in_memory=True) gb1 = mda.Universe("test_data/4wh4.pdb", in_memory=True).select_atoms("protein and segid A") -SL2 = xl.dSpinLabel("DHC", [28, 28+4], gb1) +SL2 = xl.dSpinLabel("DHC", [28, 28+4], gb1, rotlib='test_data/DHC') def test_add_dlabel(): @@ -90,7 +90,7 @@ def test_centroid(): def test_side_chain_idx(): - SL3 = xl.dSpinLabel("DHC", [28, 32], gb1) + SL3 = xl.dSpinLabel("DHC", [28, 32], gb1, rotlib='test_data/DHC') ans = np.array(['CB', 'CG', 'CD2', 'ND1', 'NE2', 'CE1', 'CB', 'CG', 'CD2', 'ND1', 'NE2', 'CE1', 'Cu1', 'O3', 'O1', 'O6', 'N5', 'C11', 'C9', 'C14', 'C8', 'C7', 'C10', 'O2', 'O4', 'O5'], dtype=' 0 @@ -221,4 +221,4 @@ def test_dihedrals(): ans = np.array([[-2.97070555, 2.20229457, -2.5926639 , -1.21838379, -2.07361964, -2.74030998], [-2.94511378, 2.18546192, -2.59115287, -1.2207707 , -2.05741481, -2.73392102]]) - np.testing.assert_almost_equal(SL2.dihedrals, ans) \ No newline at end of file + np.testing.assert_almost_equal(SL2.dihedrals, ans) diff --git a/chilife/data/rotamer_libraries/user_rotlibs/DHCip2_drotlib.zip b/tests/test_data/DHCip2_drotlib.zip similarity index 100% rename from chilife/data/rotamer_libraries/user_rotlibs/DHCip2_drotlib.zip rename to tests/test_data/DHCip2_drotlib.zip diff --git a/chilife/data/rotamer_libraries/user_rotlibs/DHCip4_drotlib.zip b/tests/test_data/DHCip4_drotlib.zip similarity index 100% rename from chilife/data/rotamer_libraries/user_rotlibs/DHCip4_drotlib.zip rename to tests/test_data/DHCip4_drotlib.zip