{"action":"closed","issue":{"url":"https://api.github.com/repos/linnarsson-lab/loompy/issues/20","repository_url":"https://api.github.com/repos/linnarsson-lab/loompy","labels_url":"https://api.github.com/repos/linnarsson-lab/loompy/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/linnarsson-lab/loompy/issues/20/comments","events_url":"https://api.github.com/repos/linnarsson-lab/loompy/issues/20/events","html_url":"https://github.com/linnarsson-lab/loompy/issues/20","id":274316505,"number":20,"title":"Improved attribute management","user":{"login":"slinnarsson","id":10656387,"avatar_url":"https://avatars0.githubusercontent.com/u/10656387?v=4","gravatar_id":"","url":"https://api.github.com/users/slinnarsson","html_url":"https://github.com/slinnarsson","followers_url":"https://api.github.com/users/slinnarsson/followers","following_url":"https://api.github.com/users/slinnarsson/following{/other_user}","gists_url":"https://api.github.com/users/slinnarsson/gists{/gist_id}","starred_url":"https://api.github.com/users/slinnarsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slinnarsson/subscriptions","organizations_url":"https://api.github.com/users/slinnarsson/orgs","repos_url":"https://api.github.com/users/slinnarsson/repos","events_url":"https://api.github.com/users/slinnarsson/events{/privacy}","received_events_url":"https://api.github.com/users/slinnarsson/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2017-11-15T21:49:02Z","updated_at":"2017-12-24T07:33:44Z","closed_at":"2017-12-24T07:33:44Z","author_association":"CONTRIBUTOR","body":"Ping @gioelelm @pl-ki @kasiletti @JobLeonard \r\n\r\nI have been working on a more pythonic and expressive API for attributes in loompy. Currently we access attributes as follows:\r\n\r\n```python\r\nds.col_attrs[“CellID”]   # get a column attribute\r\nds.row_attrs[“Gene”]   # Get a row attribute\r\n\r\nds.set_attr(“Name”, values, axis=1)   # Set a column attribute\r\nds.set_attr(“Name”, values, axis=0)   # Set a row attribute\r\n\r\nds.delete_attr(“Name”, axis=1)  # Delete a column attribute\r\nds.delete_attr(“Name”, axis=0)  # Delete a row attribute\r\n```\r\n\r\nWe also have convenience access to attributes directly on the LoomConnection object:\r\n\r\n```python\r\nds.Gene  # Happens to be a row attribute\r\n```\r\n\r\nBut this can collide with object attributes, and row/col attributes can collide with each other.\r\n\r\nI want instead to do this::\r\n\r\n```python\r\nds.c.Gene  # Get a column attribute\r\nds.c[“Gene”]  # Get a column attribute\r\n\r\nds.c.Gene = values  # Set a column attribute\r\nds.c[“Gene”] = values  # Set a column attribute\r\n\r\ndel ds.c.Gene  # Delete a column attribute\r\ndel ds.c[“Gene”]  # Delete a column attribute\r\n```\r\n\r\nAnd same for rows via `ds.r`\r\n\r\nI have written the necessary manager for this. It also **lazy-loads** the values, so nothing is loaded until needed, and it keeps track of the corresponding data in HDF5. It **supports slicing**, so you can slice all the attributes at once (I want to use this for an improved scan() method).\r\n\r\nNow, I want to add this to loompy. I can keep `col_attr`,` row_attr`, `set_attr` and `delete_attr` for backwards compatibility. BUT, I can’t keep the direct access attributes (i.e. ds.Gene, ds.Clusters). This will break some code.\r\n\r\nIs it ok? If you agree, I will make the change and let you know when you will need to change from `ds.Gene` to `ds.r.Gene` etc. You also can fix your code right now by changing `ds.Gene` to `ds.row_attrs[“Gene”]` if you want.\r\n"}}
{"actor":{"display_login":"slinnarsson"}}