cyvcf2 icon indicating copy to clipboard operation
cyvcf2 copied to clipboard

INFO property for Variant class

Open hammer opened this issue 3 years ago • 4 comments

For a variant v it's nice to be able to say v.FORMAT and to see the available fields names. Would it be difficult to do the same for v.INFO?

hammer avatar Feb 14 '21 14:02 hammer

Of course [k for k, _ in v.INFO] is an easy workaround for now. It would be nice if v.INFO and v.FORMAT were a bit more consistent though.

hammer avatar Feb 14 '21 14:02 hammer

I think there's a v.INFO.keys() as well. the difference is that INFO behaves like a dict, but FORMAT does not. probably would have been better to make them behave similarly, but this instead matches the underlying format more closely.

brentp avatar Feb 14 '21 14:02 brentp

Ah I should have mentioned that I tried v.INFO.keys() and got AttributeError: 'cyvcf2.cyvcf2.INFO' object has no attribute 'keys', which was relatively surprising to me given its dict-like interface.

hammer avatar Feb 14 '21 20:02 hammer

In that case, I'd accept a PR that implements INFO.keys()

brentp avatar Feb 14 '21 20:02 brentp