Repository navigation
Expression atlas - #573
Expression atlas#573
Conversation
If a dataset can't be read, it's re-downloaded. This is a change from checking if the file existed.
|
Changing to WIP since I'd like to improve failure handling before this gets merged. |
|
That should do it. Ready for review |
|
|
||
| download_experiment(accession) | ||
|
|
||
| print("Downloaded {} to {}".format(accession, experiment_dir.absolute())) |
There was a problem hiding this comment.
Hm, the default logging level is warning, not info.
It's strange to use logg.warn as we don't want to print WARNING, so, I guess, simply using print is fine... (it won't appear in a logging file, but no one is using this functionality anyway, so we can drop it...)
Can you add a comment on that one can change settings.datasetsdir?
There was a problem hiding this comment.
I'd gone with printing for downloading since I believe the progress bars go to stdout anyways, so it's not adding noise to a previously silent operation.
Also, I had been thinking about trying to make logging a bit more consistent and easy to implement (#472), and might pick that up once I've got bandwidth.
Should the comment about settings.datasetdir go into the function docs or the printed message?
There was a problem hiding this comment.
I thought about the printed message...
Making logging more consistent would be terrific. :D
|
Isaac, this is great, thank you so much! Regarding the default for the dataset directory. I like this solution! Very small edits in addition to what I commented in the code:
Notes:
|
These tests get skipped by default, unless pytest is run with `pytest --internet-tests`. This is because they take a while to run, and could cause spurious failed builds on travis. I've move `conftest.py` to the root of the repository since I was getting errors for the added flags with it's previous position. It looked like the file under `scanpy/test/conftest.py` might not have been getting evaluated, as documented by under the [`confcutdir`](https://docs.pytest.org/en/latest/reference.html#confval-confcutdir) config variable for pytest. I tried setting that as well, but it didn't seem to work.
Definitely agree it's good to specify it's from EBI. Would
Changed the name. It looks like the main docs aren't being generated from
Changed. Does this mean config changes should also happen in this PR? I think this may cause trouble (HPC environments with small To be able to put off adding the config for now, we could temporarily special case a |
|
Oh, I also added tests for example dataset loading since checking they worked manually was a pain. These won't run by default (they take a while, and can fail for network access reasons), but will run with Also travis failed this for |
| """Default cache directory. | ||
| """ | ||
|
|
||
| datasetdir = Path.home() / "scanpy_datasets" |
There was a problem hiding this comment.
Veto, see #558. I consider creating ~/something-visible a completely unacceptable default for a library.
My personal hell certainly includes dozens of libraries and applications putting all kinds of crap in unhidden directories in my home. All of them have a different way to configure that location or none at all. Chills me right to the core.
I think it would be best to leave this change out of this PR. We can do a separate one once we have decided on how to tackle this.
There was a problem hiding this comment.
Sure, I also think it would be a good idea to leave changing the default to a separate PR.
You'll see I initially made this a non-breaking change (datasetdir = Path("./data")), just changed to this going off feedback from Alex.
I'm gonna wait on actually modifying the code for a minute to make the eventual rebase easier.
There was a problem hiding this comment.
OK, great. I think the changes to the default (./data → ~/???) should be in a PR that also changes what’s printed on download/read of such files, and we can figure out there how to detect if we’re on a linux server (where ~/scanpy_data would make sense) or on a desktop system (where it doesn’t)
As an aside: Windows Explorer’s default view doesn’t show you your %HOME%, so ~/scanpy_datasets wouldn’t even be visible there. @falexwolf, @ivirshup: In summary: This topic requires discussion, it’s more complex than it seems, and I’ve read up a lot on it, so I think you should either leave the decision to me or let me explain it to you in all its tiring depth. I’ll do it if you think it’s worth your time.
There was a problem hiding this comment.
Would you mind sharing some links which explain why this is important? I'll admit, it does not seem very complex to me at the moment, but I also don't know much about this topic.
Also, a more general question, does scanpy work on windows?
There was a problem hiding this comment.
Sadly there’s no writeup. It’s a lot of different observations I made and discussions in different projects. If you search XDG_CONFIG_HOME and XDG_CACHE_HOME you’ll find a lot of people requesting that (e.g. mwaskom/seaborn#1530)
The question “why not” is always answered with “we didn’t think about it” or “we followed what others did (without thinking about it)”, and the answer to “why don’t you change” is always “we have been doing it for too long, people will get confused”. So I won’t wait until somebody is able to say the latter about scanpy.
So yeah: What appdirs and similar modules do as well as the discussions in those modules’ issue trackers is pretty much the best one can get as a writeup. One then cross-references what one’s library/app needs to write to some global location (executables? config? cache? logs? documents?) with the locations those modules provide. Then one saves those files there instead of coming up with something themselves because many people have thought a long time about this to create that module.
About Windows: Yes! I think it’s important to keep it that way. I recently read this blog post and fully agree with the author:
[…] a Ruby that works well on native Windows will help Ruby adoption a lot and eliminate drain to other frameworks. Installing a whole brand new OS is just too much of a barrier. Just install Linux is not a solution.
The same applies to everything of course. Many just start out and aren’t fed up by Windows enough to ditch it, so making the start on Windows as smooth as possible helps adoption by new people a lot.
There was a problem hiding this comment.
I'll check out that issue.
I have nothing against windows support, I just can't help on any issues related to it. I was mostly wondering if all the dependencies worked on windows, and if there's a reason there aren't appveyor builds.
There was a problem hiding this comment.
This requested change is resolved now, right?
|
Just to recap what's left to be resolved here
|
| """Default cache directory. | ||
| """ | ||
|
|
||
| datasetdir = Path.home() / "scanpy_datasets" |
There was a problem hiding this comment.
Would you mind sharing some links which explain why this is important? I'll admit, it does not seem very complex to me at the moment, but I also don't know much about this topic.
Also, a more general question, does scanpy work on windows?
|
OK guys, I'm happy with all that! I suggested Regarding making a settings a class: happy to if you feel you want to do that already in this PR. Really just change |
This will definitley cause errors on master. Let's call it an excuse to increase test coverage? Basically, I just went through making import patterns compatable with the new settings class. Those imports are pretty ugly at the moment, and there might be a better way to do them.
|
Wow, you already did it! Fantastic! 😄 |
|
Went with properties for everything except private variables. Took a little longer than 10 minutes, but I think it's mostly there. Got all the tests to pass on my machine, but I bet other things will fail. I also haven't tested what'll happen with the docs, though I did have to modify some of the documentation code.
|
|
Assuming this build passes, is this good to go? |
Yes, now that you made everything a property, I would have expected it to take much longer than 10 minutes. It's great that you did! I'll make some tiny additions and merge. |
| from .settings import set_figure_params | ||
| from ._settings import settings | ||
|
|
||
| set_figure_params = settings.set_figure_params |
There was a problem hiding this comment.
Ok, got, you made it a member function...
There was a problem hiding this comment.
I made it a method for the class in anticipation of making the updated rc_params a dict in the object, then using that dict with mpl.rc_context
|
Ah, I cannot push to your fork it seems. I think you would have had to set "allow maintainers to edit" or something on the right-hand side. I'm simply merging this and editing after that. |
|
Here we go: a06c304 |
|
Oh, huh, I thought allowing modifications was on by default. My bad.
I figured it'd be good to with everything being consistent. Plus documentation for the settings is now available through |
|
Oh! I keep forgetting to ask: Why did the original scanpy config file get removed? |
Of course, it's much better to be consistent. I was just suggesting a quick solution that wouldn't have been worse than the current one... ;) A complete automatic documentation is now also available from scanpy config: At some point almost 2 years ago, I removed a lot of stuff that I didn't think was essential to clean up the project. It was just an element of that. I'm very happy to introduce it again; these days, the project is much more major and indeed has many config options (there were only few at the time) and hence it would indeed merit having a config file. |
|
Only strange thing is the To be more verbose, one could also change all the cryptic abbreviations to: or something. It's great that this is super easy without breaking backwards compat now that everything is properties. :) |
It looks like instance methods can't have new attributes assigned (probably have slots). It's possible the class Foo(object):
def bar(self):
return 1
# Setting an attribute on the method of an instance raises an error
Foo().bar.x = 1
# AttributeError: 'method' object has no attribute 'x'
# Setting an attribute on the method of a class seems fine:
Foo.bar.x = 1
Foo().bar.x
# 1 |
Expression atlas
Adding an expression atlas downloader to
sc.datasets(proposed in #489).I've punted on replacing where datasets are downloaded by just making it a variable in settings, since it seems contentious where datasets should be downloaded by default #558.
@flying-sheep when I build the docs locally, the link to the expression atlas doesn't format properly on the main
APIpage, but does on it's own page. Any ideas on if we can get that to work?