Skip to content

Commit e0a6cc7

Browse files
committed
v5.1.1
1 parent 72062c6 commit e0a6cc7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

redcap_builder.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,12 @@ def merge_group(group):
3939

4040
return merged_row
4141

42+
### format input flagged t13 binary hit file
43+
redcap_t13_hit_binary_output = fl_t13_hit_binary_output_2.copy()
44+
redcap_t13_hit_binary_output = redcap_t13_hit_binary_output.astype(str)
45+
4246
### convert 0 to 2 (negative)
43-
redcap_t13_hit_binary_output = fl_t13_hit_binary_output_2.replace(0, 2)
47+
redcap_t13_hit_binary_output = redcap_t13_hit_binary_output.replace(to_replace=r'^0.*', value=2, regex=True)
4448

4549
### drop any rows incl and below 'Summary' row
4650
if 'Summary' in redcap_t13_hit_binary_output.index:
@@ -64,7 +68,7 @@ def merge_group(group):
6468
test_redcap_t13_hit_binary_output.loc[cont_ntc_sample, cont_ntc_assay] = '6'
6569
"""
6670
redcap_t13_hit_binary_output = redcap_t13_hit_binary_output.astype(str)
67-
redcap_t13_hit_binary_output = redcap_t13_hit_binary_output.applymap(lambda x: '6' if '†' in x else x)
71+
redcap_t13_hit_binary_output = redcap_t13_hit_binary_output.map(lambda x: '6' if '†' in x else x)
6872

6973

7074

@@ -98,7 +102,7 @@ def merge_group(group):
98102
### add columns for the assay that wasn't run with since REDCAP format needs all assays (RVP and BBP) headers in
99103
bbp_assays = ['CCHFV', 'CHI', 'DENV', 'EBOV', 'HBV_DNA', 'HCV', 'HIV_1', 'HIV_2', 'HTV', 'LASV', 'MBV', 'MMV',
100104
'MPOX_DNA', 'ONN', 'PF_3_DNA', 'RBV', 'RVFV', 'SYPH_DNA', 'WNV', 'YFV', 'ZIKV']
101-
rvp_assays = ['SARS-COV-2', 'HCOV-HKU1', 'HCOV-NL63', 'HCOV-OC43', 'FLUAV', 'FLUBV', 'HMPV', 'HRSV', 'HPIV-3']
105+
rvp_assays = ['SARS_COV-2', 'HCOV_HKU1', 'HCOV_NL63', 'HCOV_OC43', 'FLUAV', 'FLUBV', 'HMPV', 'HRSV', 'HPIV_3']
102106
# set column order
103107
column_order = bbp_assays + rvp_assays + ['RNASEP_P1','RNASEP_P2']
104108
# when adding the new columns, enter the value as 4 (not run)

0 commit comments

Comments
 (0)