comparison mzml_id_getter.py @ 2:abe783e0daca 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:26:59 +0000
parents
children
comparison
equal deleted inserted replaced
1:b07fd3d7ffd0 2:abe783e0daca
1 #!/usr/bin/env python
2
3 import argparse
4 import sys
5
6 from pymzml.run import Reader
7
8
9 def main(argv):
10 parser = argparse.ArgumentParser(description='Get run ID from an mzML file.')
11 parser.add_argument('mzml_file', help='Path to an mzML file to get run ID from.')
12 args = parser.parse_args()
13
14 mzml = Reader(args.mzml_file)
15 id = mzml.info['run_id']
16
17 if id is not None:
18 with open("sample_name.txt", mode='x') as f:
19 f.write(id)
20
21
22 if __name__ == '__main__':
23 main(sys.argv[1:])