Skip to content
Snippets Groups Projects
Commit 26bffa3f authored by Schneider Leo's avatar Schneider Leo
Browse files

empty line fix

parent 56dc4e78
No related branches found
No related tags found
No related merge requests found
...@@ -8,15 +8,16 @@ def fasta_like_to_data(path): ...@@ -8,15 +8,16 @@ def fasta_like_to_data(path):
file = open(path, "r") file = open(path, "r")
content = file.readlines() content = file.readlines()
file.close() file.close()
return content res = []
for l in content :
if l!='\n':
res.append(l)
return res
def strip_lines(s): def strip_lines(s):
s = s.strip('\n') s = s.strip('\n')
try : s = s.split(' ')[1]
s = s.split(' ')[1] return s
return s
except:
return 'unidentifid seq error'
def main(input_data_path): def main(input_data_path):
print('Reading file') print('Reading file')
...@@ -80,9 +81,9 @@ def main(input_data_path): ...@@ -80,9 +81,9 @@ def main(input_data_path):
'Predicted class':label_multi}) 'Predicted class':label_multi})
print('Saving output') 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') print('Writting final file')
i,j=0,1 i,j=0,1
...@@ -96,8 +97,9 @@ def main(input_data_path): ...@@ -96,8 +97,9 @@ def main(input_data_path):
i+=1 i+=1
j+=1 j+=1
else : else :
print(l)
i+=1 i+=1
new_file.close() new_file.close()
if __name__ == '__main__': if __name__ == '__main__':
main('250107_FASTA_RP_GroEL_GroES_Tuf_5pct_assemble_peptides_list.txt') main('250107_FASTA_RP_GroEL_GroES_Tuf_5pct_assemble_peptides_list.txt')
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment