-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add __str__ and _repr_html_ to Variant #2384
Conversation
Cool! Can you paste in what these look like please so we can have a look? |
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.
Good start, needs some more detail like the site position and the allele counts.
@szhan Let me know if you want some pointers here. |
Codecov Report
@@ Coverage Diff @@
## main #2384 +/- ##
===========================================
- Coverage 93.43% 81.08% -12.35%
===========================================
Files 28 28
Lines 27337 27110 -227
Branches 1247 1245 -2
===========================================
- Hits 25541 21981 -3560
- Misses 1762 5055 +3293
- Partials 34 74 +40
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
You could put |
Should we print out the alleles in some (lexicographically) sorted order? |
The HTML text has really long lines, so it is failing the flake8 test. What should we do? |
I'm not sure why I can't get
EDIT: I had the regexp pattern wrong! |
I've attached a couple of images showing some examples. |
Should we also show the ancestral allele? |
Looks like you can split some of the longest easily enough (no reason to have lines > 100), but there's also a noqa you can put at the end to tell flake8 to ignore it (see further down in the same function). |
Let's show them in the order they're returned by counts = self.counts()
freqs = self.frequencies()
for allele in self.alleles:
print(f"Allele {allele}: {count[allele]} ({freqs[allele] * 100: .2g}%)") |
Looking good, thanks @szhan
|
Actually, I forgot that (a) it might not be all the sample nodes in the ts, if a subset of samples is specified and (b) it is possible to specify non samples to be counted too. I'm therefore not sure of the best phrasing instead of "samples", but we could say |
|
There is already EDIT: Ah! Figured it out! |
Is it clear what the "3" in Also there's a space between the open bracket and the percentage amount, I think? |
All the tests have passed! Updating the change log. |
It's sometime helpful to create a new TS using e.g.
Then making a test case is as simple as
useful? |
Should we add this in separate PR? |
We should split it off to a separate issue at least. |
Should we do that before finishing this PR? |
Let's not bother with it, it's just a utility for testing. @hyanwong can create an to discuss as it's his idea. |
When trying to call
This should be the behaviour we want, right? |
I don't think so, it should be a one-line table with "This variant has not yet been decoded at a specific site,call Variant.decode to set the site" as the content IMO. |
Something like this? ╔═══════════════════════════════════════════════════════════╗ |
Yes, |
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.
LGTM!
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.
LGTM
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.
Awesome! Just a couple of nits.
Fixes #2367