Files
eDNA_Stream_E01/create_species_yaml.py
T
2026-09-17 22:16:42 +01:00

14 lines
554 B
Python

"""
Converts a txt file with species of interest and comments (1 per line) into the yaml format expected by the workflow
"""
LEADING_SPACE = ' '
if __name__ == '__main__':
with open('reference/species_list.txt','rt') as ih, open('reference/species_list.yaml','wt') as oh:
oh.write('species_list:\n')
for line in ih:
if line.startswith('#'):
oh.write(LEADING_SPACE+line.strip()+'\n')
continue
oh.write(LEADING_SPACE+'- '+'_'.join(x.lower() for x in line.strip().split())+'\n')