Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

Commit

Permalink
fix handling of dominant / recessive
Browse files Browse the repository at this point in the history
  • Loading branch information
nebfield committed Feb 22, 2024
1 parent cf5d0d5 commit a607213
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 851 deletions.
6 changes: 3 additions & 3 deletions pgscatalog_utils/scorefile/qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ def assign_effect_type(
) -> typing.Generator[ScoreVariant, None, None]:
for variant in variants:
match (variant.is_recessive, variant.is_dominant):
case (None, None) | ("FALSE", "FALSE"):
case (None, None) | (False, False):
pass # default value is additive, pass to break match and yield
case ("FALSE", "TRUE"):
case (False, True):
variant.effect_type = EffectType.DOMINANT
case ("TRUE", "FALSE"):
case (True, False):
variant.effect_type = EffectType.RECESSIVE
case _:
logger.critical(f"Bad effect type setting: {variant}")
Expand Down
10 changes: 8 additions & 2 deletions pgscatalog_utils/scorefile/scorevariant.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,14 @@ def __init__(

self.hm_inferOtherAllele: Optional[str] = hm_inferOtherAllele
self.hm_source: Optional[str] = hm_source
self.is_dominant: Optional[bool] = is_dominant
self.is_recessive: Optional[bool] = is_recessive

self.is_dominant: Optional[bool] = (
is_dominant == "True" if is_dominant is not None else None
)
self.is_recessive: Optional[bool] = (
is_recessive == "True" if is_recessive is not None else None
)

self.hm_rsID: Optional[str] = hm_rsID
self.hm_match_chr: Optional[str] = hm_match_chr
self.hm_match_pos: Optional[str] = hm_match_pos
Expand Down
39 changes: 39 additions & 0 deletions tests/data/combine/PGS000802_hmPOS_GRCh37.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
###PGS CATALOG SCORING FILE - see https://www.pgscatalog.org/downloads/#dl_ftp_scoring for additional information
#format_version=2.0
##POLYGENIC SCORE (PGS) INFORMATION
#pgs_id=PGS000802
#pgs_name=CRC_19
#trait_reported=Colorectal cancer
#trait_mapped=colorectal cancer
#trait_efo=EFO_0005842
#genome_build=NR
#variants_number=19
#weight_type=NR
##SOURCE INFORMATION
#pgp_id=PGP000191
#citation=He CY et al. Genomics (2021). doi:10.1016/j.ygeno.2021.01.025
##HARMONIZATION DETAILS
#HmPOS_build=GRCh37
#HmPOS_date=2022-07-28
#HmPOS_match_chr={"True": null, "False": null}
#HmPOS_match_pos={"True": null, "False": null}
rsID chr_name chr_position effect_allele other_allele effect_weight allelefrequency_effect is_dominant is_recessive locus_name hm_source hm_rsID hm_chr hm_pos hm_inferOtherAllele
rs10936599 3 170974795 T C 0.123 0.377 True False MYNN ENSEMBL rs10936599 3 169492101
rs6061231 20 60390312 A C 0.491 0.892 False True LOC100128184, RPS21 ENSEMBL rs6061231 20 60956917
rs10774214 12 4238613 C T 0.122 0.637 True False LOC100129645, CCND2 ENSEMBL rs10774214 12 4368352
rs10795668 10 8741225 A G 0.147 0.61 True False LOC338591, LOC389936 ENSEMBL rs10795668 10 8701219
rs11903757 2 192295449 T C 0.185 0.925 False True LOC100132133, hCG_2045843 ENSEMBL rs11903757 2 192587204
rs12603526 17 747343 T C 0.142 0.695 False True NXN ENSEMBL rs12603526 17 800593
rs1321311 6 36730878 G T 0.135 0.876 True False SFRS3, LOC389386 ENSEMBL rs1321311 6 36622900
rs2423279 20 7760350 T C 0.193 0.715 False True FUSIP1P2 ENSEMBL rs2423279 20 7812350
rs3802842 11 110676919 A C 0.177 0.663 True False LOC120376 ENSEMBL rs3802842 11 111171709
rs4813802 20 6647595 T G 0.189 0.816 False True LOC728383 ENSEMBL rs4813802 20 6699595
rs6469656 8 117716969 G A 0.204 0.627 False True TRPS1, EIF3H ENSEMBL rs6469656 8 117647788
rs647161 5 134526991 C A 0.277 0.663 False True LOC389328, H2AFY ENSEMBL rs647161 5 134499092
rs704017 10 80489138 A G 0.123 0.644 True False LOC100132987, ZMIZ1 ENSEMBL rs704017 10 80819132
rs7315438 12 114375786 C T 0.146 0.388 True False TBX3, LOC100129020 ENSEMBL rs7315438 12 115891403
rs10411210 19 38224140 C T 0.232 0.836 False False RHPN2 ENSEMBL rs10411210 19 33532300
rs12953717 18 44707927 T C 0.157 0.789 False False SMAD7 ENSEMBL rs12953717 18 46453929
rs16969681 15 30780403 T C 0.175 0.583 False False C15orf45, GREM1 ENSEMBL rs16969681 15 32993111
rs1801133 1 11778965 A G 0.16 0.592 False False MTHFR ENSEMBL rs1801133 1 11856378
rs6983267 8 128482487 G T 0.217 0.376 False False FAM84B, POU5F1P1 ENSEMBL rs6983267 8 128413305
Loading

0 comments on commit a607213

Please sign in to comment.