[Biopython-dev] [Bug 3046] PhyloXML, please define get/set methods
bugzilla-daemon at portal.open-bio.org
bugzilla-daemon at portal.open-bio.org
Fri Apr 9 17:18:49 UTC 2010
http://bugzilla.open-bio.org/show_bug.cgi?id=3046
------- Comment #9 from eric.talevich at gmail.com 2010-04-09 13:18 EST -------
(In reply to comment #7, Peter)
> Regarding PhyloXML, would it fit to rename "get_alignment" as "to_alignment"?
> That is a fairly common naming convention.
That's done in GitHub now:
http://github.com/biopython/biopython/commit/22cd408c4433434472d12a5959ecc9d347c03660
(In reply to comment #6, myself)
> > Would you use a Phylogeny method called
> > add_alignment, taking something like a Phylip character matrix?
I still think an "add_alignment" method on Phylogeny would be useful, but we
can start with a cookbook on the wiki until we're confident in the right way to
do it.
(In reply to comment #5, Joel)
> There have long been built-in get/sets in python via __setattr__() and
> __getattribute__(). That's where the code I sent should live. Putting code > to get and especially to set in those methods means that a user doesn't have
> to look up whatever classes were defined for attributes (e.g. like finding
> that 'color' is called 'BranchColor') and doesn't need to know that
> taxonomies and properties are only set through appending through lists.
On the mailing list we decided that branch color was a special case for
allowing a shortcut, because RGB triples and 24-bit hex strings are
well-established ways to represent color codes. Branch width is already just a
float, so no problem there. The rest of the attributes are special PhyloXML
classes, and I think the right solution there is for me to write documentation
and for users to read it.
But the behavior of taxonomies, properties and the other sometimes-plural
attributes should be fixed: they already support singular getters for
one-element lists, so there should be corresponding setters that
(a) put one element in the list if it's empty
(b) replace the element in the list if there's only one
(c) raise an exception if there are already multiple elements in the list
I'm leaving this bug open for that.
--
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Biopython-dev
mailing list