Exemple #1
0
    def setup_class(cls):
        fpath_apo = input_dir / 'ecSecB_apo.csv'
        fpath_dimer = input_dir / 'ecSecB_dimer.csv'
        data = read_dynamx(fpath_apo, fpath_dimer)
        control = ('Full deuteration control', 0.167 * 60)

        cls.temperature, cls.pH = 273.15 + 30, 8.

        pf = PeptideMasterTable(data,
                                drop_first=1,
                                ignore_prolines=True,
                                remove_nan=False)
        pf.set_control(control)
        cls.hdxm_apo = HDXMeasurement(pf.get_state('SecB WT apo'),
                                      temperature=cls.temperature,
                                      pH=cls.pH)
        cls.hdxm_dimer = HDXMeasurement(pf.get_state('SecB his dimer apo'),
                                        temperature=cls.temperature,
                                        pH=cls.pH)

        data = pf.get_state('SecB WT apo')
        reduced_data = data[data['end'] < 40]
        cls.reduced_hdxm = HDXMeasurement(reduced_data)

        cluster = LocalCluster()
        cls.address = cluster.scheduler_address
Exemple #2
0
 def setup_class(cls):
     fpath = directory / 'test_data' / 'ecSecB_apo.csv'
     cls.pmt = PeptideMasterTable(read_dynamx(fpath))
     cls.pmt.set_control(('Full deuteration control', 0.167))
     d = cls.pmt.get_state('SecB WT apo')
     cls.temperature, cls.pH = 273.15 + 30, 8.
     cls.series = HDXMeasurement(d, temperature=cls.temperature, pH=cls.pH)
Exemple #3
0
    def setup_class(cls):
        dtype = [('r_number', int), ('apple', float)]
        array1 = np.empty(15, dtype=dtype)
        array1['r_number'] = np.arange(15) + 3
        array1['apple'] = np.ones(15) * 12
        cls.array1 = array1

        dtype = [('r_number', int), ('apple', float), ('grapes', float)]
        array2 = np.empty(17, dtype=dtype)
        array2['r_number'] = np.arange(17) + 6
        array2['apple'] = np.ones(17) * 10
        array2['grapes'] = np.ones(17) * 15 + np.random.rand(17)
        cls.array2 = array2

        dtype = [('r_number', int), ('pear', float), ('banana', float)]
        array3 = np.empty(10, dtype=dtype)
        array3['r_number'] = np.arange(10) + 1
        array3['pear'] = np.random.rand(10) + 20
        array3['banana'] = -(np.random.rand(10) + 20)
        cls.array3 = array3

        cls.protein = csv_to_protein(directory / 'test_data' / 'ecSecB_info.csv', column_depth=1)

        fpath = directory / 'test_data' / 'ecSecB_apo.csv'
        pf1 = PeptideMasterTable(read_dynamx(fpath))
        #states = pf1.groupby_state(c_term=200)
        cls.series = HDXMeasurement(pf1.get_state('SecB WT apo'), c_term=200)
Exemple #4
0
 def setup_class(cls):
     fpath = input_dir / 'ecSecB_apo.csv'
     cls.pmt = PeptideMasterTable(read_dynamx(fpath))
     data = cls.pmt.get_state('SecB WT apo')
     cls.hdxm = HDXMeasurement(data)
     cls.sequence = 'MSEQNNTEMTFQIQRIYTKDISFEAPNAPHVFQKDWQPEVKLDLDTASSQLADDVYEVVLRVTVTASLGEETAFLCEVQQGGIFSIAGIEGTQM' \
                    'AHCLGAYCPNILFPYARECITSMVSRGTFPQLNLAPVNFDALFMNYLQQQAGEGTEEHQDA'
Exemple #5
0
 def setup_class(cls):
     fpath = input_dir / 'ecSecB_apo.csv'
     cls.pmt = PeptideMasterTable(read_dynamx(fpath))
     cls.pmt.set_control(('Full deuteration control', 0.167 * 60))
     d = cls.pmt.get_state('SecB WT apo')
     cls.temperature, cls.pH = 273.15 + 30, 8.
     cls.hdxm = HDXMeasurement(d, temperature=cls.temperature, pH=cls.pH)
