@@ -333,7 +333,9 @@ def get_patient_info_from_MTF_2023(ipd_material_file,ipd_no,DNA_sampleID,RNA_sam
333333 except :
334334 ipd_birth_year = "-"
335335 if (sheet_material .cell_value (r ,c ) == columns ['gender' ] and ipd_gender == "" ):
336- ipd_gender = str (sheet_material .cell_value (r + 2 ,c ))
336+ gender = str (sheet_material .cell_value (r + 2 ,c ))
337+ if (gender != "" and gender != "X" ):
338+ ipd_gender = gender [0 ]
337339 if (sheet_material .cell_value (r ,c ) == columns ['age' ]):
338340 ipd_age = str (sheet_material .cell_value (r + 2 ,c ))
339341 if (sheet_material .cell_value (r ,c ) == columns ['consent' ] and ipd_consent == "" ):
@@ -465,7 +467,9 @@ def get_patient_info_from_MTF_new(ipd_material_file,ipd_no,DNA_sampleID,RNA_samp
465467 except :
466468 ipd_birth_year = "-"
467469 if (sheet_material .cell_value (r ,c ) == columns ['gender' ] and ipd_gender == "" ):
468- ipd_gender = str (sheet_material .cell_value (r + 2 ,c ))
470+ gender = str (sheet_material .cell_value (r + 2 ,c ))
471+ if (gender != "" and gender != "X" ):
472+ ipd_gender = gender [0 ]
469473 if (sheet_material .cell_value (r ,c ) == columns ['age' ]):
470474 ipd_age = str (sheet_material .cell_value (r + 2 ,c ))
471475 if (sheet_material .cell_value (r ,c ) == columns ['Histopathological_diagnosis' ] and sheet_material .cell_value (r + 1 ,c ) != "" ):
@@ -563,10 +567,6 @@ def get_RNA_material_id(InPreD_clinical_data_file,RNA_sampleID,encoding_sys):
563567
564568
565569def update_ppt_template_data (inpred_node ,ipd_no ,ipd_gender ,ipd_age ,ipd_diagnosis_year ,DNA_material_id ,RNA_material_id ,ipd_consent ,requisition_hospital ,pathology_comment ,ipd_clinical_diagnosis ,tumor_type ,sample_type ,sample_material ,sample_info_comment ,pipline ,tumor_content ,ppt_template ,output_ppt_file ):
566- if (ipd_gender != "" and ipd_gender != "X" ):
567- gender = ipd_gender [0 ]
568- else :
569- gender = ""
570570 if (ipd_age != "" and ipd_age != "-" and ipd_age != "XX" and ipd_age != "<1" ):
571571 age = str (int (float (ipd_age )))
572572 else :
@@ -680,7 +680,7 @@ def update_ppt_template_data(inpred_node,ipd_no,ipd_gender,ipd_age,ipd_diagnosis
680680 tf11 .paragraphs [0 ].text = pathology_comment + "\n \n " + sample_info_comment .replace ("|" ,"\n " )
681681 tf11 .paragraphs [0 ].font .size = Pt (10 )
682682 tf11 .paragraphs [0 ].alignment = PP_ALIGN .LEFT
683- gender_age = gender + '/' + age + 'y'
683+ gender_age = "{} / {} y '. format ( ipd_gender , age )
684684 if (RNA_material_id != "" ):
685685 ipd_material_id_index = "DNA:" + DNA_material_id + "\nRNA:" + RNA_material_id
686686 else:
@@ -1070,7 +1070,7 @@ def update_clinical_master_file(InPreD_clinical_data_file,sample_id,if_generate_
10701070 for ln in fr:
10711071 if(ln.split('\t')[0] == sample_id):
10721072 if_exist = True
1073- 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 ' ])
1073+ line = '\t'.join([sample_id, runID, if_generate_report, ipd_birth_year, ipd_diagnosis_year, clinical_diagnosis, ipd_gender, ipd_consent, material_id, ipd_collection_year, requisition_hospital, extraction_hospital, str(tumor_content_nr), batch_nr, pathology_comment, sample_info_comment + '\n'])
10741074 new_line = ln.replace(ln,line)
10751075 new_content = new_content + new_line
10761076 else:
@@ -1081,7 +1081,7 @@ def update_clinical_master_file(InPreD_clinical_data_file,sample_id,if_generate_
10811081 else:
10821082 fa = open(InPreD_clinical_data_file, 'a')
10831083 if(if_exist == False):
1084- 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 ' ])
1084+ line = '\t'.join([sample_id, runID, if_generate_report, ipd_birth_year, ipd_diagnosis_year, clinical_diagnosis, ipd_gender, ipd_consent, material_id, ipd_collection_year, requisition_hospital, extraction_hospital, str(tumor_content_nr), batch_nr, pathology_comment, sample_info_comment + '\n'])
10851085 if(encoding_sys != ""):
10861086 fa = open(InPreD_clinical_data_file, 'a', encoding=encoding_sys)
10871087 else:
@@ -1119,14 +1119,14 @@ def update_clinical_tsoppi_file(InPreD_clinical_tsoppi_data_file,sample_id,if_ge
11191119 for ln in fr:
11201120 if(ln.split('\t')[0] == sample_id):
11211121 if_exist = True
1122- 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 ' ])
1122+ line = '\t'.join([sample_id, runID, if_generate_report, ipd_birth_year, ipd_diagnosis_year, clinical_diagnosis, ipd_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'])
11231123 new_line = ln.replace(ln,line)
11241124 new_content = new_content + new_line
11251125 else:
11261126 new_content = new_content + ln
11271127 fr.close()
11281128 if(if_exist == False):
1129- 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 ' ])
1129+ line = '\t'.join([sample_id, runID, if_generate_report, ipd_birth_year, ipd_diagnosis_year, clinical_diagnosis, ipd_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'])
11301130 with open(InPreD_clinical_tsoppi_data_file, 'a') as fa:
11311131 fa.write(line)
11321132 fa.close()
0 commit comments