Skip to content

Commit cde30e3

Browse files
committed
Remove forward slash in m/z for txt outputs
1 parent 24b3ff9 commit cde30e3

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

dimspy/models/peak_matrix.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ def to_str(self, attr_name='intensity', delimiter='\t', samples_in_rows=True, co
757757
self.remove_empty_peaks()
758758

759759
mz = self.attr_matrix('mz', flagged_only = not comprehensive)
760-
hd = ['m/z'] + map(str, np.average(mz, axis = 0, weights = mz.astype(bool)))
760+
hd = ['mz'] + map(str, np.average(mz, axis = 0, weights = mz.astype(bool)))
761761
dm = [map(str, self.peaklist_ids)] + \
762762
[map(str, ln) for ln in self.attr_matrix(attr_name, flagged_only = not comprehensive).T]
763763

tests/data/MTBLS79_subset/pm_mzml_triplicates.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tests/data/MTBLS79_subset/pm_mzml_triplicates_comprehensive.txt

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tests/data/MTBLS79_subset/pm_mzml_triplicates_comprehensive_T.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
m/z present occurrence purity rsd_QC rsd_all flags batch04_B02_rep01_301.mzML batch04_B02_rep02_302.mzML batch04_B02_rep03_303.mzML batch04_QC17_rep01_262.mzML batch04_QC17_rep02_263.mzML batch04_QC17_rep03_264.mzML batch04_S01_rep01_247.mzML batch04_S01_rep02_248.mzML batch04_S01_rep03_249.mzML
1+
mz present occurrence purity rsd_QC rsd_all flags batch04_B02_rep01_301.mzML batch04_B02_rep02_302.mzML batch04_B02_rep03_303.mzML batch04_QC17_rep01_262.mzML batch04_QC17_rep02_263.mzML batch04_QC17_rep03_264.mzML batch04_S01_rep01_247.mzML batch04_S01_rep02_248.mzML batch04_S01_rep03_249.mzML
22
missing values 2548 2454 2474 2839 2832 2829 2865 2859 2884
33
tags_class_label blank blank blank QC QC QC sample sample sample
44
tags_untyped

tests/test_tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,14 @@ def test_hdf5_peak_matrix_to_txt(self):
218218
attr_name="intensity", rsd_tags=(), delimiter="\t", samples_in_rows=True, comprehensive=False)
219219
with open(to_test_result("pm_mzml_triplicates.txt"), "rU") as test_result:
220220
ln = test_result.readline().split("\t")[:5]
221-
self.assertEqual(ln[0], "m/z")
221+
self.assertEqual(ln[0], "mz")
222222
self.assertTrue(np.allclose(map(float,ln[1:]), [74.0166655257, 74.0198337519, 74.0200238089, 74.0202012645], atol = 1e-10))
223223

224224
hdf5_peak_matrix_to_txt(to_test_data("MTBLS79_mzml_peak_matrix.hdf5"), to_test_result("pm_mzml_triplicates_comprehensive.txt"),
225225
attr_name="intensity", rsd_tags=(Tag("QC", "classLabel"),), delimiter="\t", samples_in_rows=True, comprehensive=True)
226226
with open(to_test_result("pm_mzml_triplicates_comprehensive.txt"), "rU") as test_result:
227227
ln = test_result.readline().split("\t")[:8]
228-
self.assertEquals(ln[:-2], ['m/z', 'missing values', 'tags_batch', 'tags_replicate', 'tags_injectionOrder', 'tags_classLabel'])
228+
self.assertEquals(ln[:-2], ['mz', 'missing values', 'tags_batch', 'tags_replicate', 'tags_injectionOrder', 'tags_classLabel'])
229229
self.assertTrue(np.isclose(float(ln[-1]), 74.0166655257))
230230

231231
hdf5_peak_matrix_to_txt(to_test_data("MTBLS79_mzml_peak_matrix.hdf5"), to_test_result("pm_mzml_triplicates_snr.txt"),
@@ -239,7 +239,7 @@ def test_hdf5_peak_matrix_to_txt(self):
239239
attr_name="intensity", rsd_tags=(Tag("QC", "classLabel"),), delimiter="\t", samples_in_rows=False, comprehensive=True)
240240
with open(to_test_result("pm_mzml_triplicates_comprehensive_T.txt"), "rU") as test_result:
241241
self.assertEquals(test_result.readline().split("\t")[0:5],
242-
['m/z', 'present', 'occurrence', 'purity', 'rsd_QC'])
242+
['mz', 'present', 'occurrence', 'purity', 'rsd_QC'])
243243

244244

245245
def test_create_sample_list(self):

0 commit comments

Comments
 (0)