Skip to content

Commit 86ccf6b

Browse files
committed
Add snr to choices --attribute_name (hdf5-pm-to-txt - CLI)
1 parent 420d3da commit 86ccf6b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

dimspy/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def main():
349349
help="Directory (peaklists) or text file (peak matrix) to write to.")
350350

351351
parser_hpmt.add_argument('-a', '--attribute_name',
352-
default="intensity", choices=["intensity", "mz"], required=False,
352+
default="intensity", choices=["intensity", "mz", "snr"], required=False,
353353
help="Type of matrix to print.")
354354

355355
parser_hpmt.add_argument('-l', '--class-label-rsd',

tests/test_tools.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def test_hdf5_peaklists_to_txt(self):
199199
with open(to_test_data(fn), "rU") as comp:
200200
self.assertEqual(test_result.read(), comp.read())
201201

202+
202203
def test_hdf5_peak_matrix_to_txt(self):
203204
hdf5_peak_matrix_to_txt(to_test_data("MTBLS79_mzml_peak_matrix.hdf5"), to_test_result("pm_mzml_triplicates.txt"),
204205
attr_name="intensity", rsd_tags=(), delimiter="\t", samples_in_rows=True, comprehensive=False)
@@ -212,12 +213,19 @@ def test_hdf5_peak_matrix_to_txt(self):
212213
self.assertEquals(test_result.readline().split("\t")[0:6],
213214
["m/z", "missing values", "tags_classLabel", "tags_batch", "tags_untyped", "74.0166655257"])
214215

216+
hdf5_peak_matrix_to_txt(to_test_data("MTBLS79_mzml_peak_matrix.hdf5"), to_test_result("pm_mzml_triplicates_snr.txt"),
217+
attr_name="snr", rsd_tags=("QC",), delimiter="\t", samples_in_rows=True, comprehensive=False)
218+
with open(to_test_result("pm_mzml_triplicates_snr.txt"), "rU") as test_result:
219+
self.assertEquals(test_result.readlines()[1].split("\t")[0:10],
220+
["batch04_B02_rep01_301.mzML", "0.0", "0.0", "0.0", "0.0", "0.0", "0.0", "3.60960180872", "0.0", "4.35180213987"])
221+
215222
hdf5_peak_matrix_to_txt(to_test_data("MTBLS79_mzml_peak_matrix.hdf5"), to_test_result("pm_mzml_triplicates_comprehensive_T.txt"),
216223
attr_name="intensity", rsd_tags=("QC",), delimiter="\t", samples_in_rows=False, comprehensive=True)
217224
with open(to_test_result("pm_mzml_triplicates_comprehensive_T.txt"), "rU") as test_result:
218225
self.assertEquals(test_result.readline().split("\t")[0:5],
219226
['m/z', 'present', 'occurrence', 'purity', 'rsd_QC'])
220227

228+
221229
def test_create_sample_list(self):
222230
pls = load_peaklists_from_hdf5(to_test_data("MTBLS79_mzml_triplicates.hdf5"))
223231
create_sample_list(pls, to_test_result("filelist_csl_MTBLS79_mzml_triplicates.txt"))

0 commit comments

Comments
 (0)