Location: SLC transporters @ 6625532496cd / src / mergeData_GLUT2.py

Author:
Weiwei Ai <wai484@aucklanduni.ac.nz>
Date:
2024-05-27 12:37:21+12:00
Desc:
Update figures and submodule sedCellML
Permanent Source URI:
https://models.physiomeproject.org/workspace/b65/rawfile/6625532496cd4d09db3c72278c24fe5ef8cf84cd/src/mergeData_GLUT2.py

import os
current_dir = os.path.dirname(os.path.abspath(__file__))
csv_files = []
model_name = 'GLUT2_BG'
path_=os.path.join(current_dir, '../Facilitated transporter/CellMLV2/sim_results/')
for model_id in range(250):
    sed_model_id = model_name+f'_{model_id}_io'
    csv_files.append(path_+'report_task_'+f'{sed_model_id}'+'.csv')
# only remove the first line of the second and subsequent files
# if the file exists, delete it first
io_csv = path_+f'{model_name}_ss_io.csv'
if os.path.exists(io_csv):
    os.remove(io_csv)
with open(io_csv, 'w') as file:
    for csv_file in csv_files:
        with open(csv_file, 'r') as f:
            if csv_file == csv_files[0]:
                file.write(f.read())
            else:
                f.readline()
                file.write(f.read())

csv_files = []
for model_id in range(250):
    sed_model_id = model_name+f'_{model_id}_oi'
    csv_files.append(path_+'report_task_'+f'{sed_model_id}'+'.csv')
# only remove the first line of the second and subsequent files
oi_csv = path_+f'{model_name}_ss_oi.csv'
if os.path.exists(oi_csv):
    os.remove(oi_csv)
with open(oi_csv, 'w') as file:
    for csv_file in csv_files:
        with open(csv_file, 'r') as f:
            if csv_file == csv_files[0]:
                file.write(f.read())
            else:
                f.readline()
                file.write(f.read())