diff --git a/.circleci/config.yml b/.circleci/config.yml index 39e3148c..9c26279a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -32,9 +32,9 @@ machine_defaults: &machine_defaults image: ubuntu-2004:202201-02 working_directory: ~/ENCODE-DCC/hic-pipeline -py37: &py37 +py39: &py39 docker: - - image: circleci/python:3.7.4-stretch + - image: circleci/python:3.9 working_directory: ~/ENCODE-DCC/hic-pipeline commands: @@ -42,7 +42,7 @@ commands: description: Install and run tox with a given environment parameters: toxenv: - description: The name of the environment as per tox.ini, e.g. py37 or lint + description: The name of the environment as per tox.ini, e.g. py39 or lint type: string extra_args: description: Extra arguments that are consumed only when running pytest @@ -101,19 +101,19 @@ commands: jobs: lint: - <<: *py37 + <<: *py39 steps: - checkout - install_shellcheck - run_tox: toxenv: lint - test_py37: - <<: *py37 + test_py39: + <<: *py39 steps: - checkout - run_tox: - toxenv: py37 + toxenv: py39 test_wdl: <<: *machine_defaults @@ -142,8 +142,8 @@ jobs: - run: name: Run pytest-workflow WDL tests using tox command: | - pyenv install 3.7.0 - pyenv global 3.7.0 + pyenv install 3.9.10 + pyenv global 3.9.10 pip install --upgrade pip pip install tox tox -e wdl -- --kwd --tag << parameters.tag >> --wt << parameters.num_parallel_workflows >> @@ -223,7 +223,7 @@ workflows: dockerfile_directory: docker/delta cache_tag: << pipeline.parameters.delta_cache_tag >> - lint - - test_py37: + - test_py39: requires: - lint - test_wdl: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 091974c0..a64a0bdf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: rev: 22.3.0 hooks: - id: black - language_version: python3.7 + language_version: python3.9 - repo: https://github.com/asottile/seed-isort-config rev: v1.9.2 @@ -16,12 +16,7 @@ repos: rev: v4.3.21 hooks: - id: isort - language_version: python3.7 - - - repo: https://github.com/detailyang/pre-commit-shell - sha: v1.0.6 - hooks: - - id: shell-lint + language_version: python3.9 - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.2.3 diff --git a/scripts/make_genophase_input_json_from_portal.py b/scripts/make_genophase_input_json_from_portal.py index a750fc09..48b4d067 100644 --- a/scripts/make_genophase_input_json_from_portal.py +++ b/scripts/make_genophase_input_json_from_portal.py @@ -25,7 +25,8 @@ def main(): auth=auth, use_submitted_file_names=args.use_submitted_file_names, ) - input_json = _get_input_json(bams=bams) + donor_id = _get_donor_id_from_experiment(accessions=args.accessions, auth=auth) + input_json = _get_input_json(bams=bams, donor_id=donor_id) _write_json_to_file(input_json, args.outfile) @@ -48,6 +49,7 @@ def _get_bams_from_experiment(accessions, auth=None, use_submitted_file_names=Fa if ( a["status"] in _ALLOWED_STATUSES and a["lab"] == "/labs/encode-processing-pipeline/" + and a["pipelines"][0] == "/pipelines/ENCPL839OAB/" ): analysis = a break @@ -66,11 +68,31 @@ def _get_bams_from_experiment(accessions, auth=None, use_submitted_file_names=Fa return bams -def _get_input_json(bams): +def _get_donor_id_from_experiment(accessions, auth=None): + donor_id = None + for accession in accessions: + experiment = _get_experiment(accession, auth=auth) + if donor_id is None: + donor_id = experiment["replicates"][0]["library"]["biosample"]["donor"][ + "accession" + ] + else: + if ( + donor_id + != experiment["replicates"][0]["library"]["biosample"]["donor"][ + "accession" + ] + ): + raise ValueError("These datasets do not belong to the same donor.") + return donor_id + + +def _get_input_json(bams, donor_id): input_json = { "genophase.bams": bams, "genophase.gatk_bundle_tar": _REFERENCE_FILES["gatk_bundle_tar"], "genophase.reference_fasta": _REFERENCE_FILES["reference_fasta"], + "genophase.donor_id": donor_id, } return input_json diff --git a/tox.ini b/tox.ini index 41349fe7..a0ac374b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = lint,py37,wdl,coverage-report +envlist = lint,py39,wdl,coverage-report isolated_build = True skipsdist = True @@ -10,22 +10,22 @@ deps = -rrequirements-scripts.txt [testenv:wdl] -basepython = python3.7 +basepython = python3.9 commands = python -m pytest --ignore=tests/python --symlink {posargs} deps = caper==1.6.3 - pysam==0.15.4 + pysam==0.19.1 pytest-workflow==1.5.0 pytest==6.2.2 [testenv:lint] -basepython = python3.7 +basepython = python3.9 skip_install = true deps = pre-commit commands = pre-commit run --all-files [testenv:coverage-report] -basepython = python3.7 +basepython = python3.9 commands = pytest --cov-report term-missing --cov=hic-pipeline [flake8]