Skip to content

Commit

Permalink
updated paths in weighted_density, added b_color_structure module
Browse files Browse the repository at this point in the history
  • Loading branch information
rsexton2 committed Mar 7, 2024
1 parent 02b37a6 commit 5ea1544
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
23 changes: 23 additions & 0 deletions basicrta/gibbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,29 @@ def plot_protein(self, **kwargs):
residues = list(self.residues.keys())
plot_protein(residues, taus, bars, self.prot, **kwargs)

def b_color_structure(self, structure):
taus, bars = self._get_taus()
residues = list(self.residues.keys())
u = mda.Universe(structure)
prot = u.select_atoms('protein and name BB or name CA')
resids = prot.residues.resids

data = np.zeros(len(resids))
for res, t in zip(residues, taus):
ind = np.where(resids == int(res[1:]))[0]
data[ind] = t

u.add_TopologyAttr('tempfactors')
for k in tqdm(range(len(data))):
res = u.select_atoms(f'protein and resid {prot.residues.resids[k]}')
temp = data[k]
res.tempfactors = np.round(temp, 2)

if not outname:
prot.write('result_check/{0}_bcolored_{1}.pdb'.format(pdb, data))
else:
prot.write('result_check/{0}'.format(outname))


class ParallelGibbs(object):
"""
Expand Down
3 changes: 2 additions & 1 deletion basicrta/weighted_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def weighted_densities(self, step=1, top_n=None):
f'wcomp{k}_all_step{step}.dx')
for k in range(self.gibbs.processed_results.ncomp)]
else:
outnames = [f'{self.gibbs.residue}/wcomp{k}_all.dx' for k in
outnames = [(f'basicrta-{self.cutoff}/{self.gibbs.residue}/'
f'wcomp{k}_all.dx') for k in
range(self.gibbs.processed_results.ncomp)]

[den.export(outnames[k]) for k, den in
Expand Down

0 comments on commit 5ea1544

Please sign in to comment.