-
Notifications
You must be signed in to change notification settings - Fork 244
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
Getter for generic fields in VCFSimpleHeaderLine #1212
Conversation
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.
@Wathis Thanks for contributing to htsjdk! This is a good idea. It's strange that we don't have any mechanism for getting optional fields here. However, your PR doesn't compile because you're returning String
instead of Map<String, String>
.
I've suggested a way of resolving the compilation failure. It would be great if you could add a test to VCFHeaderUnitTest
that just asserts that you get back the values you expect. We like to have coverage of all new code even if it's something simple like this. (The good news is that simple code is usually simple to test...)
@cmnbroad Do you have any thoughts about this? It's weird that there aren't methods to get these. It seems like there isn't even a way to represent optional key/pairs in VCFCompoundHeaderLine
even though it's definitely allowed in the spec
|
||
public String getGenericFields() { |
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.
public String getGenericFields() { | |
/** | |
* @return a map of all pairs of fields and values in this header line | |
*/ | |
public Map<String, String> getGenericFields() { | |
return Collections.unmodifiableMap(genericFields); | |
} |
@lbergelson Yes and sorry for String ;). For unit test, no problem i will do it when i have time! |
@lbergelson I think its fine sense given the current implementation. Ideally, generic field support would live higher in the class hierarchy since all (ID) header lines can have custom attributes. The existing hierarchy only implements them for VCFSimpleHeaderLine derivatives (contig and filter), which is strange. (This is another area that was unified and fixed in my old PR that never got merged). |
I added some test and changed the getter too ! Now it's working for me |
Codecov Report
@@ Coverage Diff @@
## master #1212 +/- ##
==============================================
+ Coverage 68.702% 68.882% +0.18%
- Complexity 8061 8073 +12
==============================================
Files 542 540 -2
Lines 32711 32685 -26
Branches 5533 5527 -6
==============================================
+ Hits 22473 22514 +41
+ Misses 8038 7972 -66
+ Partials 2200 2199 -1
|
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.
@Wathis Thank you! Looks good 👍
Description
Setting a getter for accessing to values like "Description"
Checklist