annotate modify_mqpar.py @ 22:9c52362ae7bb draft default tip

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit c810d2eaedfcad1edf1a84cab8296dcd7b35f5bc
author galaxyp
date Mon, 18 Mar 2024 13:07:04 +0000
parents 97a7f34fcb6a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
1 "Modify a given mqpar.xml to run Galaxy MaxQuant with it."
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
2
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
3 import argparse
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
4 import os
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
5
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
6 from mqparam import MQParam
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
7
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
8 parser = argparse.ArgumentParser()
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
9
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
10 arguments = ('--infiles',
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
11 '--version',
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
12 '--num_threads',
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
13 '--substitution_rx',
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
14 '--fasta_files',
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
15 '--description_parse_rule',
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
16 '--identifier_parse_rule',
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
17 'mqpar')
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
18
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
19 for arg in arguments:
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
20 parser.add_argument(arg)
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
21
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
22 args = parser.parse_args()
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
23
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
24 mqpar_out = os.path.join(os.getcwd(), 'mqpar.xml')
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
25 infiles = [os.path.join(os.getcwd(), f) for f in args.infiles.split(',')]
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
26 mqparam = MQParam(args.mqpar, None, substitution_rx=args.substitution_rx)
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
27 if mqparam.version != args.version:
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
28 raise Exception('mqpar version is ' + mqparam.version + '. Tool uses version {}.'.format(args.version))
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
29 mqparam.translate(infiles)
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
30 mqparam.add_fasta_files(args.fasta_files.split(','),
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
31 {'identifierParseRule': args.identifier_parse_rule,
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
32 'descriptionParseRule': args.description_parse_rule})
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
33 mqparam.set_simple_param('numThreads', args.num_threads)
97a7f34fcb6a "planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 641b1d3af3b589a861cde2dc2f8803c9b79df7be"
galaxyp
parents:
diff changeset
34 mqparam.write('mqpar.xml')