Skip to content

Commit

Permalink
updates unpaired/unmapped/chimeric options
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Smith committed Mar 4, 2024
1 parent cac1f00 commit 2e5d69e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 24 deletions.
73 changes: 52 additions & 21 deletions umi_tools/Utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,8 @@ def Start(parser=None,
add_extract_options=False,
add_group_dedup_options=True,
add_sam_options=True,
add_dedup_count_sam_options=False,
add_group_sam_options=False,
add_umi_grouping_options=True,
return_parser=False):
"""set up an experiment.
Expand Down Expand Up @@ -885,27 +887,6 @@ def Start(parser=None,
group.add_option("--output-unmapped", dest="output_unmapped", action="store_true",
default=False, help=optparse.SUPPRESS_HELP)

group.add_option("--unmapped-reads", dest="unmapped_reads",
type="choice",
choices=("discard", "use", "output"),
default="discard",
help=("How to handle unmapped reads. Options are "
"'discard', 'use' or 'correct' [default=%default]"))

group.add_option("--chimeric-pairs", dest="chimeric_pairs",
type="choice",
choices=("discard", "use", "output"),
default="use",
help=("How to handle chimeric read pairs. Options are "
"'discard', 'use' or 'correct' [default=%default]"))

group.add_option("--unpaired-reads", dest="unpaired_reads",
type="choice",
choices=("discard", "use", "output"),
default="use",
help=("How to handle unpaired reads. Options are "
"'discard', 'use' or 'correct' [default=%default]"))

group.add_option("--ignore-umi", dest="ignore_umi",
action="store_true", help="Ignore UMI and dedup"
" only on position", default=False)
Expand Down Expand Up @@ -941,6 +922,56 @@ def Start(parser=None,

parser.add_option_group(group)

if add_dedup_count_sam_options:
group = OptionGroup(parser, "Dedup and Count SAM/BAM options")

group.add_option("--unmapped-reads", dest="unmapped_reads",
type="choice",
choices=("discard", "use"),
default="discard",
help=("How to handle unmapped reads. Options are "
"'discard' or 'use'' [default=%default]"))

group.add_option("--chimeric-pairs", dest="chimeric_pairs",
type="choice",
choices=("discard", "use"),
default="use",
help=("How to handle chimeric read pairs. Options are "
"'discard' or 'use' [default=%default]"))

group.add_option("--unpaired-reads", dest="unpaired_reads",
type="choice",
choices=("discard", "use"),
default="use",
help=("How to handle unpaired reads. Options are "
"'discard'or 'use' [default=%default]"))
parser.add_option_group(group)

if add_group_sam_options:
group = OptionGroup(parser, "Group SAM/BAM options")

group.add_option("--unmapped-reads", dest="unmapped_reads",
type="choice",
choices=("discard", "use", "output"),
default="discard",
help=("How to handle unmapped reads. Options are "
"'discard', 'use' or 'output' [default=%default]"))

group.add_option("--chimeric-pairs", dest="chimeric_pairs",
type="choice",
choices=("discard", "use", "output"),
default="use",
help=("How to handle chimeric read pairs. Options are "
"'discard', 'use' or 'output' [default=%default]"))

group.add_option("--unpaired-reads", dest="unpaired_reads",
type="choice",
choices=("discard", "use", "output"),
default="use",
help=("How to handle unpaired reads. Options are "
"'discard', 'use' or 'output' [default=%default]"))
parser.add_option_group(group)

if add_pipe_options:
group = OptionGroup(parser, "input/output options")
group.add_option("-I", "--stdin", dest="stdin", type="string",
Expand Down
2 changes: 1 addition & 1 deletion umi_tools/count.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def main(argv=None):
parser.add_option_group(group)

# add common options (-h/--help, ...) and parse command line
(options, args) = U.Start(parser, argv=argv, add_group_dedup_options=False)
(options, args) = U.Start(parser, argv=argv, add_group_dedup_options=False, add_dedup_count_sam_options=True)

options.per_gene = True # hardcodes counting to per-gene only

Expand Down
2 changes: 1 addition & 1 deletion umi_tools/dedup.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def main(argv=None):
parser.add_option_group(group)

# add common options (-h/--help, ...) and parse command line
(options, args) = U.Start(parser, argv=argv)
(options, args) = U.Start(parser, argv=argv, add_dedup_count_sam_options=True)

U.validateSamOptions(options, group=False)

Expand Down
2 changes: 1 addition & 1 deletion umi_tools/group.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def main(argv=None):
parser.add_option_group(group)

# add common options (-h/--help, ...) and parse command line
(options, args) = U.Start(parser, argv=argv)
(options, args) = U.Start(parser, argv=argv, add_group_sam_options=True)

U.validateSamOptions(options, group=True)

Expand Down

0 comments on commit 2e5d69e

Please sign in to comment.