<commit_before>import logging
import mtcorr
import statistics as stats
import math
import h5py
import numpy
import sys


log = logging.getLogger(__name__)


def load_from_hdf5(filename):
    f = h5py.File(filename,'r') 
    quantiles_dict = {}
    stats =  {}
    quantiles_dict['exp_quantiles'] = f['quantiles']['quantiles'][:,0].tolist()
    quantiles_dict['quantiles'] = f['quantiles']['quantiles'][:,1].tolist()
    quantiles_dict['exp_log_quantiles'] = f['quantiles']['log_quantiles'][:,0].tolist()
    quantiles_dict['log_quantiles'] = f['quantiles']['log_quantiles'][:,1].tolist()
    stats['quantiles_dict'] = quantiles_dict
    pvals_group = f['pvalues']
    method = pvals_group.attrs['analysis_method']
    transformation = pvals_group.attrs['transformation']
    stats['ks_stats'] = {'D':pvals_group.attrs['ks_stat']}
    stats['ks_stats']['p_val'] = pvals_group.attrs['ks_pval']
    stats['med_pval'] =  pvals_group.attrs['med_pval'] 
    stats['bh_thres_d'] = {'thes_pval': math.pow(10,-pvals_group.attrs['bh_thres'])}
    chromosomes = []
    positions = []
    scores = []<commit_msg>Bugfix: Avoid throwing error when stats are missing<commit_after>import logging
import mtcorr
import statistics as stats
import math
import h5py
import numpy
import sys


log = logging.getLogger(__name__)


def load_from_hdf5(filename):
    f = h5py.File(filename,'r') 
    quantiles_dict = {}
    stats =  {}
    if 'quantiles' in f:
        quantiles_dict['exp_quantiles'] = f['quantiles']['quantiles'][:,0].tolist()
        quantiles_dict['quantiles'] = f['quantiles']['quantiles'][:,1].tolist()
        quantiles_dict['exp_log_quantiles'] = f['quantiles']['log_quantiles'][:,0].tolist()
        quantiles_dict['log_quantiles'] = f['quantiles']['log_quantiles'][:,1].tolist()
        stats['quantiles_dict'] = quantiles_dict
    pvals_group = f['pvalues']
    method = pvals_group.attrs.get('analysis_method','')
    transformation = pvals_group.get('transformation','')
    if 'ks_stat' in pvals_group.attrs:
        stats['ks_stats'] = {'D':pvals_group.attrs['ks_stat']}
    if 'ks_pval' in pvals_group.attrs:
        stats['ks_stats']['p_val'] = pvals_group.attrs['ks_pval']
    if 'med_pval' in pvals_group.attrs:
        stats['med_pval'] =  pvals_group.attrs['med_pval'] 
    if 'bh_thres' in pvals_group.attrs:
        stats['bh_thres_d'] = {'thes_pval': math.pow(10,-pvals_group.attrs['bh_thres'])}
    chromosomes = []
    positions = []
    scores = []
{'fraction_non_alphanumeric': 0.16754563894523328, 'fraction_numerical': 0.007302231237322515, 'mean_word_length': 4.775175644028103, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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}}
{'dir': 'git-commits-cleaned', 'id': '6305373', 'n_tokens_mistral': 862, 'n_tokens_neox': 856, 'n_words': 131}