-
Notifications
You must be signed in to change notification settings - Fork 13
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
refactor: create antismash downloader module and move there inherent code #119
Conversation
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.
The antismash_downloader.py
handles with the downloading of antismash data based on PODP input. If the input changes, then it's still not easy to use this downloader. We need to further refactor this part, and let's have a chat about it tomorrow.
Co-authored-by: Cunliang Geng <[email protected]>
…nker/nplinker into 98_add_antismash_downloader_gcroci2
import pytest | ||
from nplinker.genomics.antismash import download_and_extract_antismash_metadata | ||
|
||
class TestDownloadAndExtractAntismashData(): |
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 would like to implement a fixture method for use download_root, extract_root, and refseq_assembly_id across the entire class. I tried to look it up online but I don't get how to do it for multiple variables.
- Apparently, passing in tmp_path creates a default testing dir which is deleted at the end of the test. Is this the best practice though? Would be nice to create temporary folders using
tmpdir
in a fixture method, and then retain the temp folders across the entire class. How should I implement that?
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.
For refseq_assembly_id
you can directly use refseq_assembly_id="GCF_004339725.1"
as a global variable in the class, then you can directly use the variable in functions.
If it's really necessary to share the folders across class, you can see the example using fixture tmp_path_factory
: https://pytest.org/en/latest/how-to/tmp_path.html#the-tmp-path-factory-fixture
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've read the docs there already, but if I try to implement it by creating a temporary folder and yielding it, then the folder is unknown to the other methods of the class.
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.
Can the tmp_dir
be a class attribute? So that the whole class just has one link to that which is created when parsing the class?
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.
Indeed, this would be the alternative. But I was looking for using the fixture thing. Anyway it was more for my personal curiosity, it's not needed at all in this specific test :)
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.
See my comment on the top of the PR @CunliangGeng
@gcroci2 The failed tests have been solved and the latest commit of |
I've merged with
|
@gcroci2 The branch of this PR passed all tests on my laptop. So there must be something wrong with your data. You could remove all data in |
Maybe you ran an older version of bigscape? might also be possible :/ |
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.
The last commit "xMerge branch 'dev' into 98_add_antismash_downloader_gcroci2
" is wrong and it removed all the latest updates of dev branch.
Please revert this commit, and make sure the file changes of this PR only involves the target files (for this PR they should only be downloader files).
…croci2"" This reverts commit 0c5b6bd. revert last merge
Because of reverting merged commit issues, I've opened a new PR (#127) |
downloader.py
as the module name? It's already in antismash/ folder, so calling itantismash_downloader.py
seems redundant to me.download_antismash_data
, which now is deprecated, and created a new onedownload_and_extract_antismash_data
, which takes as input a single item id to be used to retrieve Antismash data. In the refactored downloader for PoDP it will be inserted in a for loop to iterate over all the items available. The downloader module will be refactored in a different PR (see issue RefactorDownloader
class to have a specific PoDP downloader #121).test_downloader.py
andtest_loader.py
, to not repeat myself. But this is related to the comment above, so let me know if we want to keepantismash_[...].py
in the naming or if we want to remove that because everything is already in antismash/ folders.Notes
dev
branch, and thus also here: tests/test_nplinker.py::test_get_links and pytest tests/test_nplinker.py::test_load_data; it would be handy to fix them before merging this PR, just to be sure that it doesn't introduce any issues. In both cases, the error given isTypeError: unhashable type: 'Strain'
. Should I open a new issue about the failing tests? Something similar but different was happening in the same tests (see issue Fix failing tests #96), but should have been already solved.