@@ -1049,6 +1049,10 @@ def update_clinical_master_file(InPreD_clinical_data_file,sample_id,if_generate_
10491049 global runID
10501050 if_exist = False
10511051 new_content = ""
1052+ if (ipd_gender != "" and ipd_gender != "X" ):
1053+ gender = ipd_gender [0 ]
1054+ else :
1055+ gender = ""
10521056 if (encoding_sys != "" ):
10531057 fr = open (InPreD_clinical_data_file , 'r' , encoding = encoding_sys )
10541058 else :
@@ -1060,7 +1064,7 @@ def update_clinical_master_file(InPreD_clinical_data_file,sample_id,if_generate_
10601064 for ln in fr :
10611065 if (ln .split ('\t ' )[0 ] == sample_id ):
10621066 if_exist = True
1063- line = '\t ' .join ([sample_id , runID , if_generate_report , ipd_birth_year , ipd_diagnosis_year , clinical_diagnosis , ipd_gender [ 0 ] , ipd_consent , material_id , ipd_collection_year , requisition_hospital , extraction_hospital , str (tumor_content_nr ), batch_nr , pathology_comment , sample_info_comment + '\n ' ])
1067+ line = '\t ' .join ([sample_id , runID , if_generate_report , ipd_birth_year , ipd_diagnosis_year , clinical_diagnosis , gender , ipd_consent , material_id , ipd_collection_year , requisition_hospital , extraction_hospital , str (tumor_content_nr ), batch_nr , pathology_comment , sample_info_comment + '\n ' ])
10641068 new_line = ln .replace (ln ,line )
10651069 new_content = new_content + new_line
10661070 else :
@@ -1071,7 +1075,7 @@ def update_clinical_master_file(InPreD_clinical_data_file,sample_id,if_generate_
10711075 else :
10721076 fa = open (InPreD_clinical_data_file , 'a' )
10731077 if (if_exist == False ):
1074- line = '\t ' .join ([sample_id , runID , if_generate_report , ipd_birth_year , ipd_diagnosis_year , clinical_diagnosis , ipd_gender [ 0 ] , ipd_consent , material_id , ipd_collection_year , requisition_hospital , extraction_hospital , str (tumor_content_nr ), batch_nr , pathology_comment , sample_info_comment + '\n ' ])
1078+ line = '\t ' .join ([sample_id , runID , if_generate_report , ipd_birth_year , ipd_diagnosis_year , clinical_diagnosis , gender , ipd_consent , material_id , ipd_collection_year , requisition_hospital , extraction_hospital , str (tumor_content_nr ), batch_nr , pathology_comment , sample_info_comment + '\n ' ])
10751079 if (encoding_sys != "" ):
10761080 fa = open (InPreD_clinical_data_file , 'a' , encoding = encoding_sys )
10771081 else :
@@ -1094,6 +1098,10 @@ def update_clinical_tsoppi_file(InPreD_clinical_tsoppi_data_file,sample_id,if_ge
10941098 RNA_DNA_tumor_normal = ""
10951099 global ipd_diagnosis_year
10961100 global runID
1101+ if (ipd_gender != "" and ipd_gender != "X" ):
1102+ gender = ipd_gender [0 ]
1103+ else :
1104+ gender = ""
10971105 try :
10981106 sample_type = sample_type .replace ("\n " , "" )
10991107 except :
@@ -1109,14 +1117,14 @@ def update_clinical_tsoppi_file(InPreD_clinical_tsoppi_data_file,sample_id,if_ge
11091117 for ln in fr :
11101118 if (ln .split ('\t ' )[0 ] == sample_id ):
11111119 if_exist = True
1112- line = '\t ' .join ([sample_id , runID , if_generate_report , ipd_birth_year , ipd_diagnosis_year , clinical_diagnosis , ipd_gender [ 0 ] , ipd_consent , material_id , ipd_collection_year , requisition_hospital , extraction_hospital , str (tumor_content_nr ), batch_nr , sample_material , sample_type , tumor_type , str (TMB_DRUP ), TMB_TSO500 , MSI_TSO500 , pipline , pathology_comment , sample_info_comment + '\n ' ])
1120+ line = '\t ' .join ([sample_id , runID , if_generate_report , ipd_birth_year , ipd_diagnosis_year , clinical_diagnosis , gender , ipd_consent , material_id , ipd_collection_year , requisition_hospital , extraction_hospital , str (tumor_content_nr ), batch_nr , sample_material , sample_type , tumor_type , str (TMB_DRUP ), TMB_TSO500 , MSI_TSO500 , pipline , pathology_comment , sample_info_comment + '\n ' ])
11131121 new_line = ln .replace (ln ,line )
11141122 new_content = new_content + new_line
11151123 else :
11161124 new_content = new_content + ln
11171125 fr .close ()
11181126 if (if_exist == False ):
1119- line = '\t ' .join ([sample_id , runID , if_generate_report , ipd_birth_year , ipd_diagnosis_year , clinical_diagnosis , ipd_gender [ 0 ] , ipd_consent , material_id , ipd_collection_year , requisition_hospital , extraction_hospital , str (tumor_content_nr ), batch_nr , sample_material , sample_type , tumor_type , str (TMB_DRUP ), TMB_TSO500 , MSI_TSO500 , pipline , pathology_comment , sample_info_comment + '\n ' ])
1127+ line = '\t ' .join ([sample_id , runID , if_generate_report , ipd_birth_year , ipd_diagnosis_year , clinical_diagnosis , gender , ipd_consent , material_id , ipd_collection_year , requisition_hospital , extraction_hospital , str (tumor_content_nr ), batch_nr , sample_material , sample_type , tumor_type , str (TMB_DRUP ), TMB_TSO500 , MSI_TSO500 , pipline , pathology_comment , sample_info_comment + '\n ' ])
11201128 with open (InPreD_clinical_tsoppi_data_file , 'a' ) as fa :
11211129 fa .write (line )
11221130 fa .close ()
0 commit comments