Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new auto-process 'info' command #895

Merged
merged 7 commits into from
Dec 20, 2023
Next Next commit
auto_process.py: initial implementation of new 'info' command.
pjbriggs committed Dec 20, 2023
commit 79d12372f13087a1354d781da259737bfd753068
30 changes: 30 additions & 0 deletions auto_process_ngs/cli/auto_process.py
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@
The following commands enable the querying and setting of configuration
settings and project metadata:

info
config
params
metadata
@@ -201,6 +202,20 @@ def add_params_command(cmdparser):
help="auto_process analysis directory (optional: defaults "
"to the current directory)")

def add_info_command(cmdparser):
"""
Create a parser for the 'info' command
"""
p = cmdparser.add_command('info',
help="Information about the analysis "
"directory",
description="Print information about the "
"analysis associated with ANALYSIS_DIR.")
add_debug_option(p)
p.add_argument('analysis_dir',metavar="ANALYSIS_DIR",nargs="?",
help="auto_process analysis directory (optional: defaults "
"to the current directory)")

def add_metadata_command(cmdparser):
"""
Create a parser for the 'metadata' command
@@ -1272,6 +1287,19 @@ def params(args):
else:
d.print_params()

def info(args):
"""
Implement functionality for the 'info' command
"""
analysis_dir = args.analysis_dir
if not analysis_dir:
analysis_dir = os.getcwd()
d = AutoProcess(analysis_dir,allow_save_params=False)
# Run ID
print("Run ID : %s" % d.run_id)
print("Platform : %s" % d.metadata.platform)
print("Sample sheet: %s" % d.params.sample_sheet)

def metadata(args):
"""
Implement functionality for 'metadata' command
@@ -1837,6 +1865,7 @@ def main():

# Add commands
add_config_command(p)
add_info_command(p)
add_setup_command(p)
add_params_command(p)
add_metadata_command(p)
@@ -1858,6 +1887,7 @@ def main():
# Map commands to functions
commands = {
'config': config,
'info': info,
'setup': setup,
'params': params,
'metadata': metadata,