-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_nift.py
33 lines (22 loc) · 912 Bytes
/
build_nift.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# -*- coding: utf-8 -*-
"""A one-time script to get the old NIFT and make a more reasonable format for curation."""
from typing import Set
import pandas as pd
from bel_resources import get_bel_resource
NIFT_URL = 'https://raw.githubusercontent.com/neurommsig/neurommsig-terminology/master/terminologies/neuroimaging-feature-terminology.belns'
def get_nift_labels() -> Set[str]:
"""Map NIFT names that have been normalized to the original names."""
bel_resource = get_bel_resource(NIFT_URL)
return set(bel_resource['Values'])
def main():
labels = sorted(get_nift_labels())
df = pd.DataFrame(
[
(f'{i:05}', label, '', '', '')
for i, label in enumerate(labels, start=1)
],
columns=['Identifier', 'Name', 'Type', 'References', 'Description'],
)
df.to_csv('terms.tsv', sep='\t', index=False)
if __name__ == '__main__':
main()