Skip to content

Commit

Permalink
Add launch.json debug config file
Browse files Browse the repository at this point in the history
Add launch.json debug config file and minor main.py function descriptions
  • Loading branch information
niklases committed Dec 10, 2023
1 parent c926041 commit e9b1373
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: PyPEF Help",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/pypef/main.py",
"console": "integratedTerminal",
"justMyCode": true,
"args": [
"--help"
]
},
{
"name": "Python: PyPEF MKLSTS",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/pypef/main.py",
"console": "integratedTerminal",
"justMyCode": true,
"cwd": "${workspaceFolder}/datasets/ANEH/",
"args": [
"mklsts",
"--wt", "${workspaceFolder}/datasets/ANEH/Sequence_WT_ANEH.fasta",
"--input", "${workspaceFolder}/datasets/ANEH/37_ANEH_variants.csv"
]
}

]
}
21 changes: 19 additions & 2 deletions pypef/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@
ch.setFormatter(formatter)
logger.addHandler(ch)


schema = Schema({
Optional('--all'): bool,
Optional('--conc'): bool,
Expand Down Expand Up @@ -398,6 +397,22 @@


def validate(args):
"""
Validate (docopt) arguments.
Parameters
----------
args: dict
Key-value pairs of arguments,
e.g.,
{'mklsts': True,
'--wt': 'WT_Seq.fasta',
'--input': 'Variant-Fitness.csv'}
Returns
-------
None
"""
try:
args = schema.validate(args)
return args
Expand All @@ -408,6 +423,8 @@ def validate(args):
def run_main():
"""
Entry point for pip-installed version.
Arguments are created from Docstring using docopt that
creates an argument dict.
"""
arguments = docopt(__doc__, version=__version__)
start_time = time.time()
Expand All @@ -424,7 +441,7 @@ def run_main():
else:
run_pypef_utils(arguments)

elapsed = str(timedelta(seconds=time.time()-start_time)).split(".")[0]
elapsed = str(timedelta(seconds=time.time() - start_time)).split(".")[0]
elapsed = f'{elapsed.split(":")[0]} h {elapsed.split(":")[1]} min {elapsed.split(":")[2]} s'
logger.info(f'Done! (Run time: {elapsed})')

Expand Down

0 comments on commit e9b1373

Please sign in to comment.