Skip to content

Instantly share code, notes, and snippets.

@tricead
tricead / TuiFilterer.py
Created April 2, 2020 17:32
A script to filter the MRCONSO table in the UMLS metathesaurus by the TUI semantic value in the MRSTY table
import csv
mrconso = open("/Path/MRCONSO.RRF", 'r')
mrsty = open("/Path/MRSTY.RRF", 'r')
cuituidict = {}
for line in mrsty.readlines():
splitline = line.split("|")
cui = splitline[0]
tui = splitline[1]
if(cuituidict.get(cui) == None):
cuituidict[cui] = [tui]