-
Notifications
You must be signed in to change notification settings - Fork 61
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
Misc core typescripting #3605
Misc core typescripting #3605
Conversation
better if blankStats() does not cast since TS won't check if all the necessary fields are filled when casting improve TS types for feature score stats add jsdoc comments about region stats types we use interbase coords correct stats tests
typescript mst-reflection.ts, might be a tiny bit better than leaving it js improve some ts types some config slot utility types, some better types in mst-reflection.ts StringEnumEditor does not need to use getPropertyType improve more typescripting
Codecov Report
@@ Coverage Diff @@
## main #3605 +/- ##
==========================================
+ Coverage 62.89% 62.91% +0.02%
==========================================
Files 869 866 -3
Lines 30227 30253 +26
Branches 7280 7300 +20
==========================================
+ Hits 19010 19035 +25
+ Misses 11031 11030 -1
- Partials 186 188 +2
... and 17 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I cherry-picked the misc stuff off this branch (1075f3d) and the remainder is the stats code essentially If it helps to decouple these concerns, I think stats estimation could go through a different code path |
example where 'two different return types' are used for the single function, feature density on one but not the other, indicating the stats estimation vs quantitative stats situation https://github.com/GMOD/jbrowse-components/pull/3605/files#diff-9d5632c87842dea801ef5acbc3f15abac30b437769d9b1ace2fc6f86542a752eR254-R263 |
Yes, with the current feature adapter API, we don't know exactly what kind of stats Having different kinds of stats estimation go through different code paths would necessitate some kind of change to the feature adapter API, probably something like |
currently there are 'estimateRegionsStats' used essentially for feature density, though it can also return number of bytes estimated also, and 'getMultiRegionStats' which is used by the quantitative tracks. could potentially rename to estimateMultiRegionStats to be more consistently named, and/or, use a more descriptive word than stats |
Ah, that's a problem. But that's kind of a separate question. Again: in order to avoid the same code path being used for feature density, scores, and (later) histogram bins, it seems like we would need to change the adapter API. Is that what you are thinking? |
I'm open to changing the API, but also don't necessarily understand your proposal to e.g. rename estimateStats to getRegionStats because that would, in the current way things are done, make quantiative and feature density type stats have a single code path again which is what the current approach already IMO properly avoids |
The original design of the data adapters API had two public methods for stats: Looks like about a year ago the But let's focus on where we need to get to: we need a uniform data adapter API that lets (in theory) any data adapter by any track type. The method names need to be accurate for what they do. And also, it sounds like you think it's important for quantitative stats (scores, stddev, etc) and density stats (featureDensity, bytes, precalculated histogram bins, etc) to be separated, so that the kind of stats that are being returned are easier for calling code to understand, is that right? Is the motivation more to make the calling code easier to write (avoid needing to use type guards or other runtime reflection to figure out what is in the returned data), or more for performance? |
@rbuels and I met today we identified that there are (at least) two types of things that the word "stats" refers to, used in different contexts. as a result, we will try to distinguish these two usages by renaming some functions in BaseAdapter quantitative statsQuantitative stats are related to e.g. y-scalebars on the quantitative tracks. We propose rename functions like this
"feature density"-type statsFeature density type stats are related to displaying the "Region too large, zoom in/force load" type messages. We propose renaming functions like this
Note 1. The Note 2. The singular method |
note: also considered splitting feature density type stats into "byte range" stat estimate and "feature density" estimate, but then the display code would need to figure out how to decide which to call the proposals there were that e.g. byte size estimate could be undefined by default, and if some calling code received undefined, it could further call feature density estimation. I proposed not doing this in favor of keeping "getMultiRegionFeatureDensityStats" able to return either a true feature density or a byte range estimate, but if there is a strong feeling for splitting it, let me know |
These are some probably worthwhile core changes split out from the REST adapter PR #3503