Skip to content

Commit

Permalink
add --from-project option and remove --paired-data
Browse files Browse the repository at this point in the history
  • Loading branch information
cokelaer committed May 13, 2020
1 parent b87b67e commit 6c72018
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Changelog
========= ====================================================================
Version Description
========= ====================================================================
0.2.1 * add --from-project option to import existing config file
* remove --paired-data option
0.2.0 add content from sequana.pipeline_common to handle all kind of
options in the argparse of all pipelines. This is independent of
sequana to speed up the --version and --help calls
Expand Down
11 changes: 7 additions & 4 deletions sequana_pipetools/completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ def __init__(self, prog="sequana_completion"):
sequana_completion --name all
"""

super(Options, self).__init__(usage=usage, prog=prog,
super(Options, self).__init__(usage=usage, prog=prog,
description="""This tool creates completion script for sequana
pipelines. Each pipeline has its own in .config/sequana/pipelines that you can
source at your convenience""",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

self.add_argument("--force", action="store_true",
self.add_argument("--force", action="store_true",
help="""overwrite files in sequana config pipeline directory""")
self.add_argument("--name", type=str,
help="""Name of a pipelines for which you wish to
help="""Name of a pipelines for which you wish to
create the completion file. Set to a valid name ror to create all
scripts, use --name all """)

Expand Down Expand Up @@ -78,7 +78,7 @@ def save_completion_script(self):
arguments = self.get_arguments()

with open(output_filename, "w") as fout:
fout.write(self.setup.format(version=self.pipeline_version,
fout.write(self.setup.format(version=self.pipeline_version,
options=" ".join(arguments)))
for action in self._actions:
option_name = action.option_strings[0]
Expand All @@ -87,6 +87,8 @@ def save_completion_script(self):
fout.write(self.set_option_with_choice(option_name, option_choices))
elif option_name.endswith("directory"):
fout.write(self.set_option_directory(option_name))
elif option_name in ["--databases"]:
fout.write(self.set_option_directory(option_name))
fout.write(self.teardown.format(pipeline_name=self.pipeline_name))

def _init_config_file(self):
Expand Down Expand Up @@ -145,6 +147,7 @@ def set_option_directory(self, option_name):
return data



def main(args=None):

if args is None:
Expand Down
19 changes: 8 additions & 11 deletions sequana_pipetools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ def add_options(self, parser):
parser.add_argument("--level", dest="level", default="INFO",
choices=['INFO', 'DEBUG', 'WARNING', 'ERROR', 'CRITICAL'],
help="logging level in INFO, DEBUG, WARNING, ERROR, CRITICAL")
parser.add_argument("--from-project", dest="from_project", default=None,
help="""You can initiate a new analysis run from an existing project.
In theory, sequana project have a hidden .sequana directory,
which can be used as input. The name of the run directory itself
should suffice (if .sequana is found inside). From there,
the config file and the pipeline files are copied in your new
working directory""")


def guess_scheduler():
Expand Down Expand Up @@ -125,8 +132,7 @@ def add_options(self, parser):

class InputOptions():
def __init__(self, group_name="data", input_directory=".",
input_pattern="*fastq.gz", add_input_readtag=True,
add_is_paired=True):
input_pattern="*fastq.gz", add_input_readtag=True):
"""
By default, single-end data sets. If paired, set is_paired to True
Expand All @@ -135,7 +141,6 @@ def __init__(self, group_name="data", input_directory=".",
self.group_name = group_name
self.input_directory = input_directory
self.input_pattern = input_pattern
self.add_is_paired = add_is_paired
self.add_input_readtag = add_input_readtag

def add_options(self, parser):
Expand Down Expand Up @@ -166,14 +171,6 @@ def add_options(self, parser):
--paired-data is used""",
)

if self.add_is_paired:
self.group.add_argument(
"--paired-data",
dest="paired_data",
action="store_true",
help="""NOT IMPLEMENTED YET"""
)


class KrakenOptions():
def __init__(self, group_name="section_kraken"):
Expand Down

0 comments on commit 6c72018

Please sign in to comment.