-
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
Implement Variant.__repr__ #2694
Comments
I want to work on this issue. Please give me one chance. I have understood where str is used in Variant. I am very keen to work in open source. Thank you |
Hi @charandeepsinghb and thanks for your interest in tskit! The aim is to add a There is a development guide here: https://tskit.dev/tskit/docs/latest/development.html |
Thanks for your interest in contributing to tskit @charandeepsinghb ❤️ I think we want something simpler than that @benjeffery, just something that shows the raw data held in the variant object literally, like say: def __repr__(self):
d = {
"isolated_as_missing": self.isolated_as_missing,
"site": self.site,
"samples": self.samples,
"alleles": self.alleles,
"genotypes": self.genotypes,
}
return f"Variant({repr(d)})" I think this will do it? Hopefully this will give enough information for debugging without spewing out megabytes of text when the arrays are big, since:
The Python docs for repr say:
So I think this is roughly OK? |
I'm really am sorry to say that I couldn't setup the project in the time available to me, maybe, also I can't set it up in my current system (non root environment to install and setup conda and stuff). I'm really sorry to disappoint you guys. It really meant a lot to me to hear anything from you. I'll for sure try to set it up in future and make some development if it will be possible. For now I can't work on this. although you explained the issue pretty well to me and I understand that how one would need to add a repr for quick inspection while debugging (because you guys explained so well). Thank you for your support. |
No problem @charandeepsinghb, totally understood. Thanks for your interest anyway! |
I'd like to work on this issue! |
Opened PR #2695 I noticed if a site has experienced many mutations the repr() output is still quite large. Do you think leave it as is, or do something to abbreviate the number of mutations? |
The
__str__
implementation of Variant looks nice but is quite unhelpful when you want to quickly inspect the actual values. We should implement a simple__repr__
that gives a string version of the raw values.The text was updated successfully, but these errors were encountered: