Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mirandaa
mfql_dessert
Commits
4166d8c1
Commit
4166d8c1
authored
Jun 23, 2020
by
mirandaa
Browse files
working reformat
parent
bd7082c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
mfql_dessert.py
View file @
4166d8c1
...
...
@@ -2,29 +2,39 @@ import os
from
chem_parser
import
txt2dict
from
gooey
import
Gooey
,
GooeyParser
@
Gooey
(
program_name
=
"MFQL Dessert"
)
@
Gooey
(
program_name
=
"MFQL Dessert"
)
def
getArgs
():
parser
=
GooeyParser
(
description
=
'MFQL generator v0.0.1'
)
parser
.
add_argument
(
'compound'
,
metavar
=
'Compound'
,
help
=
'Human reabable name for reference'
)
parser
.
add_argument
(
'compound'
,
metavar
=
'Compound'
,
help
=
'Compound name'
)
parser
.
add_argument
(
'mfql_dir'
,
metavar
=
'Directory where to store the results'
,
help
=
'output dir for MFQL files'
,
default
=
'.'
,
widget
=
'DirChooser'
)
ms1_group
=
parser
.
add_argument_group
(
"Chemical Formula"
,
"in normal (eg H2O) or ranged format (eg C[1..20]H[4..80]O[0..1])"
)
ms1_group
.
add_argument
(
'formula_ms1'
,
metavar
=
'Chemical Formula for MS1'
,
help
=
'Specify formula'
)
ms1_group
.
add_argument
(
'adduct_ms1'
,
metavar
=
'Chemical Formula for MS1 Adduct'
,
help
=
'Specify adduct type (optional for ranged format)'
,
nargs
=
'?'
,
default
=
''
)
ms1_group
.
add_argument
(
'ms_mode'
,
metavar
=
'Select the Mode to use'
,
help
=
'MS mode'
,
choices
=
[
'+'
,
'-'
])
ms2_group
=
parser
.
add_argument_group
(
"Fragment Formula"
,
"Add fragments if applicable"
)
ms2_group
.
add_argument
(
'formula_ms2'
,
metavar
=
'Chemical Formula for fragments,'
,
help
=
'Specify fragment formula seperated by comma'
,
nargs
=
'?'
,
default
=
''
)
ms1_group
.
add_argument
(
'formula_ms1'
,
metavar
=
'Chemical Formula for MS1'
,
help
=
'Specify formula (eg h2o or C[1..20]H[4..80]O[0..1])'
)
ms1_group
.
add_argument
(
'ms_mode'
,
metavar
=
'Select the Mode to use'
,
choices
=
[
'+'
,
'-'
])
ms1_optgroup
=
parser
.
add_argument_group
(
"MS1 Adduct (optional)"
,
"Specify adduct type, this is optional for ranged formulas"
)
ms1_optgroup
.
add_argument
(
'adduct_ms1'
,
metavar
=
'Chemical Formula for MS1 Adduct'
,
help
=
'for example H'
,
nargs
=
'?'
,
default
=
''
)
ms2_optgroup
=
parser
.
add_argument_group
(
"Fragments (optional)"
,
"Specify the chemical formulas of fragments, if applicable."
)
ms2_optgroup
.
add_argument
(
'formula_ms2'
,
metavar
=
'Chemical Formulas fragments'
,
help
=
'seperated by comma if there are multiple'
,
nargs
=
'?'
,
default
=
''
)
parser
.
add_argument
(
'mfql_dir'
,
metavar
=
'Directory where to store the results'
,
help
=
'output dir for MFQL files'
,
default
=
'./mfql_dir/'
,
widget
=
'DirChooser'
)
args
=
parser
.
parse_args
()
return
args
def
addDicts
(
cc
,
af
,
ms
):
#adjust for the adduct
# only H, NH4 and HCOO are defined
...
...
@@ -103,8 +113,6 @@ def res2dbe(res):
def
main
():
args
=
getArgs
()
print
(
args
.
formula_ms2
)
return
ms
=
args
.
ms_mode
cc
=
txt2dict
(
args
.
formula_ms1
)
af
=
txt2dict
(
args
.
adduct_ms1
)
#get chemical composition of adduct
...
...
@@ -133,4 +141,6 @@ def main():
f
.
write
(
line6
+
'
\n
'
)
if
__name__
==
"__main__"
:
main
()
# main()
args
=
getArgs
()
print
(
vars
(
args
))
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment