import pickle


def load_fragGC_pickle(inFH):
    """Loading fragGC info assuming a pickled python object
    produced by SIPSim fragGC.
    
    Parameters
    ----------
    inFH : file handle
    
    Returns
    -------
    fragGC object
    """
    fojb =  pickle.load(inFH)

    d = dict()
    for x in fojb:
        taxon_name = x[0]
        d[taxon_name] = dict()
        d[taxon_name]['fragLength'] = []
        d[taxon_name]['fragGC'] = []
            
        for scaf,v in x[1].items():            
            for z in v:
                # fragStart, fragLength, fragGC
                d[taxon_name]['fragLength'].append(z[1])
                d[taxon_name]['fragGC'].append(z[2])                
    return d