Mercurial > repos > recetox > recetox_aplcms_compute_clusters
diff mzml_id_getter.py @ 0:82737757f3d5 draft
planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/recetox_aplcms commit 506df2aef355b3791567283e1a175914f06b405a
author | recetox |
---|---|
date | Mon, 13 Feb 2023 10:27:56 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mzml_id_getter.py Mon Feb 13 10:27:56 2023 +0000 @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import argparse +import sys + +from pymzml.run import Reader + + +def main(argv): + parser = argparse.ArgumentParser(description='Get run ID from an mzML file.') + parser.add_argument('mzml_file', help='Path to an mzML file to get run ID from.') + args = parser.parse_args() + + mzml = Reader(args.mzml_file) + id = mzml.info['run_id'] + + if id is not None: + with open("sample_name.txt", mode='x') as f: + f.write(id) + + +if __name__ == '__main__': + main(sys.argv[1:])