From 26bffa3f8146d71f3bef2b13bc08be829c573d43 Mon Sep 17 00:00:00 2001 From: Schneider Leo <leo.schneider@etu.ec-lyon.fr> Date: Wed, 8 Jan 2025 15:36:21 +0100 Subject: [PATCH] empty line fix --- main.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/main.py b/main.py index 54f2c28..cc98a85 100644 --- a/main.py +++ b/main.py @@ -8,15 +8,16 @@ def fasta_like_to_data(path): file = open(path, "r") content = file.readlines() file.close() - return content + res = [] + for l in content : + if l!='\n': + res.append(l) + return res def strip_lines(s): s = s.strip('\n') - try : - s = s.split(' ')[1] - return s - except: - return 'unidentifid seq error' + s = s.split(' ')[1] + return s def main(input_data_path): print('Reading file') @@ -80,9 +81,9 @@ def main(input_data_path): 'Predicted class':label_multi}) print('Saving output') - result.to_csv(input_data_path.strip('.txt')+'_detectability.csv',index=False) #Output du model dans le fichier 'prediction_detectability.csv' + result.to_csv(input_data_path.strip('.txt')+'t_detectability.csv',index=False) #Output du model dans le fichier 'prediction_detectability.csv' - new_file = open(input_data_path.strip('.txt')+'_filtered.txt','w') + new_file = open(input_data_path.strip('.txt')+'t_filtered.txt','w') print('Writting final file') i,j=0,1 @@ -96,8 +97,9 @@ def main(input_data_path): i+=1 j+=1 else : + print(l) i+=1 new_file.close() if __name__ == '__main__': - main('250107_FASTA_RP_GroEL_GroES_Tuf_5pct_assemble_peptides_list.txt') \ No newline at end of file + main('250107_FASTA_RP_GroEL_GroES_Tuf_5pct_assemble_peptides_list.txt') -- GitLab