def get_subtype_reference_alignment_entropy_syn(region, subtype='B', VERBOSE=0, refname='HXB2', type='nuc'): '''Get the entropy of a large subtype reference alignment''' import cPickle as pickle fn = get_subtype_reference_alignment_entropy_syn_filename(region, subtype=subtype, refname=refname, type=type, VERBOSE=VERBOSE) with open(fn, 'r') as f: data = pickle.load(f) return data
def get_subtype_reference_alignment_entropy_syn(region, subtype='B', VERBOSE=0, refname='HXB2', type='nuc'): '''Get the entropy of a large subtype reference alignment''' import cPickle as pickle fn = get_subtype_reference_alignment_entropy_syn_filename(region, subtype=subtype, refname=refname, type=type, VERBOSE=VERBOSE) with open(fn, 'r') as f: data = pickle.load(f) return data
if VERBOSE >= 2: print 'Get alignment' ali = get_subtype_reference_alignment(region, subtype=subtype, refname=refname, VERBOSE=VERBOSE) alim = np.array(ali, 'S1') if VERBOSE >= 2: print 'Compute entropy' S = get_ali_entropy_syn(alim, VERBOSE=VERBOSE) if VERBOSE >= 2: print 'Store to file' fn_out = get_subtype_reference_alignment_entropy_syn_filename(region, subtype=subtype, refname=refname, VERBOSE=VERBOSE) with open(fn_out, 'wb') as f: pickle.dump(S, f) else: if VERBOSE >= 2: print 'Get entropy from file' S = get_subtype_reference_alignment_entropy_syn(region, subtype=subtype, refname=refname, VERBOSE=VERBOSE) Ss[region] = S
if VERBOSE >= 2: print 'Get alignment' ali = get_subtype_reference_alignment(region, subtype=subtype, refname=refname, VERBOSE=VERBOSE) alim = np.array(ali, 'S1') if VERBOSE >= 2: print 'Compute entropy' S = get_ali_entropy_syn(alim, VERBOSE=VERBOSE) if VERBOSE >= 2: print 'Store to file' fn_out = get_subtype_reference_alignment_entropy_syn_filename( region, subtype=subtype, refname=refname, VERBOSE=VERBOSE) with open(fn_out, 'wb') as f: pickle.dump(S, f) else: if VERBOSE >= 2: print 'Get entropy from file' S = get_subtype_reference_alignment_entropy_syn(region, subtype=subtype, refname=refname, VERBOSE=VERBOSE) Ss[region] = S