Closed dmichalak closed 5 months ago
The problem should be gone in the latest commit. Please try and let me know if I can close the issue.
Note that most of the functions that allow to also store/save particle lists in relion format have limited possibilities to specify versions, pixel size, subtomos path etc. One can always use emmotl format first and then convert from emmotl to relion - this allows to specify way more parameters.
Yes that fixed it. Thank you for the info as well.
Dennis
Hello, I'm running through the gapstop tutorial dataset and using
tm_processing.ipynb
. In this notebook,tmana.scores_extract_particles
hasoutput_type="emmotl"
. Changing this to"relion"
produces the following error.Error message
``` --------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[25], line 1 ----> 1 tmana.scores_extract_particles( 2 scores_map = scores, 3 angles_map = angles, 4 angles_list = angle_list, 5 tomo_id = 126, 6 particle_diameter = 20, 7 object_id=None, 8 scores_threshold = 0.08, 9 sigma_threshold=None, 10 cluster_size=None, 11 n_particles=None, 12 output_path="particle_list.em", 13 output_type="relion", 14 angles_order="zxz", 15 symmetry="c13", 16 angles_numbering=0, 17 ) File ~/src/cryoCAT/cryocat/tmana.py:251, in scores_extract_particles(scores_map, angles_map, angles_list, tomo_id, particle_diameter, object_id, scores_threshold, sigma_threshold, cluster_size, n_particles, output_path, output_type, angles_order, symmetry, angles_numbering) 249 elif output_type == "relion": 250 rel_motl = cryomotl.RelionMotl(motl.df) --> 251 rel_motl.write_out(output_path=output_path) 252 else: 253 raise ValueError(f"The output motl type {output_type} is not currently supported.") File ~/src/cryoCAT/cryocat/cryomotl.py:2979, in RelionMotl.write_out(self, output_path, write_optics, tomo_format, subtomo_format, use_original_entries, keep_all_entries, version, add_object_id, add_subunit_id, binning, pixel_size, optics_data) 2909 def write_out( 2910 self, 2911 output_path, (...) 2922 optics_data=None, 2923 ): 2924 """This function converts `self.df` DataFrame to a DataFrame in Relion format and writes it out as a starfile. 2925 2926 Parameters (...) 2977 2978 """ -> 2979 relion_df = self.create_relion_df( 2980 use_original_entries=use_original_entries, 2981 keep_all_entries=keep_all_entries, 2982 version=version, 2983 add_object_id=add_object_id, 2984 add_subunit_id=add_subunit_id, 2985 tomo_format=tomo_format, 2986 subtomo_format=subtomo_format, 2987 binning=binning, 2988 pixel_size=pixel_size, 2989 adapt_object_attr=False, 2990 ) 2992 if write_optics: 2993 optics_df = self.prepare_optics_data(use_original_entries, optics_data, version) File ~/src/cryoCAT/cryocat/cryomotl.py:2877, in RelionMotl.create_relion_df(self, tomo_format, subtomo_format, use_original_entries, keep_all_entries, version, add_object_id, add_subunit_id, binning, pixel_size, adapt_object_attr) 2875 return relion_df 2876 else: -> 2877 relion_df = self.prepare_particles_data( 2878 tomo_format=tomo_format, subtomo_format=subtomo_format, version=version, pixel_size=pixel_size 2879 ) 2880 if "rlnRandomSubset" in relion_df.columns: 2881 relion_df.loc[self.df["subtomo_id"].mod(2).eq(0).to_numpy(), "rlnRandomSubset"] = 2 File ~/src/cryoCAT/cryocat/cryomotl.py:2671, in RelionMotl.prepare_particles_data(self, tomo_format, subtomo_format, version, pixel_size) 2667 relion_df = relion_df.drop(["tomo_id", "subtomo_id"], axis=1) 2669 relion_df.loc[:, shifts_name] = np.zeros((relion_df.shape[0], 3)) -> 2671 if version < 4.0: 2672 relion_df["rlnPixelSize"] = pixel_size 2674 return relion_df TypeError: '<' not supported between instances of 'NoneType' and 'float' ```It looks like there is a RELION
version
parameter that isn't being set that determines how the output star file should be formatted.Dennis