From e46a795ab4db0b8ad6beceeb09253983f02a7607 Mon Sep 17 00:00:00 2001 From: wlu04 Date: Thu, 4 Nov 2021 15:19:43 -0400 Subject: [PATCH 1/2] setup.py updated --- __init__.py | 4 ++-- resources/__init__.py | 4 ++-- setup.py | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/__init__.py b/__init__.py index 511b644..fc9329e 100644 --- a/__init__.py +++ b/__init__.py @@ -1,2 +1,2 @@ -from ukbb_common.utils import * -from ukbb_common.resources import * +from .utils import * +from .resources import * diff --git a/resources/__init__.py b/resources/__init__.py index c513ed1..35572ec 100644 --- a/resources/__init__.py +++ b/resources/__init__.py @@ -1,2 +1,2 @@ -from ukb_common.resources.generic import * -from ukb_common.resources.results import * +from ukbb_common.resources.generic import * +from ukbb_common.resources.results import * diff --git a/setup.py b/setup.py index ed1d2a0..b2b1fb2 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,17 @@ import setuptools - +import os with open("README.md", "r", encoding="utf-8") as readme_file: long_description = readme_file.read() -requirements = [] -with open("requirements.txt", "r") as requirements_file: - for req in (line.strip() for line in requirements_file): - requirements.append(req) +# requirements = [] +# with open("requirements.txt", "r") as requirements_file: +# for req in (line.strip() for line in requirements_file): +# requirements.append(req) setuptools.setup( name="ukbb_common", - version="0.1.2", + version="0.1.3", author="", author_email="", description="Common functions for UK Biobank Data", @@ -30,7 +30,7 @@ "Development Status :: 4 - Beta", ], python_requires=">=3.6", - package_dir={"": "src"}, - packages=setuptools.find_packages(where="src"), - install_requires=requirements, + package_dir={"ukbb_common": "."}, + packages=['ukbb_common', 'ukbb_common.resources', 'ukbb_common.utils'], + install_requires=['hail', 'batch'], ) From 94a75f7f7e4326814fe2c4fb74149735a47970c1 Mon Sep 17 00:00:00 2001 From: wlu04 Date: Thu, 4 Nov 2021 15:26:27 -0400 Subject: [PATCH 2/2] minor changes to the load_covid function --- utils/phenotype_loading.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/utils/phenotype_loading.py b/utils/phenotype_loading.py index 76f16d8..a2d0309 100644 --- a/utils/phenotype_loading.py +++ b/utils/phenotype_loading.py @@ -645,8 +645,8 @@ def load_covid_data(all_samples_ht: hl.Table, covid_data_path: str, hes_main_pat print(f'Loading COVID wave {wave}...') #### PATH OF DATA USED IN TESTING #### - # def get_covid_data_path(wave: str = '20201103'): - # return f'gs://ukb31063/ukb31063.covid19_test_result.{wave}.txt' + # def get_covid_data_path(wave: str = '20200724', region: str = 'england'): + # return f'gs://ukb31063/ukb31063.covid19_result_{region}.{wave}.txt' # def get_hes_main_data_path(wave: str = '20200909'): # return f'gs://ukb31063/ukb31063.hesin.{wave}.txt' @@ -658,6 +658,7 @@ def load_covid_data(all_samples_ht: hl.Table, covid_data_path: str, hes_main_pat # return f'gs://ukb31063/ukb31063.death.{wave}.txt' covid_ht = hl.import_table(covid_data_path, delimiter='\t', missing='', impute=True, key='eid', min_partitions=100) + hes_main_ht = hl.import_table(hes_main_path, delimiter='\t', missing='', impute=True, key=('eid', 'ins_index'), min_partitions=100) hes_diag_ht = hl.import_table(hes_diag_path, delimiter='\t', missing='', impute=True, key=('eid', 'ins_index'), min_partitions=100) death_ht = hl.import_table(death_path, delimiter='\t', missing='', impute=True, key='eid', min_partitions=100) @@ -674,8 +675,10 @@ def load_covid_data(all_samples_ht: hl.Table, covid_data_path: str, hes_main_pat hes_ht = hes_ht.key_by('eid').join(hes_pcr_pos.key_by('eid'), how='outer') # Create PCR-Positive information for all diagnoses hes_death_ht = hes_ht.join(death_ht, how='outer') # Join Death Register Data to HES Info - hes_death_ht = hes_death_ht.annotate(inpatient2=hes_death_ht.admi_date >= hes_death_ht.covid_diag_date, - death=hes_death_ht.death_date >= hes_death_ht.covid_diag_date) # Compare PCR-Positive Date to Death Date and Admission Date + hes_death_ht = hes_death_ht.annotate(inpatient2=(hes_death_ht.admi_date >= hes_death_ht.covid_diag_date) & + (hes_death_ht.admi_date < hes_death_ht.covid_diag_date + 86400 * 30), + death=(hes_death_ht.death_date >= hes_death_ht.covid_diag_date) & + (hes_death_ht.death_date < hes_death_ht.covid_diag_date + 86400 * 30)) # Compare PCR-Positive Date to Death Date and Admission Date hes_death_ht = hes_death_ht.group_by('eid').aggregate(inpatient2=hl.agg.any(hes_death_ht.inpatient2), death=hl.agg.any(hes_death_ht.death), pcr_result=hl.agg.any(hes_death_ht.pcr_result),