-
Notifications
You must be signed in to change notification settings - Fork 26
Enable RelionSource to be created with no metadata
#522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #522 +/- ##
===========================================
- Coverage 87.17% 87.16% -0.01%
===========================================
Files 108 108
Lines 7984 7987 +3
===========================================
+ Hits 6960 6962 +2
- Misses 1024 1025 +1
Continue to review full report at Codecov.
|
3543145 to
01afc7c
Compare
…gly to populate its metadata
fe6a7c9 to
4b108d3
Compare
|
Squashed down to one commit. @garrettwrong I added a method in |
|
The issue of storing the CTF parameters probably merits a discussion. Right now, as you point out, we store it in two places: The root of the complication is that while we have some filters (like the CTF) that are specified by the forward model (and hence have their parameters as part of the metadata), others are given by our image processing functionality (whitening, phase flipping, downsampling, etc.). This is not so much an issue when all we're doing is processing the data within the framework, but once we want to export (write STAR files) we need to have something that fits into the CTF format again. |
garrettwrong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize this was waiting for me to look at, sorry. Overall this looks good. I made a few comments. I think only one or two things you might consider before sending to Joakim, but I didn't feel strongly enough about them to hold it up.
| # for these columns | ||
| # | ||
| # class attributes of CTFFilter: | ||
| CTFFilter_attributes = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if these would be better as a dictionary mapping between CTFFilter_attributes and CTF_params. They look similar. At least similar enough I had to look if exactly the same...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah there is a one-to-one correspondence. But the two sets of strings are used separately, so I think to do the set_metadata line that follows this line, I'd have to do something like CTFDict.keys(), which I would probably find more confusing if I were a newcomer. Unless I'm missing something
* Refactor ImageSource <-> RelionSource, and change Simulation accordingly to populate its metadata * typo Co-authored-by: Christopher Langfield <[email protected]>
Previously, a
RelionSourcewould automatically look for the following CTF related parameters in the STAR file:If they exist in the STAR file,
self.unique_filtersis populated with aCTFFilterfor each unique combination of the parameters. This filter is constructed directly from the parameters above except for "_rlnDefocusAngle", which is multiplied bynp.pi / 180to convert from degrees to radians.When
filter_indicesis set, behind the scenes, theImageSource.filter_indicessetter reads the properties of theunique_filtersthat were already set:And then reassigns this metadata, even though it has already been read in from the STAR file (which allowed the filters to be created in the first place):
As far as I can tell, this is completely circular except for the "_rlnDefocusAngle", which was changed from degrees to radians during the construction of the filter.
This PR
Allows a
RelionSourceto be created from a STAR file with no metadata, i.e. one column:_rlnImageName. In particular, when aCoordinateSourceis saved (ImageSourcesubclass to represent datasets with coordinate files representing picked particles #489 CoordinateSource -- class factory pattern refactor #520), it creates a STAR file in this format, meaning it can be loaded and saved as aRelionSource.Removes the Relion-specific behavior of the setter method of
ImageSource.filter_indices, which tries to populate the above parameters. Also, the table containing the data types of each Relion field has been moved fromImageSourcetoRelionSource. This relates to Separate Relion-specific defaults fromImageSource#519 where we would like to makeImageSourcemore generalized.Refactors the classmethod
starfile2dfinRelionSourcetopopulate_metadata, and adds some comments for clarity.Changes the default metadata storage of
_rlnDefocusAnglefrom radians to degrees, to agree with how it is represented by Relion. This change is a side effect of removing thefilter_indicessetter, which would repopulate this parameter based on theCTFFilterattribute, which is in radians. Now it keeps the original value read from the STAR file.