Skip to content

Commit 4ba881d

Browse files
committed
Fix metadata bug (replicate)
1 parent e2642b4 commit 4ba881d

File tree

6 files changed

+13
-2
lines changed

6 files changed

+13
-2
lines changed

dimspy/tools.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,9 @@ def replicate_filter(source, ppm, replicates, min_peaks, rsd_thres=None, filelis
209209
pl.tags.add_tag("_".join(map(str, reps)), "replicates")
210210

211211
for t in pls_comb[0].tags.tags:
212-
if not pl.tags.has_tag_type(t.ttype):
213-
pl.tags.add_tag(t)
212+
if t.ttype != "replicate":
213+
if not pl.tags.has_tag_type(t.ttype):
214+
pl.tags.add_tag(t)
214215

215216
pl_filt = filter_attr(pl.copy(), attr_name="present", min_threshold=replicates, flag_name="pres_rsd")
216217
median_rsd = np.median(pl_filt.get_attribute("rsd", flagged_only=True))
-96 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
filename injectionOrder replicates batch classLabel
2+
batch04_B02_rep01_301_2_302_3_303 1 1_2_3 1 blank
3+
batch04_QC17_rep01_262_2_263_3_264 4 1_2_3 1 QC
4+
batch04_S01_rep01_247_2_248_3_249 7 1_2_3 1 sample

tests/test_tools.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,9 @@ def test_create_sample_list(self):
254254
with open(to_test_result("filelist_csl_MTBLS79_mzml_peak_matrix.txt"), "rU") as test_result:
255255
with open(to_test_data("filelist_csl_MTBLS79_mzml_peak_matrix.txt"), "rU") as comp:
256256
self.assertEqual(test_result.read(), comp.read())
257+
258+
pm = load_peaklists_from_hdf5(to_test_data("MTBLS79_mzml_triplicates_rf.hdf5"))
259+
create_sample_list(pm, to_test_result("filelist_csl_MTBLS79_mzml_triplicates_rf.txt"))
260+
with open(to_test_result("filelist_csl_MTBLS79_mzml_triplicates_rf.txt"), "rU") as test_result:
261+
with open(to_test_data("filelist_csl_MTBLS79_mzml_triplicates_rf.txt"), "rU") as comp:
262+
self.assertEqual(test_result.read(), comp.read())

0 commit comments

Comments
 (0)