-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
51 lines (46 loc) · 1.8 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
""" Module for mkdocs-macro """
import argparse
from contextlib import redirect_stdout
import io
from moPepGen import cli
COMMAND_MAPPER = {
'generateIndex': cli.add_subparser_generate_index,
'updateIndex': cli.add_subparser_update_index,
'parseVEP': cli.add_subparser_parse_vep,
'parseREDItools': cli.add_subparser_parse_reditools,
'parseSTARFusion': cli.add_subparser_parse_star_fusion,
'parseFusionCatcher': cli.add_subparser_parse_fusion_catcher,
'parseArriba': cli.add_subparser_parse_arriba,
'parseRMATS': cli.add_subparser_parse_rmats,
'parseCIRCexplorer': cli.add_subparser_parse_circexplorer,
'callVariant': cli.add_subparser_call_variant,
'callNovelORF': cli.add_subparser_call_novel_orf,
'callAltTranslation': cli.add_subparser_call_alt_translation,
'filterFasta': cli.add_subparser_filter_fasta,
'splitFasta': cli.add_subparser_split_fasta,
'mergeFasta': cli.add_subparser_merge_fasta,
'encodeFasta': cli.add_subparser_encode_fasta,
'decoyFasta': cli.add_subparser_decoy_fasta,
'summarizeFasta': cli.add_subparser_summarize_fasta
}
def define_env(env):
"Hook function"
# pylint: disable=W0612
# pylint: disable=W0212
@env.macro
def get_arg_data(command:str):
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers()
add_parser = COMMAND_MAPPER[command]
p = add_parser(subparsers)
return p._actions
@env.macro
def get_arg_usage(command:str):
stream = io.StringIO()
with redirect_stdout(stream):
parser = argparse.ArgumentParser(prog='moPepGen')
subparsers = parser.add_subparsers()
add_parser = COMMAND_MAPPER[command]
p = add_parser(subparsers)
p.print_help()
return stream.getvalue()