view mzml_id_getter.py @ 11:50b9918aeff2 draft default tip

planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/recetox_aplcms commit 5da5b5e8b95d93a24424155e5aebfbd337d2c4b6
author recetox
date Thu, 31 Oct 2024 11:29:15 +0000
parents 38469e025939
children
line wrap: on
line source

#!/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:])