Repository navigation
Fix #480: Allow CIF labels to differ from the java field name - #482
Merged
Merged
Conversation
…n CIF output CIF categories are represented as a simple bean, typically extending AbstractBean. By default, all fields from the bean are taken as the CIF labels. Fields may be omitted by annotating them as @IgnoreField. The CIF label for a field may be changed by defining a function, `static Map<String,String> getCIFLabelMap();`, mapping from the field's name to the correct label. This commit also changes the MMCIFFileTools.toMMCIF method to be generic, so that we enforce at compile time that all loop rows must be of the same type.
This replaces the short-lived getCIFLabelMap static function. It lets you associate the label directly with the applicable field
Contributor
|
This is awesome! Couldn't we use these annotations also while parsing the files? (not only when writing them). For instance there's a few fields that contain square brackets, e.g. |
Contributor
|
I'm working in using the annotations also from the cif parser. I'll pull request some commits to your branch when I'm ready. |
Contributor
|
I'll merge this in. I'll then add a new pull request to deal with reading mmcif files using the new tags. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This provides a general solution to the problem in #480, which is that some CIF labels contain characters not permitted in java identifiers (like hyphens). Thus, a mechanism is needed for mapping java fields to the correct identifier for cases like
_symmetry.space_group_name_H-Mwhen writing to mmCIF.This is implemented by adding two annotations.
@CIFLabel(label="str")causes the cif property to be_category.str.@IgnoreFieldcauses the field to be ignored entirely.This pull also changes the MMCIFFileTools.toMMCIF method to be generic,
so that we enforce at compile time that all loop rows must be of the same type. The old method is deprecated (and should be backwards compatible if I understand type erasure correctly).