Skip to content

Commit

Permalink
Merge pull request #130 from efriman/master
Browse files Browse the repository at this point in the history
Added ignore_group_order argument
  • Loading branch information
efriman authored Jul 11, 2023
2 parents e773db9 + 0b25252 commit 472f6dc
Show file tree
Hide file tree
Showing 9 changed files with 1,611 additions and 726 deletions.
25 changes: 23 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"
# You can also specify other tool versions:
# nodejs: "19"
# rust: "1.64"
# golang: "1.19"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
configuration: docs/source/conf.py

# If using Sphinx, optionally build your docs in additional formats such as PDF
# formats:
# - pdf

# Optionally declare the Python requirements required to build your docs
python:
setup_py_install: false
install:
- requirements: docs/requirements.txt
24 changes: 24 additions & 0 deletions coolpuppy/CLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ def parse_args_coolpuppy():
'1' and '2', i.e. if features have a column 'group', specify 'group1 group2'.,
e.g. --groupby chrom1 chrom2""",
)
parser.add_argument(
"--ignore_group_order",
nargs="*",
required=False,
help="""When using groupby, reorder so that e.g. group1-group2 and group2-group1 will be
combined into one and flipped to the correct orientation. If using multiple paired
groupings (e.g. group1-group2 and category1-category2), need to specify which
grouping should be prioritised, e.g. "group" or "group1 group2". For flip_negative_strand,
+- and -+ strands will be combined""",
)
parser.add_argument(
"--flip_negative_strand",
"--flip-negative-strand",
Expand Down Expand Up @@ -366,6 +376,19 @@ def _excepthook(exc_type, value, tb):
else:
args.by_distance = False
distance_edges = False

if args.ignore_group_order is not None:
if len(args.ignore_group_order) > 0:
try:
args.ignore_group_order = [str(item) for item in args.ignore_group_order]
except:
raise ValueError(
"ignore_group_order must be one or two strings separated with spaces."
)
else:
args.ignore_group_order = True
else:
args.ignore_group_order = False

logger = logging.getLogger("coolpuppy")
logger.setLevel(getattr(logging, args.logLevel))
Expand Down Expand Up @@ -528,6 +551,7 @@ def _excepthook(exc_type, value, tb):
by_strand=args.by_strand,
by_distance=distance_edges,
groupby=[] if args.groupby is None else args.groupby,
ignore_group_order=args.ignore_group_order,
flip_negative_strand=args.flip_negative_strand,
local=args.local,
coverage_norm=args.coverage_norm,
Expand Down
Loading

0 comments on commit 472f6dc

Please sign in to comment.