def setup_class(cls): fpath = directory / 'test_data' / 'simulated_data.csv' cls.data = txt_to_np(fpath, delimiter=',') cls.data['end'] += 1 # because this simulated data is in old format of inclusive, inclusive cls.sequence = 'XXXXTPPRILALSAPLTTMMFSASALAPKIXXXXLVIPWINGDKG' cls.timepoints = [0.167, 0.5, 1, 5, 10, 30, 100] cls.start, cls.end = 5, 46 # total span of protein (inc, excl) cls.nc_start, cls.nc_end = 31, 35 # span of no coverage area (inc, inc)
data = read_dynamx(fpath) sequence = 'XXXXTPPRILALSAPLTTMMFSASALAPKIXXXXLVIPWINGDKG' timepoints = [0.167, 0.5, 1, 5, 10, 30, 100] start, end = 5, 45 # total span of protein (inc, inc) nc_start, nc_end = 31, 34 # span of no coverage area (inc, inc) pmt = PeptideMasterTable(data, drop_first=1, ignore_prolines=True, remove_nan=False) pmt.set_backexchange(0.) states = pmt.groupby_state() series = states['state1'] print(series.scores_peptides.T.shape) print(series.uptake_corrected.shape) ## N_t, N_p print(series.cov.X.shape) print(series.cov.X) print(series.cov.Z) fmt, hdr = fmt_export(series.cov.data) np.savetxt('tempfile.txt', series.cov.data, fmt=fmt, header=hdr) Z = series.cov.Z print(np.sum(Z, axis=1)) init_arr = txt_to_np(os.path.join(fit_dir, 'fit_simulated_wt_avg.txt'))
from pyhdx.fileIO import read_dynamx, txt_to_np, fmt_export from pyhdx.models import PeptideMasterTable from numpy.lib.recfunctions import append_fields import numpy as np array = txt_to_np('test_data/simulated_data.csv', delimiter=',') data = read_dynamx('test_data/simulated_data.csv') print(array.dtype.names) print(data.dtype.names) pmt = PeptideMasterTable(array, drop_first=0, ignore_prolines=False, remove_nan=False) print(pmt.data.dtype.names) uptake = pmt.data['ex_residues'] * pmt.data['scores'] / 100 for u, m in zip(uptake, pmt.data['ex_residues']): print(u, m) extended = append_fields(pmt.data, ['uptake'], [uptake], usemask=False) fields = ('start', 'end', 'exposure', 'state', 'sequence', 'ex_residues', 'uptake') dtype = [(name, extended[name].dtype) for name in fields] export = np.empty_like(uptake, dtype=dtype) for name in fields: export[name] = extended[name] fmt, hdr = fmt_export(export, delimiter=',', width=0) np.savetxt('test.txt', export, fmt=fmt, header=hdr) new_data = read_dynamx('test.txt')