def test_sec_profile_2(self): """ """ peakspath = settings.get('peaks_gltpd1_invivo') secpath = settings.get('sec_gltpd1_invivo') reader = sample.SampleReader( input_type='peaks', fname=peakspath, ) samples = reader.get_sampleset( sample_id_proc=sampleattrs.plate_sample_id_processor(), ) secprofile = sampleattrs.SECProfile( sec_path=secpath, samples=samples, start_volume=1.2, offsets=(0.015, 0.045), start_col=9, start_row='A', length=samples.numof_samples, ) assert secprofile.numof_samples == samples.numof_samples assert np.all(secprofile.attrs.sample_index_to_id == samples.attrs.sample_index_to_id) assert id(samples) in secprofile._sample_data assert id(secprofile) in samples._sample_data assert secprofile.profile015.max() - 20.92373913043478 < 0.0001 assert secprofile.profile045.argmax() == 2 assert secprofile.profile015.argmax() == 3 assert secprofile.profiles == {'profile045', 'profile015'}
def test_sec_profile_1(self): """ """ peakspath = settings.get('peaks_gltpd1_invitro') secpath = settings.get('sec_gltpd1_invitro') reader = sample.SampleReader( input_type='peaks', fname=peakspath, ) samples = reader.get_sampleset( sample_id_proc=sampleattrs.plate_sample_id_processor(), ) secprofile = sampleattrs.SECProfile( sec_path=secpath, samples=samples, ) assert secprofile.numof_samples == samples.numof_samples assert np.all(secprofile.attrs.sample_index_to_id == samples.attrs.sample_index_to_id) assert id(samples) in secprofile._sample_data assert id(secprofile) in samples._sample_data assert secprofile.profile.max() - 143.40397368421048 < 0.0001
def read_peaks(self): reader = sample.SampleReader( input_type='peaks', fname=self.peaks_fname, ) self.samples = reader.get_sampleset( sampleset_args={ 'sample_id_proc': sampleattrs.plate_sample_id_processor(), }) self.sample_selected = self.samples.mzs_by_sample[:, self.samples.attrs. sample_id_to_index[ self.sample_id]] idx = self.sample_selected.argsort() self.samples.sort_all(by=idx) self.sample_selected = self.samples.mzs_by_sample[:, self.samples.attrs. sample_id_to_index[ self.sample_id]]
def preprocess_peaks(self): self._log( 'Starting LC MS/MS data preprocessing using PEAKS output files.') preproc_peaks = sample.SampleReader( fname=self.input_path, input_type=self.input_type, ionmode=self.ionmode, ) self._log('Preprocessing of PEAKS output finished.') self.samples = preproc_peaks.get_sampleset()
def test_sampleset_from_peaks(self): """ """ peaksfile = settings.get('peaks_example') reader = sample.SampleReader(input_type='peaks', fname=peaksfile) samples = reader.get_sampleset( sampleset_args={ 'sample_id_proc': sampleattrs.plate_sample_id_processor(), }) assert abs(samples.mzs_by_sample[7, 3] - 375.0018) < 0.0001 assert samples.attrs.sample_index_to_id[-1] == ('A', 12) assert samples.attrs.attrs[0].attrs['label']['sample_id'] == ('A', 6)
def test_protein_containing_samples(self): """ """ peakspath = settings.get('peaks_gltpd1_invivo') secpath = settings.get('sec_gltpd1_invivo') reader = sample.SampleReader( input_type='peaks', fname=peakspath, ) samples = reader.get_sampleset( sample_id_proc=sampleattrs.plate_sample_id_processor(), ) secprofile = sampleattrs.SECProfile( sec_path=secpath, samples=samples, start_volume=1.2, offsets=(0.015, 0.045), start_col=9, start_row='A', length=samples.numof_samples, ) pcs = secprofile.protein_containing_samples() assert np.all( pcs.selection == np.array([False, False, True, True, False])) pcs = secprofile.protein_containing_samples(manual=['A10', 'A11']) assert np.all( pcs.selection == np.array([False, True, True, False, False])) pcs = secprofile.protein_containing_samples(exclude=['A12']) assert np.all( pcs.selection == np.array([False, False, True, False, False]))
from lipyd import settings from lipyd import sample from lipyd import sampleattrs peaksfile = settings.get('peaks_example') peaksfile = 'stard10_pos.csv' reader = sample.SampleReader( input_type = 'peaks', fname = peaksfile ) samples = reader.get_sampleset( sampleset_args = { 'sample_id_proc': sampleattrs.plate_sample_id_processor(), } ) idx = samples.mzs_by_sample[ :,samples.attrs.sample_id_to_index[('A', 10)] ].argsort() samples.sort_all(by = idx) # m/z's for one sample: samples.mzs_by_sample[:,samples.attrs.sample_id_to_index[('A', 10)]] # intensities for one sample: samples.intensities[:,samples.attrs.sample_id_to_index[('A', 10)]] # RTs for one sample: samples.rts[:,samples.attrs.sample_id_to_index[('A', 10)]]