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

Convert relationships to pedigree #184

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ repos:
args: ['--config', '.markdownlint.json']

- repo: https://github.com/ambv/black
rev: 22.1.0
rev: 22.3.0
hooks:
- id: black
args: [.]
Expand Down
18 changes: 15 additions & 3 deletions db/python/layers/family.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ class PedRow:
'notes': {'notes'},
}

def as_row(self, empty_participant_value=None):
"""Get the row as ordered in the header"""
return [
self.family_id,
self.individual_id,
self.paternal_id or empty_participant_value,
self.maternal_id or empty_participant_value,
self.sex,
self.affected,
self.notes or '',
]

@staticmethod
def default_header():
"""Default header (corresponds to the __init__ keys)"""
Expand Down Expand Up @@ -111,9 +123,9 @@ def parse_sex(sex: Union[str, int]) -> int:
)

sl = sex.lower()
if sl == 'm':
if sl in ('m', 'male'):
return 1
if sl == 'f':
if sl in ('f', 'female'):
return 2
if sl == 'sex':
raise ValueError(
Expand Down Expand Up @@ -152,7 +164,7 @@ def __str__(self):
return f'PedRow: {self.individual_id} ({self.sex})'

@staticmethod
def order(rows: List['PedRow']) -> List['PedRow']:
def order(rows: List) -> List:
"""
Order a list of PedRows, but also validates:
- There are no circular dependencies
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
black
black>=22.3.0
flake8
flake8-bugbear
pre-commit
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# requirements are for running the server
cpg-utils
click==8.0.4
requests==2.25.1
google-auth==1.35.0
google-cloud-secret-manager==2.8.0
Expand Down
Loading