Repository navigation
Queries fix - #467
Queries fix#467
Conversation
3efb194 to
fc84096
Compare
af52e01 to
5cab263
Compare
|
Looks nice! The singledispatch makes it pretty neat! Could you please add return type annotations? I think I think we could return |
|
|
|
Ah? The code seems like it just returns an empty list when there’s no results. Where is the error thrown? |
|
This is the traceback I get when I receive no results: I guess it has to do with the output expecting 14 values for the |
5cab263 to
a88fbb2
Compare
|
How about an empty Also, I need to look into the arguments to |
a88fbb2 to
a8c15ce
Compare
|
Ha, just saw your PR to |
|
Eh, good question what would be better. I think both work, but if we return an empty one, we have to make sure that the column names and types are still correct. In [4]: bool(pd.DataFrame(dict(a=[])))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-4-5108fad10cc0> in <module>
----> 1 bool(pd.DataFrame(dict(a=[])))
/usr/lib/python3.7/site-packages/pandas/core/generic.py in __nonzero__(self)
1477 raise ValueError("The truth value of a {0} is ambiguous. "
1478 "Use a.empty, a.bool(), a.item(), a.any() or a.all()."
-> 1479 .format(self.__class__.__name__))
1480
1481 __bool__ = __nonzero__
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
In [5]: pd.DataFrame(dict(a=[])).empty
Out[5]: True |
|
I liked returning a data frame for type stability (i.e. this method always returns a data frame). However, you bring up a good point about the columns and dtypes of the data frame being part of it's type. Because it'd add more complexity that it's worth and type stability isn't that much of a thing in python, I've gone ahead with |
| org: str = "hsapiens", | ||
| correction_method: str = "analytical", | ||
| gprofiler_kwargs: dict = {}, | ||
| ) -> pd.DataFrame: |
There was a problem hiding this comment.
You said you’ve gone with None, so this is Optional[pd.DataFrame]
There was a problem hiding this comment.
Oops, only updated the docs.
Any chance you know of some tooling where I could just specify the types once and have them propagate between annotations and docs? Or maybe a linter that would warn me about mismatches?
There was a problem hiding this comment.
That’s what I’ve worked on a lot in the scanpydoc package.
Just delete them from the docs, they’ll be added automatically from the type annotations!
|
Hey! We recently went live with an extensive update which might break some of the previous pipelines and wrappers. All the existing Python and R packages should work, however they are linking to an archived data version and they don't access the most up-to-date data from g:Profiler due to the new API etc. We have already created a new R package that corresponds to the new API, Python package is still in the progress. I just wanted to let you know and please feel free to contact me if I can be of any help. All the best, |
|
@liiskolb Thanks for letting us know. Where can I track the python package at? Could you also point me towards the old and new docs for the API? I'd like to check what's different. Thanks! @flying-sheep I'm thinking I'll drop the |
|
@ivirshup |
|
Hi, |
|
Let me know when this can be merged. The discussion here got a bit long; it's interesting but I can't figure if we're there, yet. 😄 @flying-sheep, happy if you merge this, too, of course. |
|
This PR looks very useful. Do you mind adding an example in the function descriptions? |
|
@liiskolb, any chance you have an estimate of when the python package will be released? I'd like to have this PR merge with up-to-date results, and am trying to figure out if I should write a little client. @fidelram Sure! Just a heads up to everyone, I'm pretty swamped this week and probably won't get around to updating this PR until at least this weekend. |
|
@ivirshup We estimate that the package will be released around 15th of April. So, in a month or so. |
|
Writing the example for As for the |
|
@ivirshup We have updated gprofiler-official to version 1.0.0 that corresponds to the new API. |
|
Just pushing the updates now @LuckyMD 😄. One issue with the enrichment as is, is that Otherwise, I think this should be alright. I'd like to know if there'd be any interest in moving the utility function |
|
@flying-sheep, current thoughts on this? |
| ------- | ||
| A `pd.DataFrame` containing annotations. | ||
| :class:`pandas.DataFrame` | ||
| Dataframe containing annotations. |
There was a problem hiding this comment.
Due to recent doc changes: If you just have one return value, write prose and use a return value annotation.
(same for every other time you changed this in this commit)
There was a problem hiding this comment.
Just changed.
Also, I think it would be reasonable to include this with v1.5, if v1.4.1 is otherwise just bug fixes.
|
@ivirshup "One issue with the enrichment as is, is that gprofiler-official import name conflicts with the previous unofficial wrapper. I'm worried that this will break peoples environments if they're not aware of this. @liiskolb, do you have any thoughts on this?" I'm not really sure I got it right, but if new version of scanpy includes new version of gprofiler-official, then it should work well. If people have old version of scanpy that uses old version of gprofiler, then it should also work but with data from archived release of gprofiler. With this kind of updates it is inevitable that some environments break (we have the experience as you can see;)), these just need to be solved case by case if people with problems start to contact. They could be advised to update their packages to solve these issues. |
|
@liiskolb The problem is that the @ivirshup maybe the solution is to detect which version people have and then parse according to their version? The format is quite similar. I've used both now and could probably convert inputs and outputs easily. And then I'd throw a warning if |
|
@LuckyMD Ok. For me it seems that the packages can be differentiated by using |
I've given a shot at documenting a single dispatch function, largely following how it's done in `R`. I assume that will be most familiar to people who use scanpy. Also made the api to `gprofiler` more flexible by letting the user pass arbitrary arguments. Additionally, ran formatting with black and fixed some doc errors
Now uses `gprofiler-official` and can take cut-offs for differential expression.
Following up on #242.
Here's my solution to the current queries being pretty unreliable for me (due to issue with bioservices module). It's all a pretty thin wrapper around
pybiomart, which has a nice API and is well tested but has maintenance issues.Currently I've replaced the
gene_coordinatesquery with a more genericbiomart_annotations– the example covers the functionality ofgene_coordinates. I'm debating how to add tests given that they're network based (could fail when nothing is wrong with the code) and can take a while.