<jupyter_start><jupyter_text>Load example dataThis loads example output files which can be used to create visualizations while the rest of the software is under construction. It will remove all previous outputs from the database.It requires the `sample_data_set` folder to be in the root, specified below.It requires at least one user to be created.<jupyter_code>import os
import json
from analysis import models
from myuser.models import User
example_root = os.path.abspath('/Users/shapiroaj4/Desktop/sample_data_set')
assert os.path.exists(example_root)
# get first user; you must create one if needed
user = User.objects.all()[0]
print(user.email)
# delete all the old stuff
models.FeatureList.objects.all().delete()
models.Analysis.objects.all().delete()
models.FeatureListCountMatrix.objects.all().delete()
fl = models.FeatureList.objects.create(
    owner=user,
    name='demo1',
    genome_assembly=1,
    stranded=True,
)
fl.dataset.name = os.path.join(example_root, 'unt1hr.obsTSS.bed')
fl.save()
with open(os.path.join(example_root, 'analysis_output.json'), 'r') as f:
    output = json.loads(f.read())
an = models.Analysis.objects.create(
    owner=user,
    name='demo1',
    genome_assembly=1,
    feature_list=fl,
    sort_vector=None,
    output=output
)
ds = models.EncodeDataset.objects.all()[0]
mat_dir = os.path.join(example_root, 'individual_matrices')
for fn in os.listdir(mat_dir):
    cm = models.FeatureListCountMatrix.objects.create(
        feature_list=fl,
        dataset=ds,
        matrix=os.path.join(mat_dir, fn)
    )
    
    adm = models.AnalysisDatasets.objects.create(
        analysis=an,
        dataset=ds,
        display_name=os.path.splitext(os.path.basename(fn)),
        count_matrix=cm
    )
    
    an.analysisdatasets_set.add(adm)
from django.core.urlresolvers import reverse
print(reverse('analysis:visual_testing', args=[an.id]))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1130890052356021, 'fraction_numerical': 0.004188481675392671, 'mean_word_length': 4.383098591549296, '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': '177856', 'license': 'MIT', 'n_tokens_mistral': 612, 'n_tokens_neox': 605, 'n_words': 140, 'path': 'notebooks/loadExampleData.ipynb', 'repo_name': 'NIEHS/orio-web', 'size': '1910'}