# Usage: python3 make_experiment_library_info_file.py # # Purpose: build a file (see EXPERIMENT_LIBRARY_INFO_FILE) that tells whether an experiment is RNA-seq. # # 2025-10-28, hui from configure import EXPERIMENT_LIBRARY_INFO_FILE, EXPERIMENT_INFO_DIR from parse_ena_xml import parse_experiment import glob, os result = [] for fname in sorted(glob.glob(os.path.join(EXPERIMENT_INFO_DIR, '*'))): _, experiment_id = os.path.split(fname) d = parse_experiment(fname) result.append([experiment_id, d[experiment_id]['library_strategy'], d[experiment_id]['library_source']]) print(f'Saving to {EXPERIMENT_LIBRARY_INFO_FILE}') with open(EXPERIMENT_LIBRARY_INFO_FILE, 'a') as f: for x in result: f.write('\t'.join(x) + '\n') print('Done. Saved %d lines.' % (len(result)))