2
2
3
3
import hail as hl
4
4
5
+ from v03_pipeline .lib .logger import get_logger
6
+
7
+ logger = get_logger (__name__ )
8
+
5
9
6
10
class MatrixTableSampleSetError (Exception ):
7
11
def __init__ (self , message , missing_samples ):
@@ -42,15 +46,15 @@ def remap_sample_ids(
42
46
f'All callset sample IDs:{ mt .s .collect ()} '
43
47
)
44
48
if ignore_missing_samples_when_remapping :
45
- print (message )
49
+ logger . info (message )
46
50
else :
47
51
raise MatrixTableSampleSetError (message , missing_samples )
48
52
49
53
mt = mt .annotate_cols (** project_remap_ht [mt .s ])
50
54
remap_expr = hl .if_else (hl .is_missing (mt .seqr_id ), mt .s , mt .seqr_id )
51
55
mt = mt .annotate_cols (seqr_id = remap_expr , vcf_id = mt .s )
52
56
mt = mt .key_cols_by (s = mt .seqr_id )
53
- print (f'Remapped { remap_count } sample ids...' )
57
+ logger . info (f'Remapped { remap_count } sample ids...' )
54
58
return mt
55
59
56
60
@@ -77,9 +81,9 @@ def subset_samples(
77
81
if (
78
82
subset_count > anti_join_ht_count
79
83
) and ignore_missing_samples_when_subsetting :
80
- print (message )
84
+ logger . info (message )
81
85
else :
82
86
raise MatrixTableSampleSetError (message , missing_samples )
83
- print (f'Subsetted to { subset_count } sample ids' )
87
+ logger . info (f'Subsetted to { subset_count } sample ids' )
84
88
mt = mt .semi_join_cols (sample_subset_ht )
85
89
return mt .filter_rows (hl .agg .any (hl .is_defined (mt .GT )))
0 commit comments