Skip to content

Commit

Permalink
Updated MDAnalysis select_atoms syntax in code and tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerjereddy committed Dec 17, 2015
1 parent 5c2e8ed commit ccb47fe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions diffusion_analysis.py
Expand Up @@ -261,9 +261,9 @@ def mean_square_displacement_by_species(coordinate_file_path, trajectory_file_pa
if not contiguous_protein_selection:
MDA_residue_selection_dictionary = {}
for particle_name, selection_string in dict_particle_selection_strings.iteritems():
MDA_selection = universe_object.selectAtoms(selection_string)
MDA_selection = universe_object.select_atoms(selection_string)
MDA_selection_residue_list = MDA_selection.residues #have to break it down by residues, otherwise would end up with centroid of all particles of a given name
list_per_residue_selection_objects = [residue.selectAtoms(selection_string) for residue in MDA_selection_residue_list] #the MDA selection objects PER residue
list_per_residue_selection_objects = [residue.select_atoms(selection_string) for residue in MDA_selection_residue_list] #the MDA selection objects PER residue
MDA_residue_selection_dictionary[particle_name] = list_per_residue_selection_objects

def centroid_array_production(current_MDA_selection_dictionary): #actually my modification of this for the github workflow won't work--it will find the centroid of ALL the particles with the same name
Expand All @@ -275,7 +275,7 @@ def centroid_array_production(current_MDA_selection_dictionary): #actually my mo
return dictionary_centroid_arrays

else: #dealing with proteins, where we don't want a breakdown by residue
protein_selection = universe_object.selectAtoms(contiguous_protein_selection)
protein_selection = universe_object.select_atoms(contiguous_protein_selection)


dict_MSD_values = {'MSD_value_dict':{},'MSD_std_dict':{},'frame_skip_value_list':[]} #for overall storage of MSD average / standard deviation values for this replicate
Expand Down
4 changes: 2 additions & 2 deletions test_diffusion_analysis.py
Expand Up @@ -119,10 +119,10 @@ def test_protein_centroid_data_structure(self):
universe_object = MDAnalysis.Universe(self.simple_gro_path, self.simple_xtc_path)
protein_centroids = []
for i in range(5):
prot_sele = universe_object.selectAtoms('bynum {}:{}'.format(i*18+1, (i+1)*18) )
prot_sele = universe_object.select_atoms('bynum {}:{}'.format(i*18+1, (i+1)*18) )
protein_centroids.append(prot_sele.centroid())
# now get the same data from the diffusion_analysis script
all_prot_sele = universe_object.selectAtoms('bynum 1:90')
all_prot_sele = universe_object.select_atoms('bynum 1:90')
num_protein_copies = 5
dictionary_centroid_arrays = diffusion_analysis.centroid_array_production_protein(all_prot_sele, num_protein_copies )
# ..and compare
Expand Down

0 comments on commit ccb47fe

Please sign in to comment.