Skip to content

Commit

Permalink
parts.csv for synthesis
Browse files Browse the repository at this point in the history
  • Loading branch information
Koeng101 committed Oct 15, 2024
1 parent f5e97f3 commit b6260cf
Show file tree
Hide file tree
Showing 2 changed files with 222 additions and 0 deletions.
31 changes: 31 additions & 0 deletions parts/make_csv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
import yaml
import csv
import sys

def process_yaml_files(directory):
data = []
for filename in os.listdir(directory):
if filename.endswith('.yaml'):
with open(os.path.join(directory, filename), 'r') as file:
yaml_data = yaml.safe_load(file)
for name, gene in yaml_data.items():
sequence = gene['prefix'] + gene['sequence'].lower() + gene['suffix']
data.append({
'name': name,
'vector': 'pOpen_v3',
'type': 'dna',
'sequence': sequence
})
return data

def print_csv(data):
writer = csv.DictWriter(sys.stdout, fieldnames=['name', 'vector', 'type', 'sequence'])
writer.writeheader()
for row in data:
writer.writerow(row)

if __name__ == '__main__':
directory = './parts'
yaml_data = process_yaml_files(directory)
print_csv(yaml_data)
Loading

0 comments on commit b6260cf

Please sign in to comment.