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

Overlap methods revised #21

Merged
merged 10 commits into from
May 12, 2024
5 changes: 5 additions & 0 deletions docs/_templates/custom_method_summary.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{ fullname | escape | underline }}

.. currentmodule:: {{ module }}

.. automethod:: {{ objname }}
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
exclude_patterns = ['_generated_hidden*']

master_doc = "index"

Expand Down
8 changes: 5 additions & 3 deletions docs/developer_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Task sequence
~~~~~~~~~~~~~

1. Create and download your own Pyranges fork
------------------------------------------
---------------------------------------------

The easiest way to do this is through github. Login into the github website if you aren't already,
then visit the Pyranges page on github, click "Fork" on the top right.
Expand Down Expand Up @@ -295,7 +295,7 @@ case, google how to set up a github token that you can use.


10. Open a pull request
----------------------
-----------------------

The easiest way to open a pull request is through the github website. Go to **your**
Pyranges fork on github, then find the "Contribute" button (near the **<> Code** button). Click
Expand All @@ -315,7 +315,7 @@ Pyranges administrators will inspect the pull request, comment it if necessary,


11. Core team only: upload to PyPI
---------------------------------
----------------------------------

Every now and then, the core development team considers that a new pyranges version should be
released. To do so:
Expand Down Expand Up @@ -347,5 +347,7 @@ property-based tests):

pytest -n 4 tests/property_based

Other useful tools:

* [rg](https://github.com/BurntSushi/ripgrep): ripgrep recursively searches directories for a regex pattern while respecting your gitignore
* [fd](https://github.com/sharkdp/fd): A simple, fast and user-friendly alternative to 'find'
911 changes: 911 additions & 0 deletions docs/how_to_overlap.rst

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions docs/how_to_pages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ How-to pages
These pages explain pyranges functionalities grouped by topic:

.. toctree::
:maxdepth: 2
:maxdepth: 3

how_to_create
how_to_write
how_to_inspect
how_to_rows
how_to_columns
how_to_sequences
how_to_genomic_ops
how_to_genomic_ops
how_to_overlap
5 changes: 2 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ Documentation outline
developer_guide


Indices and tables
==================
Indices
=======

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
4 changes: 2 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ The preferred way to install pyranges is via pip::

pip install pyranges1

The command above will install a minimal version of pyranges.
The command above will install a **minimal version** of pyranges.
Pyranges has several optional dependencies, required for certain functionalities.

To install all optional dependencies, use::
To **install all optional dependencies**, use::

pip install pyranges1[all]

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pyranges1"
version = "1.0.0"
version = "1.0.1"
description = "GenomicRanges for Python."
requires-python = ">=3.12.0"
readme = "README.md"
Expand Down
13 changes: 6 additions & 7 deletions pyranges/core/pyranges_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
STRAND_BEHAVIOR_SAME,
STRAND_COL,
STRICT_STRAND_BEHAVIOR_TYPE,
TEMP_STRAND_COL,
USE_STRAND_AUTO,
VALID_BY_OPTIONS,
VALID_STRAND_BEHAVIOR_OPTIONS,
Expand Down Expand Up @@ -119,17 +118,17 @@ def group_keys_from_validated_strand_behavior(
"""Return group keys based on strand behavior.

If strand_behavior is 'same', return [CHROM_COL, STRAND_COL].
If strand_behavior is 'opposite', return [CHROM_COL, TEMP_STRAND_COL].
If strand_behavior is 'opposite', return [CHROM_COL, STRAND_COL].
If strand_behavior is 'ignore', return [CHROM_COL].

In each case, if a by argument is provided, it is appended/extended to the list of group keys.

"""
strand_cols = (
[STRAND_COL]
if strand_behavior == STRAND_BEHAVIOR_SAME
else ([TEMP_STRAND_COL] if strand_behavior == STRAND_BEHAVIOR_OPPOSITE else [])
)
if strand_behavior == STRAND_BEHAVIOR_AUTO:
msg = "this function must be called with a validated strand_behavior"
raise ValueError(msg)

strand_cols = [STRAND_COL] if strand_behavior in [STRAND_BEHAVIOR_SAME, STRAND_BEHAVIOR_OPPOSITE] else []

return [CHROM_COL, *strand_cols, *arg_to_list(by)]

Expand Down
Loading
Loading