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

Switch from PyVCF to PyVCF3 and update workflow to install dependencies from requirements.txt #103

Merged
merged 2 commits into from
May 26, 2022
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 8 additions & 2 deletions vcf2fhir/fhir_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
}
)

Expand Down