Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignacia Echeverria authored and Ignacia Echeverria committed Jun 21, 2024
1 parent 60022ad commit 0fb9baf
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions pyext/src/analysis_trajectories.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,34 @@
mpl.rcParams.update({"font.size": 10})

restraints = [
("ConnectivityRestraint", "CR","Connectivity_restraint"),
("ExcludedVolumeSphere", "EV","ExcludedVolume_restraint"),
("GaussianEMRestraint", "EM3D","EM_restraint"),
("DistanceRestraint_Score", "DR","Distance_restraint"),
("ResidueBindingRestraint_score", "BR","ResidueBinding_restraint"),
("OccamsPositionalRestraint_Score","OccPos","OccamsPos_restraint"),
("pEMapRestraint_Score","pEMap","pEMAP_restraint"),
("DOPE_Restraint_score","DOPE","DOPE_restraint"),
("MembraneExclusionRestraint","MEX","MembraneExclusion_restraint"),
("MembraneSurfaceLocation","MLS","MembraneSurfaceLocation_restraint"),
("CrossLinkingMassSpectrometryRestraint_Data_Score","XL","XLs_restraint"),
("CrossLinkingMassSpectrometryRestraint_Data_Score","atomic_XL","atomic_XLs_restraint"),
("OccamsRestraint_Score","Occ","Occams_restraint")
("ConnectivityRestraint", "CR", "Connectivity_restraint"),
("ExcludedVolumeSphere", "EV", "ExcludedVolume_restraint"),
("GaussianEMRestraint", "EM3D", "EM_restraint"),
("DistanceRestraint_Score", "DR","Distance_restraint"),
("ResidueBindingRestraint_score", "BR","ResidueBinding_restraint"),
("OccamsPositionalRestraint_Score","OccPos", "OccamsPos_restraint"),
("pEMapRestraint_Score","pEMap", "pEMAP_restraint"),
("DOPE_Restraint_score","DOPE", "DOPE_restraint"),
("MembraneExclusionRestraint", "MEX", "MembraneExclusion_restraint"),
("MembraneSurfaceLocation", "MLS", "MembraneSurfaceLocation_restraint"),
("CrossLinkingMassSpectrometryRestraint_Data_Score", "XL", "XLs_restraint"),
("CrossLinkingMassSpectrometryRestraint_Data_Score", "atomic_XL", "atomic_XLs_restraint"),
("OccamsRestraint_Score", "Occ", "Occams_restraint")
]

def generate_n_distinct_colors(n):
# Generate a palette of N distinct colors using matplotlib's HSV colormap
colors = plt.cm.hsv(np.linspace(0, 1, n))
return colors


color_palette = generate_n_distinct_colors(100)

def worker(task):
method, args = task
return method(*args)


class ParallelProcessor:
def __init__(self):
self.manager = multiprocessing.Manager()
Expand All @@ -56,6 +58,7 @@ def parallel_process(self, tasks):
results = pool.map(worker, tasks)
return results


class AnalysisTrajectories(object):
def __init__(
self,
Expand Down Expand Up @@ -114,7 +117,7 @@ def __init__(
self.number_models_out = number_models_out
self.rerun = False

# Create analysis dir if missing
# Create analysis dir if missing
if not os.path.isdir(self.analysis_dir):
os.mkdir(self.analysis_dir)

Expand Down Expand Up @@ -446,7 +449,7 @@ def read_stat_files(self):

# Execute the tasks in parallel
results = processor.parallel_process(tasks)

def read_stats_detailed(self, traj, stat_files):
"""
Detailed reading of stats files that includes
Expand Down Expand Up @@ -2179,5 +2182,4 @@ def get_str_match(self, strs):
else:
return strs[0]




0 comments on commit 0fb9baf

Please sign in to comment.