<jupyter_start><jupyter_text>Parses GTF files<jupyter_code>%load_ext autoreload
%autoreload 2
%matplotlib inline
import glob
import sys
sys.path.append('../linker')

from GTF import lines, dataframe, parse
gene_names = {}
for filename in sorted(glob.glob("/Users/joewandy/Downloads/gtf_to_parse/*.gtf.gz")):

    collision = 0
    try:
        gtf_dict = lines(filename)
        for d in gtf_dict:
            try:
                gene_id = d['gene_id']
                gene_name = d['gene_name']
                gene_names[gene_id] = gene_name
            except KeyError:
                continue
    except IndexError:
        continue
    finally:
        print(filename, len(gene_names))                
import pickle
pickle.dump(gene_names, open('../static/data/gene_names.p', 'wb'))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10744810744810745, 'fraction_numerical': 0.002442002442002442, 'mean_word_length': 2.4893617021276597, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '504601', 'license': 'MIT', 'n_tokens_mistral': 278, 'n_tokens_neox': 265, 'n_words': 54, 'path': 'graphomics/notebooks/mapping/parse_gtf.ipynb', 'repo_name': 'joewandy/omics_integration', 'size': '819'}