Skip to content
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

Danpf/add resonance rcsb mmtf spec v1.1 #23

Merged
merged 18 commits into from
Mar 1, 2019

Conversation

danpf
Copy link
Collaborator

@danpf danpf commented Oct 22, 2018

This will set us up to be able to handle rcsb spec v 1.1.

This isn't ready yet:
todolist:

  • tests for reading new resonance files
    - [ ] test for transforms (BioAssembly wasn't a vector of vectors)
  • the spec needs new files. I'll add some.
  • tests for the 4 possible ways to have resonance (detailed in v1.1 spec)
    - [ ] tests for output of to_string methods
  • tests for ok-ing missing group entries (bondAtomList no longer required etc).

I haven't tested if this works yet. just made a nice starting point.

solves #19

Adds compatibility with mmtf v1.1 and adds to string methods for
verbosity + debugging.
Copy link
Collaborator

@gtauriello gtauriello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for starting work on this already. This is great. See below for code-related comments.

//
// Based on mmtf_c developed by Julien Ferte (http://www.julienferte.com/),
// Anthony Bradley, Thomas Holder with contributions from Yana Valasatava,
// Gazal Kalyan, Alexander Rose.
// Gazal Kalyan, Alexander Rose, and Daniel Farrell.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea with the "mmtf_c" part was to give credit to the people that worked on the rcsb/mmtf-c code. I would say that your name belongs to the "authors of this code" section further up... ;-)
And this may also be the case in many other files. Let me also use this to thank you very much for all your contributions!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha okay will do! You're welcome, it's a great project, I'm happy to contribute.

std::vector<int32_t> chainIndexList;
float matrix[16];
std::vector<int32_t> chainIndexList;
std::vector<std::vector<float>> matrices;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a misunderstanding here. The matrix of the Transform object is a 4x4 array (i.e. 16 floats as it was before). See also here: https://github.com/rcsb/mmtf/blob/v1.0/spec.md/#bioassemblylist
The BioAssembly object contains a list of those Transform objects and this is already the case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're totally right. I don't know what I was thinking!

groupName == c.groupName &&
singleLetterCode == c.singleLetterCode &&
chemCompType == c.chemCompType);
}

std::string
as_string() const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the use-case of these to_string() methods? Debugging? How about implementing operator<< instead? The implementation could even go into a separate header (only declare a friend here) which is optional to include (e.g. <mmtf/debug.hpp>).

Copy link
Collaborator Author

@danpf danpf Oct 23, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debugging, or general reporting.

I prefer to_string/as_string, that's really the only reason. We could move everything to a new file, but these functions don't really add much bloat. If you are passionate about the << operator or the extra file I can switch to that, i just think it is a messier implementation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @danpf. No really strong feelings here, but my general take:

  • I think these methods should have documentation which states their purpose
  • I think adding these methods should be a separate pull request
  • I think operator<< is cleaner

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I'll take out all the string methods before this gets merged!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @speleo3. The operator<< is the standard C++ way for something like this and anything else would be confusing. Plus the implementation is almost identical since you are using streams anyways. If the string output looks decent, it can stay in the class as the standard string representation. Otherwise, I would also vote for having it in a separate header.

@danpf
Copy link
Collaborator Author

danpf commented Nov 13, 2018

Good for review

@danpf
Copy link
Collaborator Author

danpf commented Dec 11, 2018

bump for this and other prs : )

@gtauriello
Copy link
Collaborator

@danpf my apologies for the delay. I have been extremely busy lately. I hope to get to this soon. Thanks for your patience.

@danpf
Copy link
Collaborator Author

danpf commented Feb 19, 2019

updated to be compatible with new master!

Copy link
Collaborator

@gtauriello gtauriello left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am ok with all the changes and added some cleanup on top of it.

My only possible concern is whether any v1.0 compatible decoder can still read our files (see comment in #19). The only possible problem there was the ambiguity on whether it was ok to drop the bond lists in the group. Our decoder was not ok with it (it is now), but one may argue that we were too restrictive in interpreting the 1.0 spec. In short: all good for me...

Basically, if no one objects, I will merge those changes into master.

@gtauriello gtauriello merged commit 5ed7c20 into rcsb:master Mar 1, 2019
gtauriello pushed a commit to gtauriello/mmtf-cpp that referenced this pull request Mar 1, 2019
* Support for binary strategy 16 (Run-length encoded 8-bit array)
* Added bondResonanceList field (global and per-group)
* Made groupType.bondAtomList & groupType.bondOrderList optional
* Updated version string in StructureData
* Extended unit tests for bonds (incl. new test MMTF files with resonance fields)

Note that we can write files that our 1.0 decoder cannot read (although the
specs were ambiguous there) when having groups without bonds or otherwise empty
groupType.bondAtomList or groupType.bondOrderList. Those fields were expected to
exist in any MMTF file, while now they are optional and will not be written
unless there is data in them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants