<jupyter_start><jupyter_text>Basic examples using pygoa Note: if pygoa is not installed (e.g. via pip), being at /Users/msicilia/Desktop/dev/pygoa is the only way to import things smoothly, so %pwd and %cd if needed.<jupyter_code>%cd ..
from pygoa import GOSnapshot, to_df
from datetime import date
import sys

summaries = []


for year in [2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015]:
    for d in [date(year, m, 1) for m in range(1, 13)]:
        try:
            sp = GOSnapshot(date=d.strftime("%Y-%m-%d"))
            print(sp.summary.nterms, sp.summary.nchildren)
            summaries.append(sp.summary)
        except IOError:
            print("File not available for date:", d, sys.exc_info())
        except:
            print(sys.exc_info())
df = to_df(summaries)
df
term = sp["GO:0019443"]
#term = sp["GO:0019442"]
from pronto import Ontology, Relationship
len(term.relations)
print(term.relations)
term.other
df.to_csv("summarygo.csv")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12740141557128412, 'fraction_numerical': 0.054600606673407485, 'mean_word_length': 3.4594594594594597, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '338471', 'license': 'MIT', 'n_tokens_mistral': 393, 'n_tokens_neox': 339, 'n_words': 98, 'path': 'notebooks/basic_testing.ipynb', 'repo_name': 'msicilia/pygoa', 'size': '989'}