sgkit icon indicating copy to clipboard operation
sgkit copied to clipboard

Link between variable and function to compute it

Open jeromekelleher opened this issue 1 year ago • 2 comments

There doesn't seem to be any link between variables, and how they are computed either in the documentation, or in error messages. For example, I want to get variant_allele_frequency which I can search for in the docs and I find the spec, but this doesn't tell me that I need to call variant_stats to compute it. If I access the variable, I just get an error

    get_prob_dist(ds)
  File "/scratch/jk/work/github/sgkit-publication/src/collect_data.py", line 37, in get_prob_dist
    af = ds.variant_allele_frequency.values[:, 1]
  File "/home/jk/.local/lib/python3.9/site-packages/xarray/core/common.py", line 278, in __getattr__
    raise AttributeError(
AttributeError: 'Dataset' object has no attribute 'variant_allele_frequency'

It would be nice if the error message told me "you need to call sg.variant_stats(ds)

Likewise, I was looking at call_dosage, which I could find no documentation on.

I wonder if there's some sort of automatic annotation we could add to variables that would help with this?

@ravwojdyla I seem to remember you were thinking about things like this before??

jeromekelleher avatar Aug 17 '23 14:08 jeromekelleher