blob: 957894501c3998c93b5f2bb3da31ae147a2cc4b7 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 | # 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)))
 |