Commit eb8fbaa 1 parent 84a68c4 commit eb8fbaa Copy full SHA for eb8fbaa
File tree 2 files changed +19
-10
lines changed
pgscatalog.core/src/pgscatalog/core
2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -99,13 +99,16 @@ def run():
99
99
writer .write (dumped_variants )
100
100
n_finished += 1
101
101
finally :
102
- variant_log .append (
103
- ScoreLog (
104
- header = scorefile .header ,
105
- variants = normalised_score ,
106
- compatible_effect_type = is_compatible ,
107
- )
102
+ log = ScoreLog (
103
+ header = scorefile .header ,
104
+ variants = normalised_score ,
105
+ compatible_effect_type = is_compatible ,
108
106
)
107
+ if log .variants_are_missing :
108
+ logger .warning (
109
+ f"{ log .variant_count_difference } fewer variants in output compared to original file"
110
+ )
111
+ variant_log .append (log )
109
112
110
113
if n_finished == 0 :
111
114
raise ValueError (
Original file line number Diff line number Diff line change @@ -725,12 +725,15 @@ def sources(self) -> Optional[list[str]]:
725
725
return None
726
726
727
727
@property
728
- def n_actual_variants (self ) -> int :
728
+ def n_actual_variants (self ) -> Optional [ int ] :
729
729
# this distinction is useful if variants have been filtered out
730
- return len (self .variants )
730
+ if self .variants is not None :
731
+ return len (self .variants )
732
+ else :
733
+ return None
731
734
732
735
@cached_property
733
- def variant_count_difference (self ) -> int :
736
+ def variant_count_difference (self ) -> Optional [ int ] :
734
737
# grab directly from header
735
738
header_variants = getattr (self .header , "variants_number" , None )
736
739
if header_variants is None :
@@ -741,7 +744,10 @@ def variant_count_difference(self) -> int:
741
744
else :
742
745
header_variants = self .header .row_count
743
746
744
- return abs (header_variants - self .n_actual_variants )
747
+ try :
748
+ return abs (header_variants - self .n_actual_variants )
749
+ except TypeError :
750
+ return None
745
751
746
752
@property
747
753
def variants_are_missing (self ) -> bool :
You can’t perform that action at this time.
0 commit comments