annotate mqwrapper.py @ 2:666f3453a99d draft

planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 2131f017e9303599ed672797ffd6e9b00ab1245d
author galaxyp
date Wed, 07 Aug 2019 10:50:06 -0400
parents 8bac3cc5c5de
children 175e062b6a17
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
1 """
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
2 Run MaxQuant on a modified mqpar.xml.
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
3 Use maxquant conda package.
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
4 TODO: add support for parameter groups
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
5
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
6 Authors: Damian Glaetzer <d.glaetzer@mailbox.org>
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
7
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
8 based on the maxquant galaxy tool by John Chilton:
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
9 https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
10 """
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
11
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
12 import argparse
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
13 import os
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
14 import shutil
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
15 import subprocess
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
16
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
17 import mqparam
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
18
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
19 # build parser
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
20 parser = argparse.ArgumentParser()
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
21
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
22 # input, special outputs and others
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
23 other_args = ('raw_files', 'mzxml_files', 'fasta_files',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
24 'description_parse_rule', 'identifier_parse_rule',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
25 'exp_design', 'output_all',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
26 'mqpar_out', 'infile_names', 'mzTab',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
27 'version', 'substitution_rx')
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
28
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
29 # txt result files
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
30 txt_output = ('evidence', 'msms', 'parameters',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
31 'peptides', 'proteinGroups', 'allPeptides',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
32 'libraryMatch', 'matchedFeatures',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
33 'modificationSpecificPeptides', 'ms3Scans',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
34 'msmsScans', 'mzRange', 'peptideSection',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
35 'summary')
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
36
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
37 # arguments for mqparam
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
38 ## global
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
39 global_flags = ('calc_peak_properties',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
40 'write_mztab',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
41 'ibaq',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
42 'ibaq_log_fit',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
43 'separate_lfq',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
44 'lfq_stabilize_large_ratios',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
45 'lfq_require_msms',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
46 'advanced_site_intensities',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
47 'match_between_runs')
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
48
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
49 global_simple_args = ('min_unique_pep',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
50 'num_threads',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
51 'min_peptide_len',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
52 'max_peptide_mass')
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
53
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
54 ## parameter group specific
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
55 param_group_flags = ('lfq_skip_norm',)
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
56
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
57 param_group_simple_args = ('missed_cleavages',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
58 'lfq_mode',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
59 'lfq_min_edges_per_node',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
60 'lfq_avg_edges_per_node',
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
61 'lfq_min_ratio_count')
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
62
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
63 param_group_silac_args = ('light_mods', 'medium_mods', 'heavy_mods')
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
64
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
65 list_args = ('fixed_mods', 'var_mods', 'proteases')
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
66
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
67 arguments = ['--' + el for el in (txt_output
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
68 + global_simple_args
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
69 + param_group_simple_args
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
70 + list_args
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
71 + param_group_silac_args
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
72 + other_args)]
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
73
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
74 flags = ['--' + el for el in global_flags + param_group_flags]
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
75
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
76 for arg in arguments:
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
77 parser.add_argument(arg)
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
78 for flag in flags:
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
79 parser.add_argument(flag, action="store_true")
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
80
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
81 args = vars(parser.parse_args())
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
82
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
83 # link infile datasets to names with correct extension
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
84 # for maxquant to accept them
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
85 files = (args['raw_files'] if args['raw_files']
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
86 else args['mzxml_files']).split(',')
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
87 ftype = ".thermo.raw" if args['raw_files'] else ".mzXML"
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
88 filenames = args['infile_names'].split(',')
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
89 fnames_with_ext = [(a if a.endswith(ftype)
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
90 else os.path.splitext(a)[0] + ftype)
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
91 for a in filenames]
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
92
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
93 for f, l in zip(files, fnames_with_ext):
2
666f3453a99d planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit 2131f017e9303599ed672797ffd6e9b00ab1245d
galaxyp
parents: 1
diff changeset
94 os.symlink(f, l)
1
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
95
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
96 # build mqpar.xml
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
97 mqpar_in = os.path.join(os.getcwd(), 'mqpar.xml')
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
98 subprocess.run(('maxquant', '-c', mqpar_in))
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
99 mqpar_out = args['mqpar_out'] if args['mqpar_out'] != 'None' else mqpar_in
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
100
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
101
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
102 exp_design = args['exp_design'] if args['exp_design'] != 'None' else None
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
103 m = mqparam.MQParam(mqpar_out, mqpar_in, exp_design,
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
104 substitution_rx=args['substitution_rx'])
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
105 if m.version != args['version']:
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
106 raise Exception('mqpar version is ' + m.version +
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
107 '. Tool uses version {}.'.format(args['version']))
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
108
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
109 # modify parameters, interactive mode if no mqpar_in was specified
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
110 m.add_infiles([os.path.join(os.getcwd(), name) for name in fnames_with_ext], True)
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
111 m.add_fasta_files(args['fasta_files'].split(','),
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
112 identifier=args['identifier_parse_rule'],
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
113 description=args['description_parse_rule'])
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
114
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
115 for e in (global_simple_args
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
116 + param_group_simple_args
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
117 + global_flags
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
118 + param_group_flags):
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
119 if args[e]:
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
120 m.set_simple_param(e, args[e])
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
121
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
122 for e in list_args:
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
123 if args[e]:
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
124 m.set_list_params(e, args[e].split(','))
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
125
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
126 if args['light_mods'] or args['medium_mods'] or args['heavy_mods']:
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
127 m.set_silac(args['light_mods'].split(',') if args['light_mods'] else None,
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
128 args['medium_mods'].split(',') if args['medium_mods'] else None,
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
129 args['heavy_mods'].split(',') if args['heavy_mods'] else None)
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
130
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
131 m.write()
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
132
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
133 # build and run MaxQuant command
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
134 cmd = ['maxquant', mqpar_out]
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
135
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
136 subprocess.run(cmd, check=True, cwd='./')
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
137
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
138 # copy results to galaxy database
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
139 for el in txt_output:
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
140 destination = args[el]
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
141 source = os.path.join(os.getcwd(), "combined", "txt", "{}.txt".format(el))
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
142 if destination != 'None' and os.path.isfile(source):
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
143 shutil.copy(source, destination)
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
144
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
145 if args['mzTab'] != 'None':
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
146 source = os.path.join(os.getcwd(), "combined", "txt", "mzTab.mzTab")
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
147 if os.path.isfile(source):
8bac3cc5c5de planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/maxquant commit ab4e4f1817080cbe8a031a82cb180610ff140847
galaxyp
parents:
diff changeset
148 shutil.copy(source, args['mzTab'])