|
44 | 44 | # annotations and flags imports
|
45 | 45 | from flags import Flagger
|
46 | 46 | import xlsxwriter
|
| 47 | +# generate redcap |
| 48 | +from redcap_builder import RedCapper |
47 | 49 |
|
48 | 50 |
|
49 | 51 |
|
50 | 52 | ######################################################################################################################################################
|
51 | 53 | # assign software version
|
52 |
| -software_version = '4.4.4' |
| 54 | +software_version = '5.0.0' |
53 | 55 |
|
54 | 56 | ######################################################################################################################################################
|
55 | 57 | # data loading
|
|
963 | 965 | t13_hit_binary_output_file_path = os.path.join(rd_subfolder, f't13__{barcode_assignment}_hit_binary.csv')
|
964 | 966 | fl_t13_hit_binary_output.to_csv(t13_hit_binary_output_file_path, index=True)
|
965 | 967 |
|
966 |
| - |
967 |
| -""" |
968 |
| -### FILE 1: t13_hit_output as Results_Summary |
969 |
| -# convert the t13 hit output to an excel file with green/red conditional formatting for NEG/POS results |
970 |
| -t13_hit_output_file_path = os.path.join(res_subfolder, f'Results_Summary_{barcode_assignment}.xlsx') |
971 |
| -
|
972 |
| -# create the Excel writer |
973 |
| -with pd.ExcelWriter(t13_hit_output_file_path, engine="openpyxl") as writer: |
974 |
| - # write the DataFrame to an Excel sheet |
975 |
| - fl_t13_hit_output.to_excel(writer, sheet_name="Sheet1", index=True) |
976 |
| - workbook = writer.book |
977 |
| - worksheet = writer.sheets["Sheet1"] |
978 |
| -
|
979 |
| - # define font colors for POSITIVE and NEGATIVE |
980 |
| - red_font = Font(color="FF0000", bold=True) # Red for POSITIVE |
981 |
| - green_font = Font(color="008000") # Green for NEGATIVE |
982 |
| -
|
983 |
| - # apply text color formatting |
984 |
| - for row_idx, row in enumerate(t13_hit_output.values, start=3): # Start from row 3 (after header and INVALID ASSAY label) |
985 |
| - for col_idx, cell_value in enumerate(row, start=2): |
986 |
| - cell = worksheet.cell(row=row_idx, column=col_idx) |
987 |
| - if cell_value == "POSITIVE": |
988 |
| - cell.font = red_font |
989 |
| - elif cell_value == "NEGATIVE": |
990 |
| - cell.font = green_font |
991 |
| -
|
992 |
| -### FILE 2: rounded_t13_quant_norm as NTC_Quant_Normalized_Results |
993 |
| -quant_output_ntcNorm_file_path = os.path.join(res_subfolder, f'NTC_Normalized_Quantitative_Results_Summary_{barcode_assignment}.csv') |
994 |
| -fl_rounded_t13_quant_norm.to_csv(quant_output_ntcNorm_file_path, index=True) |
995 |
| -
|
996 |
| -### File 3: summary_samples_df as Positives_Summary |
997 |
| -summary_pos_samples_file_path = os.path.join(res_subfolder, f'Positives_Summary_{barcode_assignment}.csv') |
998 |
| -fl_summary_samples_df.to_csv(summary_pos_samples_file_path, index=True) |
999 |
| -
|
1000 |
| -### File 4: ntc_thresholds_output as NTC_Thresholds |
1001 |
| -ntc_thresholds_output_file_path = os.path.join(res_subfolder, f'NTC_thresholds_{barcode_assignment}.csv') |
1002 |
| -fl_rounded_ntc_thresholds_output.to_csv(ntc_thresholds_output_file_path, index=True) |
1003 |
| -
|
1004 |
| -### File 5: t13_hit_binary_output as t13_hit_Binary |
1005 |
| -t13_hit_binary_output_file_path = os.path.join(rd_subfolder, f't13__{barcode_assignment}_hit_binary.csv') |
1006 |
| -fl_t13_hit_binary_output.to_csv(t13_hit_binary_output_file_path, index=True) |
1007 |
| -
|
1008 |
| -""" |
| 968 | + |
1009 | 969 | ######################################################################################################################################################
|
1010 | 970 | # instantiate Plotter from plotting.py
|
1011 | 971 | heatmap_generator = Plotter()
|
|
1042 | 1002 |
|
1043 | 1003 | print("Operation complete.")
|
1044 | 1004 |
|
| 1005 | + |
| 1006 | +###################################################################################################################################################### |
| 1007 | +# RedCap Integration |
| 1008 | +# set it as you have to enter a CLI for Redcap to run this code |
| 1009 | + |
| 1010 | +# if CLI[1] |
| 1011 | + |
| 1012 | + |
| 1013 | +# instantiate RedCapper from flags.py |
| 1014 | +redcapper = RedCapper() |
| 1015 | + |
| 1016 | +# make copy of binary output file from RESULTS Excel sheet |
| 1017 | +fl_t13_hit_binary_output_2 = fl_t13_hit_binary_output.copy() |
| 1018 | + |
| 1019 | +redcap_t13_hit_binary_output = redcapper.build_redcap(fl_t13_hit_binary_output_2) |
| 1020 | + |
| 1021 | +redcap_t13_hit_binary_output_file_path = os.path.join(res_subfolder, f'REDCAP_{barcode_assignment}.csv') |
| 1022 | +redcap_t13_hit_binary_output.to_csv(redcap_t13_hit_binary_output_file_path, index=True) |
| 1023 | + |
| 1024 | + |
0 commit comments