Skip to content

Commit

Permalink
Merge pull request #98 from Clinical-Genomics/update_mongodb
Browse files Browse the repository at this point in the history
Unfreeze pymongo and add integration test with MongoDB v7
  • Loading branch information
northwestwitch committed Nov 8, 2023
2 parents 4159068 + a1def58 commit 9f35fa2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 14 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/integration_test.yml
@@ -0,0 +1,39 @@
name: Integration tests
on: [pull_request]
jobs:
integration_test:
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ['7']

steps:
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.10.0
with:
mongodb-version: ${{ matrix.mongodb-version }}

- name: Checkout
uses: actions/checkout@v4

- name: Setup Conda and install python
uses: s-weigand/setup-conda@v1
with:
activate-conda: true
python-version: 3.11

- name: Download Picard
uses: wei/wget@v1
with:
args: -O picard.jar https://github.com/broadinstitute/picard/releases/download/2.26.6/picard.jar

- name: Install repo and its dependencies
run: |
pip install -r requirements.txt
pip install -e .
- name: Test run pipeline
run: |
mutacc --root-dir . extract --picard-executable picard.jar --padding 600 -c mutacc/resources/case.yaml
mutacc --root-dir . db import imports/demo_trio_import_mutacc.json
mutacc --root-dir . db export --all-variants --member child --proband --sample-name child
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,11 +2,14 @@
All notable changes to this project will be documented in this file.

## [unreleased]
### Added
- Integration test with MongoDB v7
### Changed
- Moved tests and coverage from Travis to GitHub actions
- Updated python version and versions of some GitHub actions
- Unfreeze cyvcf2 lib to be able to install the software with Python>=3.8
- Installation instructions on README page to install mutacc using Python 3.8
- Unfreeze pymongo requirement and removed deprecated pymongo code to support latest version of MongoDB
### Fixed
- Badge on Readme page
- GitHub action to push the right image to Docker Hub
Expand Down
16 changes: 3 additions & 13 deletions mutacc/mutaccDB/db_adapter.py
Expand Up @@ -68,20 +68,10 @@ def add_case(self, case):

self.cases_collection.insert_one(case)

def case_exists(self, case_id):
"""
Check if collection with field 'case_id': case_id exists.
Args:
case_id(str): name of case
Returns:
exists(bool): True if exists, else False
"""

if self.cases_collection.find({"case_id": case_id}).count() > 0:
return True
def case_exists(self, case_id: str) -> bool:
"""Check if collection with field 'case_id': case_id exists."""

return False
return self.cases_collection.count_documents({"case_id": case_id}) > 0

def find_cases(self, query):

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -6,4 +6,4 @@ cyvcf2
mongo_adapter>=0.3.3
ped_parser
PyYaml>=5.1
pymongo<4.0
pymongo

0 comments on commit 9f35fa2

Please sign in to comment.