-
Notifications
You must be signed in to change notification settings - Fork 94
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
feat(#741): Pretty print #742
base: main
Are you sure you want to change the base?
Conversation
…ranscripts, new option to show reverse-chrom strand sequence.
… that are larger than 1 bp.
# Conflicts: # tests/data/cache-py3.hdp
…o big of a cache.
Note: this PR adds two new unit tests. They are pulling a lot of data from UTA and seqrepo, and as such they are slow. Should I tag them and exclude from the CI runs? Also, I did not want to upload an updated cache file for these tests, because the size of the test cache would have jumped from 1MB to ~600MB. |
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Wow, that's pretty neat and it's impressive you were able to do all of that without bringing in any dependencies (other than test framework) From a very quick skim, it looks like you define your own data classes and do a lot of your own maths - I guess the worry would be if HGVS code is wrong, or yours is, or they're just different, then it would render differently than what's internally going on under the hood. Maybe there's no other way to do it, not sure - I'll try and block out some time next week to look over it |
Yes, the One idea is that there could be other renderers that are not text based and that could e.g. create SVG graphics, or other types of visualizations. To enable this, this introduces a model-view-control pattern: The view (renderer) should be decoupled from the data. Therefore the newly added One addition to this is the |
From 8/26 maintainers' meeting: @andreasprlic: yes, please tag to exclude CI testing. Also, we decided to keep the similar function https://github.com/biocommons/hgvs/blob/main/src/hgvs/utils/context.py for now. If someone cares, we can combine functionality later. |
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.
This is amazing. It's way better than src/hgvs/utils/context.py. Thank you.
I have a minor suggestion/request for discussion: Having hgvs.pretty_print and hgvs.pretty as siblings seems a bit confusing, and leads to (IMO) oddities like the renderer importing from a pretty_print.py.
Instead, I think a better structure might be to:
- put everything under pretty
- rename renderer to console
- put the color constants under console
I think that will create a better separate of the backend logic (immediately under pretty/) and the console renderer (under pretty/console/).
What say you?
… on PR comments
… on PR comments, also disabling slow running unit test
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
7486813 | Triggered | PostgreSQL Credentials | d4f2ac4 | docs/contributing.rst | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
…ate too much caching burden.
... with the most recent changes, I believe we are ready for another round of reviews. |
…d with more unit tests.
…. Improved repeat analyzer, that now supports 5' and 3' shuffling.
…on't run repeat analysis where it does not make sense. Starting to add support for non-splign alignments.
…l improvement at the loss of repeat check.
…orientation relative to the transcript by default (can be configured).
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
@andreasprlic I've been playing a bit and I can see this being really useful! A few nit-picks: Suggest changing Advantages are to support any future builds (eg T2T), or DataProviders that only support 1 assembly At the moment, you instantiate 2 assembly mappers for hard-coded 37/38 and then only pick one, using So - change would be to remove This can then remove all the code that tests Off by 1 error at very start of + strand transcript sequence This appears OK with - strand, but on + strand if you pick the 1st base of transcript, eg "NM_198689.2:n.1C>G" it appears the sequence only start rendering 1 base after where it should, eg NM_198689.2 starts with
Exception with intergenic g.HGVS
fix would be to replace it with On the comment
|
…ariants, and only one assembly mapper on pretty print.
Thanks, these are great comments. Thank you for looking into the details of this. Luckily this was easy to address. PrettyPrint now only has one assembly mapper, and I fixed the problem with the first base on the transcript, as well as with intergenic variants. Also added unit tests for these two issues to the test_pretty_print (even if it is disabled for the CI, but it works locally). |
@reece any more requests for changes from your side? |
This (draft) PR is an attempt to add a context-visualization framework on top of the tooling that we already have in hgvs. Unless somebody has a better suggestion for a name, for now I called it "pretty_print".
Features:
Examples:
Here also a screenshot how on the terminal the text can be color coded: