Skip to content

Commit

Permalink
Merge pull request #12 from open2c/master
Browse files Browse the repository at this point in the history
Merge
  • Loading branch information
efriman authored Jul 2, 2024
2 parents 0b25252 + c27f509 commit 0360201
Show file tree
Hide file tree
Showing 15 changed files with 19,724 additions and 269 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Upload Python Package

on:
release:
types: [created]
types: [published]

jobs:
deploy:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/pythonpublish_manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Upload Python Package

on: workflow_dispatch

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
pytest
- name: Test CLI notebook
run: |
pytest --nbsmoke-run docs/source/Examples/Walkthrough_CLI.ipynb
pytest --nbval-lax docs/source/Examples/Walkthrough_CLI.ipynb
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
# Release notes

## [Upcoming release](https://github.com/open2c/coolpuppy/compare/v1.0.0...HEAD)
## [Upcoming release](https://github.com/open2c/coolpuppy/compare/v1.1.0...HEAD)

## [v1.0.0](https://github.com/open2c/coolpuppy/compare/v0.9.5...v1.0.0)
## [v1.1.0] (https://github.com/open2c/coolpuppy/compare/v1.0.0...v1.1.0)

* Added `ignore_group_order` and `--ignore_group_order` argument to flip and combine groups when using groupby, i.e. combining e.g. group1-group2 and group2-group1

* Changed how flipping and group reassignment is implemented

* Fixed zooming near diagonal

* `divide_pups` now allows dividing even if columns are different, gives warning instead

* Added additional tests

* Bug fixes and logs/warnings added

* Changes to walkthroughs

## [v1.0.0](https://github.com/open2c/coolpuppy/compare/0.9.5...v1.0.0)

This is a major release with a lot of changes. The main ones are included below, but probably there are a lot of smaller ones too.

Expand Down
88 changes: 88 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Contributing

## General guidelines

If you haven't contributed to open-source before, we recommend you read [this excellent guide by GitHub on how to contribute to open source](https://opensource.guide/how-to-contribute). The guide is long, so you can gloss over things you're familiar with.

If you're not already familiar with it, we follow the [fork and pull model](https://help.github.com/articles/about-collaborative-development-models) on GitHub. Also, check out this recommended [git workflow](https://www.asmeurer.com/git-workflow/).

As a rough guide for cooltools:
- contributors should preferably work on their forks and submit pull requests to the main branch
- core maintainers can work on feature branches in the main fork and then submit pull requests to the main branch
- core maintainers can push directly to the main branch if it's urgently needed


## Contributing Code

This project has a number of requirements for all code contributed.

* We follow the [PEP-8 style](https://www.python.org/dev/peps/pep-0008/) convention.
* We use [flake8](http://flake8.pycqa.org/en/latest/) to automatically lint the code and maintain code style. You can use a code formatter like [black](https://github.com/psf/black) or [autopep8](https://github.com/hhatto/autopep8) to help keep the linter happy.
* We use [Numpy-style docstrings](https://numpydoc.readthedocs.io/en/latest/format.html).
* User-facing API changes or new features should have documentation added.

Ideally, provide full test coverage for new code submitted in PRs.


## Setting up Your Development Environment

For setting up an isolated virtual environment for development, we recommend using [conda](https://docs.conda.io/en/latest/miniconda.html). After forking and cloning the repository, install in "editable" (i.e. development) mode using the `-e` option:

```sh
$ git clone https://github.com/open2c/coolpuppy.git
$ cd coolpuppy
$ pip install -e .
```

Editable mode installs the package by creating a "link" to your working (repo) directory.


## Unit Tests

It is best if all new functionality and/or bug fixes have unit tests added with each use-case.

We use [pytest](https://docs.pytest.org/en/latest) as our unit testing framework with the `pytest-cov` extension to check code coverage and `pytest-flake8` to check code style. You don't need to configure these extensions yourself.
This automatically checks code style and functionality, and prints code coverage, even though it doesn't fail on low coverage.

Once you've configured your environment, you can just `cd` to the root of your repository and run

```sh
$ pytest
```

Unit tests are automatically run on GitHub Actions for pull requests.


## Coverage

The `pytest` script automatically reports coverage, both on the terminal for missing line numbers, and in annotated HTML form in `htmlcov/index.html`.


## Documentation

If a feature is stable and relatively finalized, it is time to add it to the documentation. If you are adding any private/public functions, it is best to add docstrings, to aid in reviewing code and also for the API reference.

We use [Numpy style docstrings](https://numpydoc.readthedocs.io/en/latest/format.html>) and [Sphinx](http://www.sphinx-doc.org/en/stable) to document this library. Sphinx, in turn, uses [reStructuredText](http://www.sphinx-doc.org/en/stable/rest.html) as its markup language for adding code.

We use the [Sphinx Autosummary extension](http://www.sphinx-doc.org/en/stable/ext/autosummary.html) to generate API references. You may want to look at `docs/api.rst` to see how these files look and where to add new functions, classes or modules.

We also use the [nbsphinx extension](https://nbsphinx.readthedocs.io/en/0.5.0/) to render tutorial pages from Jupyter notebooks.

To build the documentation:

```sh
$ make docs
```

After this, you can find an HTML version of the documentation in `docs/_build/html/index.html`.

Documentation from `master` and tagged releases is automatically built and hosted thanks to [readthedocs](https://readthedocs.org/).


## Acknowledgement

If you've contributed significantly and would like your authorship to be included in subsequent uploads to [Zenodo](https://zenodo.org), please make a separate PR to add your name and affiliation to the `.zenodo.json` file.

---

This document was modified from the [guidelines from the sparse project](https://github.com/pydata/sparse/blob/master/docs/contributing.rst).
19 changes: 19 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
include CHANGELOG.md
include README.md
include LICENSE
include requirements.txt
include requirements-dev.txt

graft tests
graft docs
prune docs/_build
prune docs/_static
prune docs/_templates

global-exclude __pycache__/*
global-exclude *.so
global-exclude *.pyd
global-exclude *.pyc
global-exclude .git*
global-exclude .deps/*
global-exclude .DS_Store
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# coolpup.py
[![DOI](https://zenodo.org/badge/147190130.svg)](https://zenodo.org/badge/latestdoi/147190130)
[![PyPI version](https://badge.fury.io/py/coolpuppy.svg)](https://badge.fury.io/py/coolpuppy)
[![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat)](http://bioconda.github.io/recipes/coolpuppy/README.html)
[![Pytest](https://github.com/open2c/coolpuppy/actions/workflows/tests.yml/badge.svg)](https://github.com/open2c/coolpuppy/actions/workflows/tests.yml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Docs status](https://readthedocs.org/projects/coolpuppy/badge/)](https://coolpuppy.readthedocs.io/en/latest/)
Expand All @@ -25,7 +26,7 @@ What is very important for this quantification, is the normalization to expected

## `coolpup.py` vs `cooltools pileup`

`cooltools` is the main package with Hi-C analysis maintained by open2C. It also has a tool to perform pileups. Why does `coolpup.py` exit then?
`cooltools` is the main package with Hi-C analysis maintained by open2C. It also has a tool to perform pileups. Why does `coolpup.py` exist then?
The way `cooltools pileup` works, is it accumulates all snippets for the pileup into one 3D array (stack). Which gives a lot of flexibility in case one wants to subset the snippets based on some features later, or do some other non-standard computations based on the stack. But this is only advantageous when one performs analysis using the Python API, and moreover limits the application of `cooltools pileup` so it can't be applied to a truly large number of snippets due to memory requirements. That's where `coolpup.py` comes in: internally it never stores more than one snippet in memory, hence there is no limit to how many snippets can be processed. `coolpup.py` is particularly well suited performance-wise for analysing huge numbers of potential interactions, since it loads whole chromosomes into memory one by one (or in parallel to speed it up) to extract small submatrices quickly. Having to read everything into memory makes it relatively slow for small numbers of loops, but performance doesn't decrease until you reach a huge number of interactions. Additionally, `cooltools pileup` doesn't support inter-chromosomal (trans) pileups, however it is possible in `coolpup.py`.

While there is no way to subset the snippets after the pileup is generated (since they are not stored), `coolpup.py` allows one to perform various subsetting during the pileup procedure. Builtin options in the CLI are subsetting by distance, by strand, by strand and distance at the same time, and by window/region - in case of a provided BED file, one pileup is generated for each row against all others in the same chromosome; in case of trans-pileups, pileups for each chromosome pair can be generated. Importantly, in Python API any arbitrary grouping of snippets is possible.
Expand Down
2 changes: 1 addition & 1 deletion coolpuppy/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__version__ = "1.0.0"
__version__ = "1.1.0"
Loading

0 comments on commit 0360201

Please sign in to comment.