Mercurial > repos > galaxyp > maxquant_mqpar
annotate modify_mqpar.py @ 3:2d67fb758956 draft
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
author | galaxyp |
---|---|
date | Sat, 11 Apr 2020 11:50:09 -0400 |
parents | |
children |
rev | line source |
---|---|
3
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
1 "Modify a given mqpar.xml to run Galaxy MaxQuant with it." |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
2 |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
3 import argparse |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
4 import os |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
5 |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
6 from mqparam import MQParam |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
7 |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
8 parser = argparse.ArgumentParser() |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
9 |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
10 arguments = ('--infiles', |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
11 '--version', |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
12 '--num_threads', |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
13 '--substitution_rx', |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
14 '--fasta_files', |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
15 '--description_parse_rule', |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
16 '--identifier_parse_rule', |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
17 'mqpar') |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
18 |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
19 for arg in arguments: |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
20 parser.add_argument(arg) |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
21 |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
22 args = parser.parse_args() |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
23 |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
24 mqpar_out = os.path.join(os.getcwd(), 'mqpar.xml') |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
25 infiles = [os.path.join(os.getcwd(), f) for f in args.infiles.split(',')] |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
26 mqparam = MQParam(args.mqpar, None, substitution_rx=args.substitution_rx) |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
27 if mqparam.version != args.version: |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
28 raise Exception('mqpar version is ' + mqparam.version + '. Tool uses version {}.'.format(args.version)) |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
29 mqparam.translate(infiles) |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
30 mqparam.add_fasta_files(args.fasta_files.split(','), |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
31 {'identifierParseRule': args.identifier_parse_rule, |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
32 'descriptionParseRule': args.description_parse_rule}) |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
33 mqparam.set_simple_param('numThreads', args.num_threads) |
2d67fb758956
"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit da342a782ccc391b87fb4fead956b7b3cbd21258"
galaxyp
parents:
diff
changeset
|
34 mqparam.write('mqpar.xml') |