-
Notifications
You must be signed in to change notification settings - Fork 26
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
Deepcell task #199
Deepcell task #199
Conversation
# Conflicts: # requirements.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Omer, great start! The build is failing because of a formatting issue, you can just add a blank line at the end of the file and you should be set.
Could you please update the description of the PR with the indicated information?
# Conflicts: # ark/utils/deepcell_service_utils.py
Hey, thanks. I fixed the indentation so it be compliant with PEP and added a short (is it enough?) description . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, just a quick question about the requirements.txt file, which looks like it has some unused functions in it.
Given that you're not actually in our lab, no pressure to do any more than this, it will already be super helpful.
If you're interested in working some more on this, let me know. I think some nice additions would be creating a top-level function that creates a directory for each Point, calls this function with that directory as the output, and then renames the output appropriately. This would avoid having to get the last modified file. It would also be good to add some testing to make sure this works as expected. If you have other stuff you're working on, no worries, we can handle that part. But if you're interested in fleshing this out a bit more, let me know.
Thanks!
requirements.txt
Outdated
certifi | ||
pyOpenSSL | ||
service_identity | ||
git+https://github.com/vanvalenlab/kiosk-client@master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the client is pip installable: can you try adding kiosk_client to the requirements.txt file?
It doesn't look like certifi, pyOpenSSL, or service_identify are imported anywhere, is there a reason these are required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd be happy to add more methods.
regarding the requirements - they are required in order to be able to upload files using twisted and for the tls certificate (even tough they are not explicitly called in the method). I'm changing the git dependency to pip installation.
Thanks!
Okay great! I opened an issue in the kiosk-client to see if there's a reason Will set it up this way. If not, I think it would be pretty easy to submit a PR allowing us to specify an output path. Once we get an answer on that, we'll know how to move forward. I think we'll want to create a function like Once that's set up, we can update the jupyter notebook to use this new function |
Okay, so Will said the reason they never added that option was just because they didn't get to it. I think a PR to address that would be great. If you'd like to take that on, let me know, otherwise Alex or Adam can put that on their todo list. What that means is that the high level function can expect the files to be named appropriately. This will simplify things further. Let me know what stuff you'd like to get started on |
Great, so I can start with that PR and then move on to |
Perfect, sounds great. If you don't have write access to kiosk-client you fork the repo and submit your PR from your branch, or ask Will to give you write access. If you run into any issues feel free to leave a comment on the issue I opened in that repo and Will or I can respond. |
Great thanks! |
It's an annoying part of working with RTD and specifically, building documentation from docstrings. When snaking through the documentation, I think So in Omer's case, when it sees a library such as |
@ngreenwald I'm guessing one of your concerns is that developers have to know to add to I've been looking into a way to somehow tell RTD to do a |
My main concern is that kiosk-client has a ton of dependencies that we don't actually care about. So mocking it directly sounds like the best approach since there isn't anything in the documentation that relies on us referencing a class or something from there. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I talked to Will, it turns out twisted is a requirement of treq
, which is a requirement for kiosk-client.
Can you just double check (by commenting out one at a time and rebuilding the environment) that each of the current requirements are actually needed? If so, we can of course add them, but I'd like to avoid adding unnecessary requirements if possible if they're getting installed via the kiosk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome Omer! I had some brief comments about the documentation, testing, and requirements.txt
.
requirements.txt
Outdated
Twisted~=20.3.0 | ||
pyOpenSSL | ||
service_identity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realize this is basically a piggyback off of Noah's comment now, sorry! I wonder if simply including kiosk-client
will do the trick. Looking at setup.py
of the kiosk-client
repo, it looks like it's configured to install treq
on a pip install
, meaning that if all goes well, we might be able to remove at least twisted
, if not also pyOpenSSL
and service_identity
(assuming treq
installs at least twisted
as well).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it does! I only checked the requirements file itself (of kiosk-client), but as you and @ngreenwald said, kiosk-client installs all the necessary modules. thanks
warnings.warn(f'Deep Cell output file was not found for {point}.') | ||
|
||
|
||
def run_deepcell_task(input_dir, output_dir, host='https://deepcell.org', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify, we don't need a test function for this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't think of any testing that would actually be useful. We'd have to mock basically the entire function, and at that point I'm not sure what we're actually testing. Open to suggestions if you think there's functionality worth testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I didn't think there was any additional testing we needed for this since its basically a driver function. Don't think we need to add a test function for this.
ark/utils/deepcell_service_utils.py
Outdated
Default: 'multiplex' | ||
""" | ||
|
||
# more configuration parameters can be set. https://github.com/vanvalenlab/kiosk-client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to put this in the docstring description (before the Args list) so people can reference it on ReadTheDocs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated it in the last commit
Hey Omer, this looks great! I'll wait until Adam takes a look before approving in case he has any additional suggestions. If you'd like to keep contributing to the repository, I've created an issue outlining the next steps for a subsequent PR. If you've got other stuff to work on, no worries at all, one of us can tackle it. Just let me know what works for you! Here's the issue: #243 |
Ditto on Noah's comment. It looks good to me, let's see what Adam has to say. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fantastic! Just one suggestion for the points
argument in create_deepcell_output
.
ark/utils/deepcell_service_utils.py
Outdated
points (list): | ||
List of points in preprocessing pipeline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think an option to set points=None
so that all .tif
files in the input directory can be read in would be pretty useful. We have some tools written to help with this. If you import ark.utils.io_utils
, you could use something like:
if points is None:
tifs = io_utils.list_files(deepcell_input_dir, substrs='.tif')
points = io_utils.extract_delimited_names(tifs, delimiter='.')
That should plug directly into the code you've already written, assuming I didn't make any typos, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in the last commit
+ testing
@ngreenwald thanks! sure, I'll take it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Omer, this looks great! I had one comment about your docstring for create_deepcell_output
.
ark/utils/deepcell_service_utils.py
Outdated
points (list): | ||
List of points in preprocessing pipeline. if None, all .tif files | ||
in deepcell_input_dir will be considered as input points. | ||
deepcell_input_dir (str): | ||
Location of preprocessed files (assume deepcell_input_dir contains <point>.tif | ||
for each point in points list) | ||
suffix (str): | ||
Suffix for DeepCell output filename. e.g. for pointX, DeepCell output | ||
should be <pointX>+suffix.tif. Default: '_feature_0' | ||
deepcell_output_dir (str): | ||
Location to save DeepCell output (as .tif) | ||
host (str): | ||
Hostname and port for the kiosk-frontend API server | ||
Default: 'https://deepcell.org' | ||
job_type (str): | ||
Name of job workflow (multiplex, segmentation, tracking) | ||
Default: 'multiplex' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should put your args list in the order you specified your parameters in the function (so, deepcell_input_dir
, deepcell_output_dir
, points
, etc.).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in the last commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, I think it's good to go!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
* Use kiosk-client modules for automated DeepCell tasks * Use kiosk-client modules for automated DeepCell tasks * Use kiosk-client modules for automated DeepCell tasks * Update deepcell_service_utils.py * Use kiosk-client modules for automated DeepCell tasks * Use kiosk-client modules for automated DeepCell tasks * Use kiosk-client modules for automated DeepCell tasks * Update deepcell_service_utils.py * Use kiosk-client modules for automated DeepCell tasks * Use kiosk-client modules for automated DeepCell tasks * Update deepcell_service_utils.py * Use kiosk-client modules for automated DeepCell tasks * additional requirements for twister certificates * install kiosk-client using pip * create_deepcell_output * create_deepcell_output * Update requirements.txt Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com> * create_deepcell_output * changing back to 'kiosk-client' * basic testing framework * modified requirements.txt file * fixed version issue * input validation + unit tests * rerun build * docstrings formatting * docstrings formatting * requirements.txt * requirements.txt * requirements.txt * add dependencies to conf.py * test multiple .tif * remove unnecessary modules * remove unnecessary modules * make points an optional parameter + testing * Docstring parameters reorder Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com>
* Use kiosk-client modules for automated DeepCell tasks * Use kiosk-client modules for automated DeepCell tasks * Use kiosk-client modules for automated DeepCell tasks * Update deepcell_service_utils.py * Use kiosk-client modules for automated DeepCell tasks * Use kiosk-client modules for automated DeepCell tasks * Use kiosk-client modules for automated DeepCell tasks * Update deepcell_service_utils.py * Use kiosk-client modules for automated DeepCell tasks * Use kiosk-client modules for automated DeepCell tasks * Update deepcell_service_utils.py * Use kiosk-client modules for automated DeepCell tasks * additional requirements for twister certificates * install kiosk-client using pip * create_deepcell_output * create_deepcell_output * Update requirements.txt Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com> * create_deepcell_output * changing back to 'kiosk-client' * basic testing framework * modified requirements.txt file * fixed version issue * input validation + unit tests * rerun build * docstrings formatting * docstrings formatting * requirements.txt * requirements.txt * requirements.txt * add dependencies to conf.py * test multiple .tif * remove unnecessary modules * remove unnecessary modules * make points an optional parameter + testing * Docstring parameters reorder Co-authored-by: Noah Greenwald <noahfgreenwald@gmail.com>
This branch includes a new method for automating the process of uploading files to DeepCell, downloading and extracting the output .tif image.
Implementation is based on relevant modules from https://github.com/vanvalenlab/kiosk-client.
According to the current implementation of the kiosk-client, the DeepCell output will be downloaded to a predetermined folder (/downloads). Ideally, the path should be a parameter.