def test_make_roi_targeted_mz(simulated_experiment): # the first three m/z values generated by simulated experiment are used targeted_mz = simulated_experiment.mz_params[:, 0][:3] roi_list = lcms.make_roi(simulated_experiment, tolerance=0.005, max_missing=0, min_length=0, min_intensity=0, multiple_match="reduce", targeted_mz=targeted_mz) assert len(roi_list) == targeted_mz.size
def test_make_roi_end(simulated_experiment): end = 10 roi_list = lcms.make_roi(simulated_experiment, tolerance=0.005, max_missing=0, min_length=0, min_intensity=0, multiple_match="reduce", end=end) n_sp = simulated_experiment.getNrSpectra() for r in roi_list: assert r.mz.size == end
def test_make_roi_min_intensity(simulated_experiment): min_intensity = 15 roi_list = lcms.make_roi(simulated_experiment, tolerance=0.005, max_missing=0, min_length=0, min_intensity=min_intensity, multiple_match="reduce") # only two roi should have intensities greater than 15 assert len(roi_list) == 2
def test_make_roi_multiple_match_reduce_merge(simulated_experiment): # set a tolerance such that two mz values are merged # test is done in targeted mode to force a multiple match by removing # one of the mz values targeted_mz = simulated_experiment.mz_params[:, 0] targeted_mz = np.delete(targeted_mz, 3) tolerance = 31 roi_list = lcms.make_roi(simulated_experiment, tolerance=tolerance, max_missing=0, min_length=0, min_intensity=0, multiple_match="reduce", targeted_mz=targeted_mz) assert len(roi_list) == (simulated_experiment.mz_params.shape[0] - 1)
def test_make_roi_invalid_multiple_match(simulated_experiment): with pytest.raises(ValueError): lcms.make_roi(simulated_experiment, tolerance=0.005, max_missing=0, min_length=0, min_intensity=0, multiple_match="invalid-value")
def test_make_roi_multiple_match_reduce_custom_sp_reduce(simulated_experiment): sp_reduce = lambda x: 1 roi_list = lcms.make_roi(simulated_experiment, tolerance=0.005, max_missing=0, min_length=0, min_intensity=0, multiple_match="reduce", sp_reduce=sp_reduce) assert len(roi_list) == simulated_experiment.mz_params.shape[0]
def test_make_roi_multiple_match_closest(simulated_experiment): roi_list = lcms.make_roi(simulated_experiment, tolerance=0.005, max_missing=0, min_length=0, min_intensity=0, multiple_match="closest") assert len(roi_list) == simulated_experiment.mz_params.shape[0]