diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 54a3a48..8839d7f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: run: python -m pip install --upgrade pip - name: Install cython wheel run: pip install cython wheel - - name: Install vcf2fhir - run: pip install vcf2fhir + - name: Install Dependencies + run: pip install -r requirements.txt - name: Run Unit tests run: python -m unittest diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3c85e5e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +Cython>=0.29.21 +fhirclient==3.2.0 +pysam +pandas +pytz>=2019.3 +PyVCF3>=1.0.3 +pyranges>=0.0.96 diff --git a/setup.cfg b/setup.cfg index af49bbd..29d16bd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,7 +28,7 @@ install_requires = pysam pandas pytz>=2019.3 - pyVCF>=0.6.8 + PyVCF3>=1.0.3 pyranges>=0.0.96 tests_require = unittest diff --git a/vcf2fhir/fhir_helper.py b/vcf2fhir/fhir_helper.py index d8db607..28f9f10 100644 --- a/vcf2fhir/fhir_helper.py +++ b/vcf2fhir/fhir_helper.py @@ -82,7 +82,10 @@ def _add_phase_records(self, record): if(sample_data.GT is not None and len(sample_data.GT.split('|')) >= 2 and 'PS' in sample_data._fields): - self.phased_rec_map.setdefault(sample_data.PS, []).append(record) + sample_data_ps = sample_data.PS + if isinstance(sample_data.PS, list): + sample_data_ps = sample_data_ps[0] + self.phased_rec_map.setdefault(sample_data_ps, []).append(record) def initalize_report(self): patient_reference = reference.FHIRReference( @@ -266,12 +269,15 @@ def add_variant_obv( "http://loinc.org", "82155-3", "Genomic Structural Variant copy Number" ) + copy_number = record.samples[0]["CN"] + if isinstance(record.samples[0]["CN"], list): + copy_number = copy_number[0] copy_number_component\ .valueQuantity = quantity.Quantity( { "system": "http://unitsofmeasure.org", "code": '1', - "value": record.samples[0]["CN"] + "value": copy_number } )