Skip to content

Commit

Permalink
Print already downloaded markersets when using download list; update …
Browse files Browse the repository at this point in the history
…changelog
  • Loading branch information
chtsai0105 committed Nov 30, 2023
1 parent 4c0afa4 commit 3695d33
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- `phyling download list` now will also print out the markersets that have already been downloaded.

### Removed

- Output option in download module. Now all the BUSCO datasets will be saved in the config folder `~/.phyling/HMM`.

### Changed

- Change the align module -m/--markerset behavior. It firstly searches against the given path and the config folder `~/.phyling/HMM` if
the path doesn't exist. Users can also directly specify the markerset name that has already been downloaded and saved in the config folder.

## [2.0.0-beta] - 2023-11-14

### Added
Expand Down
15 changes: 13 additions & 2 deletions src/phyling/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ def download(markerset, **kwargs) -> None:
First it checks whether the metadata file is exist under the config folder ~/.phyling. A missing or outdated file
will trigger the module to download/update the metadata.
Passing "list" to markerset argument will list all the available markersets. Passing a valid name to the markerset
argument will download the markerset to the given output path.
Passing "list" to markerset argument will list all the available/already downloaded markersets. Passing a valid
name to the markerset argument will download the markerset to the config folder ~/.phyling/HMM.
"""
metadata_updater = Metadata_updater(database_url=phyling.config.database)
markerset_dict = metadata_updater.updater()
Expand All @@ -208,6 +208,11 @@ def download(markerset, **kwargs) -> None:
# Get the dictionary with database as key and convert it into a list
url_list = [hmm_markerset for hmm_markerset in markerset_dict.keys()]
url_list.sort()
exist_markerset = []
for markerset in Path(phyling.config.cfg_dir, phyling.config.default_HMM).iterdir():
if markerset.name in url_list and markerset.is_dir():
exist_markerset.append(markerset.name)
exist_markerset.sort()
print("Available datasets:\n")

# Adjust databases display according to the terminal size
Expand All @@ -219,6 +224,12 @@ def download(markerset, **kwargs) -> None:
# Print the database list
print(" ".join(word.ljust(col_width) for word in row))

print()
print("Downloaded datasets:\n")
exist_markerset = [exist_markerset[x : x + col] for x in range(0, len(exist_markerset), col)]
for row in exist_markerset:
# Print the database list
print(" ".join(word.ljust(col_width) for word in row))
else:
hmm_markerset_updater = HMM_markerset_updater(
database_url=phyling.config.database,
Expand Down

0 comments on commit 3695d33

Please sign in to comment.