Exemple #6
0
    def setup_class(cls):
        dtype = [('r_number', int), ('apple', float)]
        array1 = np.empty(15, dtype=dtype)
        array1['r_number'] = np.arange(15) + 3
        array1['apple'] = np.ones(15) * 12
        cls.array1 = array1

        dtype = [('r_number', int), ('apple', float), ('grapes', float)]
        array2 = np.empty(17, dtype=dtype)
        array2['r_number'] = np.arange(17) + 6
        array2['apple'] = np.ones(17) * 10
        array2['grapes'] = np.ones(17) * 15 + np.random.rand(17)
        cls.array2 = array2

        dtype = [('r_number', int), ('pear', float), ('banana', float)]
        array3 = np.empty(10, dtype=dtype)
        array3['r_number'] = np.arange(10) + 1
        array3['pear'] = np.random.rand(10) + 20
        array3['banana'] = -(np.random.rand(10) + 20)
        cls.array3 = array3
        metadata = {
            'temperature': 273.15,
            'pH': 7.5,
            'mutations': ['V123S', 'P234S']
        }
        cls.protein = csv_to_protein(output_dir / 'ecSecB_info.csv')
        cls.protein.metadata = metadata

        fpath = input_dir / 'ecSecB_apo.csv'
        pf1 = PeptideMasterTable(read_dynamx(fpath))
        cls.series = HDXMeasurement(pf1.get_state('SecB WT apo'), c_term=200)
Exemple #7
0
    def setup_class(cls):
        cls.fpath = input_dir / 'ecSecB_apo.csv'
        cls.pmt = PeptideMasterTable(read_dynamx(cls.fpath))

        cls.state = 'SecB WT apo'
        cls.control = ('Full deuteration control', 0.167*60)
        cls.pmt.set_control(cls.control)

        state_data = cls.pmt.get_state(cls.state)
        cls.temperature, cls.pH = 273.15 + 30, 8.
        cls.hdxm = HDXMeasurement(state_data, temperature=cls.temperature, pH=cls.pH)

        cfg = ConfigurationSettings()
        cfg.set('cluster', 'scheduler_address', f'127.0.0.1:{test_port}')
Exemple #8
0
    def setup_class(cls):
        cls.fpath = directory / 'test_data' / 'ecSecB_apo.csv'
        cls.pmt = PeptideMasterTable(read_dynamx(cls.fpath))

        cls.state = 'SecB WT apo'
        cls.control = ('Full deuteration control', 0.167)
        cls.pmt.set_control(cls.control)

        state_data = cls.pmt.get_state(cls.state)
        cls.temperature, cls.pH = 273.15 + 30, 8.
        cls.series = HDXMeasurement(state_data,
                                    temperature=cls.temperature,
                                    pH=cls.pH)
        cls.prot_fit_result = csv_to_protein(directory / 'test_data' /
                                             'ecSecB_torch_fit.txt')

        cfg = ConfigurationSettings()
        cfg.set('cluster', 'port', str(test_port))
Exemple #9
0
from pathlib import Path
import numpy as np
from pyhdx import PeptideMasterTable, read_dynamx, HDXMeasurement

current_dir = Path(__file__).parent
np.random.seed(43)

fpath = current_dir.parent / 'tests' / 'test_data' / 'ecSecB_apo.csv'
data = read_dynamx(fpath)

pmt = PeptideMasterTable(data,
                         drop_first=1,
                         ignore_prolines=True,
                         remove_nan=False)
pmt.set_control(('Full deuteration control', 0.167))

sequence = 'MSEQNNTEMTFQIQRIYTKDISFEAPNAPHVFQKDWQPEVKLDLDTASSQLADDVYEVVLRVTVTASLGEETAFLCEVQQGGIFSIAGIEGTQMAHCLGAYCPNILFPYARECITSMVSRGTFPQLNLAPVNFDALFMNYLQQQAGEGTEEHQDA'

hdxm = HDXMeasurement(pmt.get_state('SecB WT apo'), sequence=sequence)
print(hdxm.coverage.protein)

#hdxm.coverage.protein.to_file('test.txt', fmt='pprint')
sequence_dimer = 'MSEQNNTEMTFQIQRIYTKDISFEAPNAPHVFQKDWQPEVKLDLDTASSQLADDVYEVVLRVTVTASLGEETAFLCEVQQGGIFSIAGIEGTQMAHCLGAYCPNILFPAARECIASMVARGTFPQLNLAPVNFDALFMNYLQQQAGEGTEEHQDA'


