Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Extend pangolin --all-versions to report conda versions of important dependencies #440

Merged
merged 2 commits into from
Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions pangolin/utils/initialising.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import sys
import itertools
import re
import subprocess
from distutils.version import LooseVersion
from Bio import SeqIO

Expand Down Expand Up @@ -217,6 +219,23 @@ def print_alias_file_exit(alias_file):

sys.exit(0)

def print_conda_version(pkg_list):
for pkg in pkg_list:
try:
result = subprocess.run(['conda', 'list', pkg],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
except subprocess.CalledProcessError as e:
stderr = e.stderr.decode('utf-8')
sys.stderr.write(cyan(f"Error: {e}:\n{stderr}\n"))
sys.exit(-1)
output = result.stdout.decode('utf-8')
m = re.search(f'\n{pkg} +([0-9.]+) .*\sbioconda$', output)
if m:
version = m.group(1)
print(f"{pkg}: {version}")
else:
sys.stderr.write(cyan(f"version not found in output of 'conda list {pkg}':\n{output}\n"))

def print_versions_exit(config):
print(f"pangolin: {config[KEY_PANGOLIN_VERSION]}\n"
f"pangolin-data: {config[KEY_PANGOLIN_DATA_VERSION]}\n"
Expand All @@ -228,6 +247,8 @@ def print_versions_exit(config):
print(f"pangolin-assignment: {pangolin_assignment.__version__}")
except:
pass
# Print versions of other important tools used by pangolin
print_conda_version(['usher', 'ucsc-fatovcf', 'gofasta', 'minimap2'])
sys.exit(0)

def set_up_verbosity(config):
Expand Down
5 changes: 3 additions & 2 deletions pangolin/utils/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def git_lfs_install():
check=True,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
except CalledProcessError as e:
sys.stderr.write(cyan(f'Error: "git-lfs install" failed: {e}'))
except subprocess.CalledProcessError as e:
stderr = e.stderr.decode('utf-8')
sys.stderr.write(cyan(f"Error: {e}:\n{stderr}\n"))
sys.exit(-1)

def pip_install_dep(dependency, release):
Expand Down