Skip to content

Commit

Permalink
Issue151 use json for genome status file (#157)
Browse files Browse the repository at this point in the history
* re-format code

* remove deprecated methods and unused varaibles

* refactor class GenomeStatus

* remove private method `_get_genome_status_log`

instead you can use GenomeStatus.load_from_json.

* update GenomeStatus usage in podp antismash downloader

* Update __init__.py

* update GenomeStatus attribute names in tests

* remove tests for old GenomeStatus class

* fix GenomeUsage usage in tests

* add unit tests for GenomeStatus class

* rename method `load_from_json` to `read_json`

* rename method `save_to_json` to `to_json`

* change parameter `output_dir` to `file` for `to_json` method

* enable `to_json` return string when output file is None

* fix refseq id `None`
  • Loading branch information
CunliangGeng authored Jul 6, 2023
1 parent 721e125 commit 0a74dcd
Show file tree
Hide file tree
Showing 4 changed files with 241 additions and 460 deletions.
8 changes: 3 additions & 5 deletions src/nplinker/genomics/antismash/antismash_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
from nplinker.utils import list_dirs
from nplinker.utils import list_files


logger = LogConfig.getLogger(__name__)

# urls to be given to download antismash data
ANTISMASH_DB_PAGE_URL = 'https://antismash-db.secondarymetabolites.org/output/{}/'
ANTISMASH_DB_DOWNLOAD_URL = 'https://antismash-db.secondarymetabolites.org/output/{}/{}'

# The antiSMASH DBV2 is for the availability of the old version, better to keep it.
ANTISMASH_DBV2_PAGE_URL = 'https://antismash-dbv2.secondarymetabolites.org/output/{}/'
ANTISMASH_DBV2_DOWNLOAD_URL = 'https://antismash-dbv2.secondarymetabolites.org/output/{}/{}'


Expand All @@ -29,8 +27,8 @@ def download_and_extract_antismash_data(antismash_id: str,
Args:
antismash_id(str): The id used to download BGC archive from antiSMASH database.
If the id is versioned (e.g., "GCF_004339725.1") please be sure to
specify the version as well.
If the id is versioned (e.g., "GCF_004339725.1") please be sure to
specify the version as well.
download_root(str | PathLike): Path to the directory to place downloaded archive in.
extract_root(str | PathLike): Path to the directory data files will be extracted to.
Note that an `antismash` directory will be created in the specified `extract_root` if
Expand Down
9 changes: 4 additions & 5 deletions src/nplinker/pairedomics/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import logging
from .podp_antismash_downloader import download_antismash_data
from .podp_antismash_downloader import GENOME_STATUS_FILENAME
from .podp_antismash_downloader import GenomeStatus
from .podp_antismash_downloader import podp_download_and_extract_antismash_data


logging.getLogger(__name__).addHandler(logging.NullHandler())

__all__ = [
"download_antismash_data",
"podp_download_and_extract_antismash_data"
]
__all__ = ["GENOME_STATUS_FILENAME", "GenomeStatus", "podp_download_and_extract_antismash_data"]
Loading

0 comments on commit 0a74dcd

Please sign in to comment.