directory = Path(__file__).parent
test_data_dir = directory / 'test_data'

guess = False  # guess true requires dask cluster at config defined ip/port
control = ('Full deuteration control', 0.167)

data = read_dynamx(test_data_dir / 'ecSecB_apo.csv', test_data_dir / 'ecSecB_dimer.csv')

pmt = PeptideMasterTable(data, drop_first=1, ignore_prolines=True, remove_nan=False)
pmt.set_control(control)
temperature, pH = 273.15 + 30, 8.

hdxm = HDXMeasurement(pmt.get_state('SecB WT apo'), sequence=sequence, temperature=temperature, pH=pH)

if guess:
    client = default_client()
    wt_avg_result = fit_rates_weighted_average(hdxm, bounds=(1e-2, 800))
    output = wt_avg_result.output
    output.to_file(directory / 'test_data' / 'ecSecB_guess.txt')
else:
    output = csv_to_protein(directory / 'test_data' / 'ecSecB_guess.txt')

gibbs_guess = hdxm.guess_deltaG(output['rate'])
fr_torch = fit_gibbs_global(hdxm, gibbs_guess, epochs=epochs, r1=2)
fr_torch.output.to_file(directory / 'test_data' / 'ecSecB_torch_fit.txt')

hdxm_dimer = HDXMeasurement(pmt.get_state('SecB his dimer apo'), sequence=sequence_dimer,
                            temperature=temperature, pH=pH)
"""Load a HDX-MS dataset (peptide list with D-uptake per peptide, csv format)"""

from pathlib import Path
import numpy as np
from pyhdx import PeptideMasterTable, read_dynamx, HDXMeasurement

current_dir = Path(__file__).parent
output_dir = current_dir / 'output'
output_dir.mkdir(exist_ok=True)
np.random.seed(43)

fpath = current_dir.parent / 'tests' / 'test_data' / 'input' / 'ecSecB_apo.csv'
data = read_dynamx(fpath)

pmt = PeptideMasterTable(data,
                         drop_first=1,
                         ignore_prolines=True,
                         remove_nan=False)
pmt.set_control(('Full deuteration control', 0.167 * 60))

sequence = 'MSEQNNTEMTFQIQRIYTKDISFEAPNAPHVFQKDWQPEVKLDLDTASSQLADDVYEVVLRVTVTASLGEETAFLCEVQQGGIFSIAGIEGTQMAHCLGAYCPNILFPYARECITSMVSRGTFPQLNLAPVNFDALFMNYLQQQAGEGTEEHQDA'

temperature, pH = 273.15 + 30, 8.
hdxm = HDXMeasurement(pmt.get_state('SecB WT apo'),
                      sequence=sequence,
                      pH=pH,
                      temperature=temperature)

hdxm.coverage.protein.to_file(output_dir / 'SecB_info.txt', fmt='pprint')
Exemple #12
0
current_dir = Path(__file__).parent
#current_dir = Path().cwd() / 'templates'  # pycharm scientific compat
output_dir = current_dir / 'output'
output_dir.mkdir(exist_ok=True)
test_data_dir = current_dir.parent / 'tests' / 'test_data'
input_dir = test_data_dir / 'input'

#%%

# Load the data of two Dynamx files, and combine the result to one table
data = read_dynamx(input_dir / 'ecSecB_apo.csv', input_dir / 'ecSecB_dimer.csv')

pmt = PeptideMasterTable(data, drop_first=1, ignore_prolines=True, remove_nan=False)
pmt.set_control(('Full deuteration control', 0.167*60))
temperature, pH = 273.15 + 30, 8.
hdxm = HDXMeasurement(pmt.get_state('SecB WT apo'), temperature=temperature, pH=pH)

#%%

if guess:
    client = default_client()
    wt_avg_result = fit_rates_weighted_average(hdxm, client=client)
    init_guess = wt_avg_result.output
else:
    init_guess = csv_to_dataframe(test_data_dir / 'output' / 'ecSecB_guess.csv')

gibbs_guess = hdxm.guess_deltaG(init_guess['rate'])

#%%

fr_torch = fit_gibbs_global(hdxm, gibbs_guess, **fit_kwargs)