Skip to content
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

Implement ensembl-py logging #214

Merged
merged 30 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6b4215e
Update to latest ensembl-py version
ens-LCampbell Nov 15, 2023
644f94c
ensembl-py logging genome_stats_compare
ens-LCampbell Nov 15, 2023
a9df2ed
ensembl-py logging assembly module
ens-LCampbell Nov 15, 2023
f1ca04c
Add else clause for successful execute
ens-LCampbell Nov 15, 2023
ee7ada7
Update import formatting
ens-LCampbell Nov 15, 2023
0273e04
Implement ensembl-py logging events module
ens-LCampbell Nov 15, 2023
458d823
ensembl-py logging assembly module
ens-LCampbell Nov 15, 2023
6fa9230
Implement ensembl-py logging events module
ens-LCampbell Nov 15, 2023
82e0258
Merge pull request #215 from Ensembl/lcampbell/events
ens-LCampbell Nov 16, 2023
93d3832
Merge pull request #216 from Ensembl/lcampbell/assembly_download
ens-LCampbell Nov 16, 2023
70dad00
genome_metadata logging + restructure nxf modules
ens-LCampbell Nov 16, 2023
6261425
Merge pull request #218 from Ensembl/lcampbell/genome_metadata
ens-LCampbell Nov 16, 2023
4514a11
Add missing license header mkdocs gen script
ens-LCampbell Nov 16, 2023
5b9b23e
Fix banner name Ensembl GenomIO
ens-LCampbell Nov 16, 2023
0bd56ad
Include ensembl genomio pages URL to toml
ens-LCampbell Nov 16, 2023
174b9dc
Merge pull request #219 from Ensembl/lcampbell/genome_metadata
ens-LCampbell Nov 16, 2023
0d2a796
ens-py logging manifest integrity check
ens-LCampbell Nov 16, 2023
93790ef
remove comment line
ens-LCampbell Nov 16, 2023
1509230
Merge pull request #221 from Ensembl/lcampbell/manifest
ens-LCampbell Nov 16, 2023
769ae78
Update NXF module logging to verbose not debug
ens-LCampbell Nov 16, 2023
388bffa
Add license header to mkdoc config yaml
ens-LCampbell Nov 16, 2023
bde2d8d
Merge branch 'main' into lcampbell/genome_stats_compare
ens-LCampbell Nov 16, 2023
28e6972
Rename and add license to mkdocs workflow yml
ens-LCampbell Nov 16, 2023
a632088
Run black across code changes
ens-LCampbell Nov 16, 2023
b21850b
Remove unused sys import
ens-LCampbell Nov 16, 2023
9d5e570
Remove site logo, update URLs
ens-LCampbell Nov 20, 2023
32a02d7
Alter raise exception
ens-LCampbell Nov 20, 2023
0fa6c30
Update docs/gen_ref_pages.py
ens-LCampbell Nov 21, 2023
3e95dfc
Apply suggestions from code review
JAlvarezJarreta Nov 21, 2023
22048b3
Apply black
MatBarba Nov 21, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ process COMPARE_GENOME_STATS {

script:
"""
genome_stats_compare --ncbi $ncbi_stats --core $core_stats > diff_stats.json
genome_stats_compare --ncbi $ncbi_stats --core $core_stats --debug > diff_stats.json
"""
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dependencies = [
"bcbio-gff == 0.7.0",
"biopython == 1.81",
"ensembl-hive @ git+https://github.com/Ensembl/ensembl-hive.git",
"ensembl-py @ git+https://github.com/Ensembl/ensembl-py.git", # minimum v1.2.0
"ensembl-py @ git+https://github.com/Ensembl/ensembl-py.git", # minimum v1.2.1
"jsonschema >= 4.6.0",
"importlib_resources", # not needed from Python 3.9+
"intervaltree >= 3.1.0",
Expand Down
12 changes: 9 additions & 3 deletions src/python/ensembl/io/genomio/genome_stats/compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
import json
import re
from typing import Any, Dict
import logging

from ensembl.io.genomio.utils import get_json
from ensembl.utils.argparse import ArgumentParser

from ensembl.utils.logging import init_logging
ens-LCampbell marked this conversation as resolved.
Show resolved Hide resolved

def _diff_dicts(ncbi: Dict[str, int], core: Dict[str, int]) -> Dict[str, Any]:
"""Compare two dicts with the same keys and compute the difference of their values.
Expand Down Expand Up @@ -189,17 +190,22 @@ def main() -> None:
)
parser.add_argument_src_path("--ncbi_stats", required=True, help="NCBI dataset JSON file")
parser.add_argument_src_path("--core_stats", required=True, help="Core database JSON file")
parser.add_log_arguments(add_log_file=True)
args = parser.parse_args()

# Configure and initialise logging
init_logging(args.log_level, args.log_file, args.log_file_level)

try:
ncbi_stats = get_json(args.ncbi_stats)["reports"][0]
except KeyError:
logging.info(f"{args.ncbi_stats} JSON .'reports' obtained")
except (json.decoder.JSONDecodeError, KeyError):
logging.warning(f"{args.ncbi_stats} JSON file is empty")
ncbi_stats = {}
ens-LCampbell marked this conversation as resolved.
Show resolved Hide resolved
core_stats = get_json(args.core_stats)
all_stats = compare_stats(ncbi_stats, core_stats)

print(json.dumps(all_stats, indent=2, sort_keys=True))


ens-LCampbell marked this conversation as resolved.
Show resolved Hide resolved
if __name__ == "__main__":
main()