[med-svn] [Git][med-team/python-cooler][upstream] New upstream version 0.8.11

Andreas Tille (@tille) gitlab at salsa.debian.org
Thu Sep 30 12:44:06 BST 2021



Andreas Tille pushed to branch upstream at Debian Med / python-cooler


Commits:
a2344c24 by Andreas Tille at 2021-09-30T11:58:24+02:00
New upstream version 0.8.11
- - - - -


16 changed files:

- .travis.yml
- CHANGES.md
- CONTRIBUTING.md
- README.md
- cooler/_version.py
- cooler/cli/cload.py
- cooler/cli/zoomify.py
- cooler/create/__init__.py
- cooler/create/_ingest.py
- docs/cli.rst
- docs/datamodel.rst
- docs/index.rst
- docs/make_cli_rst.py
- docs/quickstart.rst
- setup.py
- tests/test_create_sanitize.py


Changes:

=====================================
.travis.yml
=====================================
@@ -5,6 +5,7 @@ python:
   - "3.6"
   - "3.7"
   - "3.8"
+  - "3.9"
 install:
   - sudo apt-get update
   - sudo apt-get install -y pigz tabix


=====================================
CHANGES.md
=====================================
@@ -1,13 +1,13 @@
 # Release notes #
 
-## [v0.8.10](https://github.com/mirnylab/cooler/compare/v0.8.9...v0.8.10)
+## [v0.8.10](https://github.com/open2c/cooler/compare/v0.8.9...v0.8.10)
 
 Date : 2020-09-25
 
 ### Bug fixes
 * Fixed the new header parsing in `cooler cload pairs` to handle esoteric file stream implementations. Specifically `GzipFile` had stopped working. By @golobor
 
-## [v0.8.9](https://github.com/mirnylab/cooler/compare/v0.8.8...v0.8.9)
+## [v0.8.9](https://github.com/open2c/cooler/compare/v0.8.8...v0.8.9)
 
 Date : 2020-07-17
 
@@ -15,7 +15,7 @@ Date : 2020-07-17
 * Added single-cell cooler file flavor (.scool) (#201)
 
 
-## [v0.8.8](https://github.com/mirnylab/cooler/compare/v0.8.7...v0.8.8)
+## [v0.8.8](https://github.com/open2c/cooler/compare/v0.8.7...v0.8.8)
 
 Date : 2020-06-23
 
@@ -32,7 +32,7 @@ Date : 2020-06-23
 * Allow hashes in read IDs in cload pairs (#193)
 
 
-## [v0.8.7](https://github.com/mirnylab/cooler/compare/v0.8.6...v0.8.7)
+## [v0.8.7](https://github.com/open2c/cooler/compare/v0.8.6...v0.8.7)
 
 Date: 2020-01-12
 
@@ -44,7 +44,7 @@ Date: 2020-01-12
 * Replace `json` with `simplejson` to deal with attrs stored as bytes
 
 
-## [v0.8.6](https://github.com/mirnylab/cooler/compare/v0.8.5...v0.8.6)
+## [v0.8.6](https://github.com/open2c/cooler/compare/v0.8.5...v0.8.6)
 
 Date: 2019-08-12
 
@@ -57,7 +57,7 @@ Date: 2019-08-12
 Post-release `v0.8.6.post0`: requirements files added to MANIFEST.in
 
 
-## [v0.8.5](https://github.com/mirnylab/cooler/compare/v0.8.4...v0.8.5)
+## [v0.8.5](https://github.com/open2c/cooler/compare/v0.8.4...v0.8.5)
 
 Date: 2019-04-08
 
@@ -65,7 +65,7 @@ Date: 2019-04-08
 * Fixed a regression that prevented selection of bins excluding the `chrom` column.
 
 
-## [v0.8.4](https://github.com/mirnylab/cooler/compare/v0.8.3...v0.8.4)
+## [v0.8.4](https://github.com/open2c/cooler/compare/v0.8.3...v0.8.4)
 
 Date: 2019-04-04
 
@@ -81,7 +81,7 @@ Date: 2019-04-04
 * `Cooler.bins()` selector will always properly convert bins/chrom integer IDs to categorical chromosome names when the number of contigs is very large and therefore the HDF5 ENUM header is missing. Before this would only happen when explicitly requesting `convert_enum=True`.
 
 
-## [v0.8.3](https://github.com/mirnylab/cooler/compare/v0.8.2...v0.8.3)
+## [v0.8.3](https://github.com/open2c/cooler/compare/v0.8.2...v0.8.3)
 
 Date: 2019-02-11
 
@@ -90,7 +90,7 @@ Date: 2019-02-11
 * `create_cooler` no longer requires a "count" column when specifying custom value columns
 
 
-## [v0.8.2](https://github.com/mirnylab/cooler/compare/v0.8.1...v0.8.2)
+## [v0.8.2](https://github.com/open2c/cooler/compare/v0.8.1...v0.8.2)
 
 Date: 2019-01-20
 
@@ -105,7 +105,7 @@ New options for `cooler dump` pixel output:
 * A bug was introduced into the matrix-as-pixels selector in 0.8.0 that also affected `cooler dump`. The behavior has been restored to that in 0.7.
 
 
-## [v0.8.1](https://github.com/mirnylab/cooler/compare/v0.8.0...v0.8.1)
+## [v0.8.1](https://github.com/open2c/cooler/compare/v0.8.0...v0.8.1)
 
 Date: 2019-01-02
 
@@ -120,7 +120,7 @@ Date: 2019-01-02
 * Restore but deprecate `cooler.io.ls` for backwards compatibility.
 
 
-## [v0.8.0](https://github.com/mirnylab/cooler/compare/v0.7.11...v0.8.0)
+## [v0.8.0](https://github.com/open2c/cooler/compare/v0.7.11...v0.8.0)
 
 Date: 2018-12-31
 
@@ -168,7 +168,7 @@ This is a major release from 0.7 and includes an updated format version, and sev
 * Unit tests refactored and re-written for pytest.
 
 
-## [v0.7.11](https://github.com/mirnylab/cooler/compare/v0.7.10...v0.7.11)
+## [v0.7.11](https://github.com/open2c/cooler/compare/v0.7.10...v0.7.11)
 
 Date: 2018-08-17
 
@@ -181,7 +181,7 @@ Bug fixes
 * Fix `--count-as-float` regression in load/cload.
 
 
-## [v0.7.10](https://github.com/mirnylab/cooler/compare/v0.7.9...v0.7.10)
+## [v0.7.10](https://github.com/open2c/cooler/compare/v0.7.9...v0.7.10)
 
 Date: 2018-05-07
 
@@ -190,7 +190,7 @@ Date: 2018-05-07
 * Start using shuffle filter by default
 
 
-## [v0.7.9](https://github.com/mirnylab/cooler/compare/v0.7.8...v0.7.9)
+## [v0.7.9](https://github.com/open2c/cooler/compare/v0.7.8...v0.7.9)
 
 Date: 2018-03-30
 
@@ -198,7 +198,7 @@ Date: 2018-03-30
 * Fixed error introduced into cload pairix in last release.
 
 
-## [v0.7.8](https://github.com/mirnylab/cooler/compare/v0.7.7...v0.7.8)
+## [v0.7.8](https://github.com/open2c/cooler/compare/v0.7.7...v0.7.8)
 
 Date: 2018-03-18
 
@@ -214,7 +214,7 @@ Date: 2018-03-18
 * Added extra checks in `cload pairix` and `cload tabix`. #62, #75
 
 
-## [v0.7.7](https://github.com/mirnylab/cooler/compare/v0.7.6...v0.7.7)
+## [v0.7.7](https://github.com/open2c/cooler/compare/v0.7.6...v0.7.7)
 
 Date: 2018-03-16
 
@@ -233,7 +233,7 @@ Date: 2018-03-16
 * Fix argmax deprecation. #99
 
 
-## [v0.7.6](https://github.com/mirnylab/cooler/compare/v0.7.5...v0.7.6)
+## [v0.7.6](https://github.com/open2c/cooler/compare/v0.7.5...v0.7.6)
 
 Date: 2017-10-31
 
@@ -252,7 +252,7 @@ Date: 2017-10-31
 Happy Halloween!
 
 
-## [v0.7.5](https://github.com/mirnylab/cooler/compare/v0.7.4...v0.7.5)
+## [v0.7.5](https://github.com/open2c/cooler/compare/v0.7.4...v0.7.5)
 
 Date: 2017-07-13
 
@@ -260,7 +260,7 @@ Date: 2017-07-13
 * Add transform options to higlass API
 
 
-## [v0.7.4](https://github.com/mirnylab/cooler/compare/v0.7.3...v0.7.4)
+## [v0.7.4](https://github.com/open2c/cooler/compare/v0.7.3...v0.7.4)
 
 Date: 2017-05-25
 
@@ -268,14 +268,14 @@ Date: 2017-05-25
 * Fix special cases where cooler.io.create and append would not work with certain inputs
 
 
-## [v0.7.3](https://github.com/mirnylab/cooler/compare/v0.7.2...v0.7.3)
+## [v0.7.3](https://github.com/open2c/cooler/compare/v0.7.2...v0.7.3)
 
 Date: 2017-05-22
 
 * Added function to print higlass zoom resolutions for a given genome and base resolution.
 
 
-## [v0.7.2](https://github.com/mirnylab/cooler/compare/v0.7.1...v0.7.2)
+## [v0.7.2](https://github.com/open2c/cooler/compare/v0.7.1...v0.7.2)
 
 Date: 2017-05-09
 
@@ -283,7 +283,7 @@ Date: 2017-05-09
 * Restore zoom binsize metadata to higlass files
 
 
-## [v0.7.1](https://github.com/mirnylab/cooler/compare/v0.7.0...v0.7.1)
+## [v0.7.1](https://github.com/open2c/cooler/compare/v0.7.0...v0.7.1)
 
 Date: 2017-04-29
 
@@ -292,7 +292,7 @@ Date: 2017-04-29
 * Eliminate hard dependence on dask to make pip installs simpler. Conda package will retain dask as a run time requirement.
 
 
-## [v0.7.0](https://github.com/mirnylab/cooler/compare/v0.6.6...v0.7.0)
+## [v0.7.0](https://github.com/open2c/cooler/compare/v0.6.6...v0.7.0)
 
 Date: 2017-04-27
 
@@ -324,7 +324,7 @@ Date: 2017-04-27
 * `Cooler.open` function now correctly opens the specific root group of the Cooler and behaves like a proper context manager in all cases
 
 
-## [v0.6.6](https://github.com/mirnylab/cooler/compare/v0.6.5...v0.6.6)
+## [v0.6.6](https://github.com/open2c/cooler/compare/v0.6.5...v0.6.6)
 
 Date: 2017-03-21
 
@@ -332,14 +332,14 @@ Date: 2017-03-21
 * Improved pairix and tabix iterators, dropped need for slow first pass over contacts
 
 
-## [v0.6.5](https://github.com/mirnylab/cooler/compare/v0.6.4...v0.6.5)
+## [v0.6.5](https://github.com/open2c/cooler/compare/v0.6.4...v0.6.5)
 
 Date: 2017-03-18
 
 * Fixed pairix aggregator to properly deal with autoflipping of pairs
 
 
-## [v0.6.4](https://github.com/mirnylab/cooler/compare/v0.6.3...v0.6.4)
+## [v0.6.4](https://github.com/open2c/cooler/compare/v0.6.3...v0.6.4)
 
 Date: 2017-03-17
 
@@ -347,7 +347,7 @@ Date: 2017-03-17
 * Fixed pairix aggregator to properly deal with autoflipping of pairs
 
 
-## [v0.6.3](https://github.com/mirnylab/cooler/compare/v0.6.2...v0.6.3)
+## [v0.6.3](https://github.com/open2c/cooler/compare/v0.6.2...v0.6.3)
 
 Date: 2017-02-22
 
@@ -356,7 +356,7 @@ Date: 2017-02-22
 * Return matrix scale factor in balance stats rather than the bias scale factor: #35.
 
 
-## [v0.6.2](https://github.com/mirnylab/cooler/compare/v0.6.1...v0.6.2)
+## [v0.6.2](https://github.com/open2c/cooler/compare/v0.6.1...v0.6.2)
 
 Date: 2017-02-12
 
@@ -366,14 +366,14 @@ Fixed regressions in
 * cooler show
 
 
-## [v0.6.1](https://github.com/mirnylab/cooler/compare/v0.6.0...v0.6.1)
+## [v0.6.1](https://github.com/open2c/cooler/compare/v0.6.0...v0.6.1)
 
 Date: 2017-02-06
 
 * This fixes stale build used in bdist_wheel packaging that broke 0.6.0. #29
 
 
-## [v0.6.0](https://github.com/mirnylab/cooler/compare/v0.5.3...v0.6.0)
+## [v0.6.0](https://github.com/open2c/cooler/compare/v0.5.3...v0.6.0)
 
 Date: 2017-02-03
 
@@ -403,7 +403,7 @@ Date: 2017-02-03
 * Fixed bug in `csort` that led to incorrect triangularity of trans read pairs.
 
 
-## [v0.5.3](https://github.com/mirnylab/cooler/compare/v0.5.2...v0.5.3)
+## [v0.5.3](https://github.com/open2c/cooler/compare/v0.5.2...v0.5.3)
 
 Date: 2016-09-10
 
@@ -414,7 +414,7 @@ Date: 2016-09-10
 * `cooler cload` raises a warning when bin file lists a contig missing from the contact list
 
 
-## [v0.5.2](https://github.com/mirnylab/cooler/compare/v0.5.1...v0.5.2)
+## [v0.5.2](https://github.com/open2c/cooler/compare/v0.5.1...v0.5.2)
 
 Date: 2016-08-26
 
@@ -423,7 +423,7 @@ Date: 2016-08-26
 * Fix typo in setup.py and add pysam to dependencies.
 
 
-## [v0.5.1](https://github.com/mirnylab/cooler/compare/v0.5.0...v0.5.1)
+## [v0.5.1](https://github.com/open2c/cooler/compare/v0.5.0...v0.5.1)
 
 Date: 2016-08-24
 
@@ -432,7 +432,7 @@ Date: 2016-08-24
 * Rename `cooler binnify` to `cooler makebins`. Binnify sounds like "aggregate" which is what `cload` does.
 
 
-## [v0.5.0](https://github.com/mirnylab/cooler/compare/v0.4.0...v0.5.0)
+## [v0.5.0](https://github.com/open2c/cooler/compare/v0.4.0...v0.5.0)
 
 Date: 2016-08-24
 
@@ -442,7 +442,7 @@ Date: 2016-08-24
 * Minor bug fixes.
 
 
-## [v0.4.0](https://github.com/mirnylab/cooler/compare/v0.3.0...v0.4.0)
+## [v0.4.0](https://github.com/open2c/cooler/compare/v0.3.0...v0.4.0)
 
 Date: 2016-08-18
 
@@ -463,7 +463,7 @@ Date: 2016-08-18
 * Added new scripts for contact aggregation, loading, dumping and balancing
 
 
-## [v0.3.0](https://github.com/mirnylab/cooler/compare/v0.2.1...v0.3.0)
+## [v0.3.0](https://github.com/open2c/cooler/compare/v0.2.1...v0.3.0)
 
 Date: 2016-02-18
 
@@ -473,21 +473,21 @@ Date: 2016-02-18
 * Genomic locus string parser now accepts ENSEMBL-style number-only chromosome names and FASTA-style sequence names containing pipes.
 
 
-## [v0.2.1](https://github.com/mirnylab/cooler/compare/v0.2...v0.2.1)
+## [v0.2.1](https://github.com/open2c/cooler/compare/v0.2...v0.2.1)
 
 Date: 2016-02-07
 
 * Fixed bintable region fetcher
 
 
-## [v0.2](https://github.com/mirnylab/cooler/compare/v0.1...v0.2)
+## [v0.2](https://github.com/open2c/cooler/compare/v0.1...v0.2)
 
 Date: 2016-01-17
 
 * First beta release
 
 
-## [v0.1](https://github.com/mirnylab/cooler/releases/tag/v0.1)
+## [v0.1](https://github.com/open2c/cooler/releases/tag/v0.1)
 
 Date: 2015-11-22
 


=====================================
CONTRIBUTING.md
=====================================
@@ -21,7 +21,7 @@ This project has a number of requirements for all code contributed.
 After forking and cloning the repository, install in "editable" (i.e. development) mode using the `-e` option:
 
 ```sh
-git clone https://github.com/mirnylab/cooler.git
+git clone https://github.com/open2c/cooler.git
 cd cooler
 pip install -e .[all]
 ```


=====================================
README.md
=====================================
@@ -1,13 +1,13 @@
 # Cooler
 
-<a href="https://mirnylab.github.io/cooler"><img width="25%" src="https://github.com/mirnylab/cooler/raw/master/docs/cooler_logo.png" alt="Cooler"></a>
+<a href="https://open2c.github.io/cooler"><img width="25%" src="https://github.com/open2c/cooler/raw/master/docs/cooler_logo.png" alt="Cooler"></a>
 
-[![Build Status](https://travis-ci.org/mirnylab/cooler.svg?branch=master)](https://travis-ci.org/mirnylab/cooler)
-[![CodeCov](https://codecov.io/gh/mirnylab/cooler/branch/master/graph/badge.svg)](https://codecov.io/gh/mirnylab/cooler)
+[![Build Status](https://travis-ci.org/open2c/cooler.svg?branch=master)](https://travis-ci.org/open2c/cooler)
+[![CodeCov](https://codecov.io/gh/open2c/cooler/branch/master/graph/badge.svg)](https://codecov.io/gh/open2c/cooler)
 [![Documentation Status](https://readthedocs.org/projects/cooler/badge/?version=latest)](http://cooler.readthedocs.org/en/latest/)
 [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat-square)](http://bioconda.github.io/recipes/cooler/README.html)
-[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/mirnylab/cooler-binder/master)
-[![Join the chat at https://gitter.im/mirnylab/cooler](https://badges.gitter.im/mirnylab/cooler.svg)](https://gitter.im/mirnylab/cooler?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/open2c/cooler-binder/master)
+[![Join the chat on Slack](https://img.shields.io/badge/chat-slack-%233F0F3F?logo=slack)](https://bit.ly/2UaOpAe)
 [![DOI](https://zenodo.org/badge/49553222.svg)](https://zenodo.org/badge/latestdoi/49553222)
 
 ## A cool place to store your Hi-C
@@ -19,7 +19,7 @@ The cooler file format is an implementation of a genomic matrix data model using
 To get started:
 
 - [Install](#Installation) cooler
-- Read the [documentation](http://cooler.readthedocs.org/en/latest/) and see the Jupyter Notebook [walkthrough](https://github.com/mirnylab/cooler-binder).
+- Read the [documentation](http://cooler.readthedocs.org/en/latest/) and see the Jupyter Notebook [walkthrough](https://github.com/open2c/cooler-binder).
 - _cool_ files from published Hi-C data sets are available at `ftp://cooler.csail.mit.edu/coolers`.
 - Many more multires (_mcool_) files are available on the [4DN data portal](https://data.4dnucleome.org/visualization/index).
 
@@ -47,7 +47,7 @@ See the [docs](http://cooler.readthedocs.org/en/latest/) for more information.
 
 ### Contributing
 
-Interested in contributing to cooler? That's great! To get started, check out the [contributing guide](https://github.com/mirnylab/cooler/blob/master/CONTRIBUTING.md).
+Interested in contributing to cooler? That's great! To get started, check out the [contributing guide](https://github.com/open2c/cooler/blob/master/CONTRIBUTING.md).
 
 
 ### Citing
@@ -72,7 +72,7 @@ BSD (3 Clause)
 
 ### Related projects
 
-- Process Hi-C data with [distiller](https://github.com/mirnylab/distiller)!
-- Downstream analysis with [cooltools](https://github.com/mirnylab/cooltools)!
+- Process Hi-C data with [distiller](https://github.com/open2c/distiller)!
+- Downstream analysis with [cooltools](https://github.com/open2c/cooltools)!
 - Visualize your cooler data with [HiGlass](http://higlass.io)!
 


=====================================
cooler/_version.py
=====================================
@@ -1,4 +1,4 @@
-__version__ = "0.8.10"
+__version__ = "0.8.11"
 __format_version__ = 3
 __format_version_mcool__ = 2
 __format_version_scool__ = 1


=====================================
cooler/cli/cload.py
=====================================
@@ -20,8 +20,8 @@ from ..create import (
     TabixAggregator, HDF5Aggregator, PairixAggregator,
 )
 
-_pandas_major_version = int(pd.__version__.split('.')[0])
-if _pandas_major_version > 0:
+_pandas_version = pd.__version__.split('.')
+if int(_pandas_version[0]) > 0:
     from pandas.io.common import get_handle
 
 
@@ -140,7 +140,7 @@ def hiclib(bins, pairs_path, cool_path, metadata, assembly, chunksize):
 
     {}
 
-    hiclib on BitBucket: <https://bitbucket.org/mirnylab/hiclib>.
+    hiclib on BitBucket: <https://github.com/mirnylab/hiclib-legacy>.
 
     """
 
@@ -542,13 +542,18 @@ def pairs(bins, pairs_path, cool_path, metadata, assembly, chunksize,
     if pairs_path == '-':
         f_in = sys.stdin
         _, f_in = get_header(f_in)
-    elif _pandas_major_version > 0:
-        f_in = get_handle(pairs_path, mode='r', compression='infer')[0]
+    elif int(_pandas_version[0]) > 0:
+        if int(_pandas_version[1]) < 2:
+            f_in = get_handle(pairs_path, mode='r', compression='infer')[0]
+        else:
+            f_in = get_handle(pairs_path, mode='r', compression='infer').handle
+
         _, f_in = get_header(f_in)
     else:
         f_in = pairs_path
         kwargs['comment'] = '#'
 
+
     reader = pd.read_csv(
         f_in,
         sep='\t',


=====================================
cooler/cli/zoomify.py
=====================================
@@ -88,7 +88,9 @@ def invoke_balance(args, resolutions, outfile):
 )
 @click.option(
     "--balance-args",
-    help="Additional arguments to pass to cooler balance",
+    help="Additional arguments to pass to cooler balance. To deal with space ambiguity, "
+    "use quotes to pass multiple arguments, e.g. --balance-args '--nproc 8 --ignore-diags 3' "
+    "Note that nproc for balancing must be specified independently of zoomify arguments.",
     type=str
 )
 @click.option(


=====================================
cooler/create/__init__.py
=====================================
@@ -5,7 +5,7 @@ MAGIC = u"HDF5::Cooler"
 MAGIC_SCOOL = u"HDF5::SCOOL"
 MAGIC_MCOOL = u"HDF5::MCOOL"
 
-URL = u"https://github.com/mirnylab/cooler"
+URL = u"https://github.com/open2c/cooler"
 CHROM_DTYPE = np.dtype("S")
 CHROMID_DTYPE = np.int32
 CHROMSIZE_DTYPE = np.int32


=====================================
cooler/create/_ingest.py
=====================================
@@ -127,7 +127,7 @@ def _sanitize_records(
         if np.any(is_neg):
             err = chunk[is_neg]
             raise BadInputError(
-                "Found an anchor position with negative value:\n{}".format(
+                "Found an anchor position with negative value. Make sure your coordinates are 1-based or use the --zero-based option when loading. \n{}".format(
                     err.head().to_csv(sep="\t")
                 )
             )
@@ -144,21 +144,27 @@ def _sanitize_records(
             )
 
     # Handle lower triangle records
+    # Note: Swap assignment works as desired because boolean masks create copies
+    # See https://github.com/open2c/cooler/pull/229
     if tril_action is not None:
         is_tril = (chrom1_ids > chrom2_ids) | (
             (chrom1_ids == chrom2_ids) & (anchor1 > anchor2)
         )
         if np.any(is_tril):
             if tril_action == "reflect":
-                chrom1_ids[is_tril], chrom2_ids[is_tril] = (
+                (
+                    chrom1_ids[is_tril],
+                    chrom2_ids[is_tril]
+                ) = (
                     chrom2_ids[is_tril],
                     chrom1_ids[is_tril],
                 )
                 anchor1[is_tril], anchor2[is_tril] = anchor2[is_tril], anchor1[is_tril]
                 for field in sided_fields:
-                    chunk.loc[is_tril, field + suffixes[0]], chunk.loc[
-                        is_tril, field + suffixes[1]
-                    ] = (
+                    (
+                        chunk.loc[is_tril, field + suffixes[0]],
+                        chunk.loc[is_tril, field + suffixes[1]]
+                    ) = (
                         chunk.loc[is_tril, field + suffixes[1]],
                         chunk.loc[is_tril, field + suffixes[0]],
                     )
@@ -304,18 +310,24 @@ def _sanitize_pixels(
         chunk[bin1_field] -= 1
         chunk[bin2_field] -= 1
 
+    # Note: Swap assignment works as desired because boolean masks create copies
+    # See https://github.com/open2c/cooler/pull/229
     if tril_action is not None:
         is_tril = chunk[bin1_field] > chunk[bin2_field]
         if np.any(is_tril):
             if tril_action == "reflect":
-                chunk.loc[is_tril, bin1_field], chunk.loc[is_tril, bin2_field] = (
+                (
+                    chunk.loc[is_tril, bin1_field],
+                    chunk.loc[is_tril, bin2_field]
+                ) = (
                     chunk.loc[is_tril, bin2_field],
                     chunk.loc[is_tril, bin1_field],
                 )
                 for field in sided_fields:
-                    chunk.loc[is_tril, field + suffixes[0]], chunk.loc[
-                        is_tril, field + suffixes[1]
-                    ] = (
+                    (
+                        chunk.loc[is_tril, field + suffixes[0]],
+                        chunk.loc[is_tril, field + suffixes[1]]
+                    ) = (
                         chunk.loc[is_tril, field + suffixes[1]],
                         chunk.loc[is_tril, field + suffixes[0]],
                     )


=====================================
docs/cli.rst
=====================================
@@ -115,7 +115,7 @@ Quick reference
 
     Show the version and exit.
 
-See the cooler_cli.ipynb Jupyter Notebook for specific examples on usage: (https://github.com/mirnylab/cooler-binder).
+See the cooler_cli.ipynb Jupyter Notebook for specific examples on usage: (https://github.com/open2c/cooler-binder).
 
 ----
 
@@ -403,7 +403,7 @@ PAIRS_PATH : Path to contacts (i.e. read pairs) file.
 
 COOL_PATH : Output COOL file path or URI.
 
-hiclib on BitBucket: <https://bitbucket.org/mirnylab/hiclib>.
+hiclib on BitBucket: <https://github.com/mirnylab/hiclib-legacy>.
 
 .. program:: cooler cload hiclib
 .. code-block:: shell


=====================================
docs/datamodel.rst
=====================================
@@ -4,7 +4,7 @@
 What is cooler?
 ===============
 
-Cooler is the :ref:`implementation <schema>` of a data model for genomically-labeled sparse 2D arrays (matrices) with identical axes in HDF5. It is also the name of the `Python package <https://github.com/mirnylab/cooler>`_ that supports the format.
+Cooler is the :ref:`implementation <schema>` of a data model for genomically-labeled sparse 2D arrays (matrices) with identical axes in HDF5. It is also the name of the `Python package <https://github.com/open2c/cooler>`_ that supports the format.
 
 We use the term genomically-labeled array to refer to a data structure that assigns unique quantitative values to tuples of *genomic bins* obtained from an interval partition of a reference genome assembly. The tuples of bins make up the coordinates of the array’s elements. By omitting elements possessing zero or no value, the representation becomes sparse.
 


=====================================
docs/index.rst
=====================================
@@ -16,7 +16,7 @@ The cooler package aims to facilitate:
 * Scalable out-of-core operations on the data.
 * Data export and visualization.
 
-Follow cooler development on `GitHub <https://github.com/mirnylab/cooler>`_.
+Follow cooler development on `GitHub <https://github.com/open2c/cooler>`_.
 
 
 Contents:


=====================================
docs/make_cli_rst.py
=====================================
@@ -426,7 +426,7 @@ Quick reference
 
     Show the version and exit.
 
-See the cooler_cli.ipynb Jupyter Notebook for specific examples on usage: (https://github.com/mirnylab/cooler-binder).
+See the cooler_cli.ipynb Jupyter Notebook for specific examples on usage: (https://github.com/open2c/cooler-binder).
 
 ----
 


=====================================
docs/quickstart.rst
=====================================
@@ -35,7 +35,7 @@ Command line interface
 
 See:
 
-- Jupyter Notebook `CLI walkthrough <https://github.com/mirnylab/cooler-binder/blob/master/cooler_cli.ipynb>`_.
+- Jupyter Notebook `CLI walkthrough <https://github.com/open2c/cooler-binder/blob/master/cooler_cli.ipynb>`_.
 - The `CLI Reference <http://cooler.readthedocs.io/en/latest/cli.html>`_ for more information.
 
 
@@ -68,7 +68,7 @@ Python API
 
 See: 
 
-- Jupyter Notebook `API walkthrough <https://github.com/mirnylab/cooler-binder/blob/master/cooler_api.ipynb>`_.
+- Jupyter Notebook `API walkthrough <https://github.com/open2c/cooler-binder/blob/master/cooler_api.ipynb>`_.
 - The :ref:`api-reference` for more information.
 
 The :py:mod:`cooler` library provides a thin wrapper over the excellent NumPy-aware `h5py <http://docs.h5py.org/en/latest/>`_ Python interface to HDF5. It supports creation of cooler files and the following types of **range queries** on the data:


=====================================
setup.py
=====================================
@@ -19,6 +19,7 @@ classifiers = """\
     Programming Language :: Python :: 3.6
     Programming Language :: Python :: 3.7
     Programming Language :: Python :: 3.8
+    Programming Language :: Python :: 3.9
 """
 
 
@@ -75,7 +76,7 @@ setup(
     long_description=get_long_description(),
     long_description_content_type='text/markdown',
     keywords=['genomics', 'bioinformatics', 'Hi-C', 'contact', 'matrix', 'format', 'hdf5'],
-    url='https://github.com/mirnylab/cooler',
+    url='https://github.com/open2c/cooler',
     packages=find_packages(),
     zip_safe=False,
     classifiers=[s.strip() for s in classifiers.split('\n') if s],


=====================================
tests/test_create_sanitize.py
=====================================
@@ -222,13 +222,15 @@ def test_sanitize_pixels():
     sanitize_pixels(
         bins,
     )(chunk.copy())
+
+    # one-based bin IDs
     out = sanitize_pixels(
         bins,
         is_one_based=True,
     )(chunk.copy())
     assert (out['bin1_id'] == chunk['bin1_id'] - 1).all()
 
-    # tril action
+    # tril action: reflect (after swapping bin1, bin2)
     tril_chunk = chunk.copy()
     tril_chunk['bin2_id'] = chunk['bin1_id']
     tril_chunk['bin1_id'] = chunk['bin2_id']
@@ -240,11 +242,17 @@ def test_sanitize_pixels():
     assert len(out) == len(chunk)
     assert (out['foo2'] == chunk['foo1']).all()
     assert (out['foo1'] == chunk['foo2']).all()
+    assert (out['bin1_id'] == chunk['bin1_id']).all()
+    assert (out['bin2_id'] == chunk['bin2_id']).all()
+
+    # tril action: drop
     out = sanitize_pixels(
         bins,
         tril_action="drop",
     )(tril_chunk.copy())
     assert len(out) == 0
+
+    # tril action: raise
     with pytest.raises(BadInputError):
         sanitize_pixels(
             bins,



View it on GitLab: https://salsa.debian.org/med-team/python-cooler/-/commit/a2344c24d429cd4599d95cf78c3d6ac12033527b

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-cooler/-/commit/a2344c24d429cd4599d95cf78c3d6ac12033527b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210930/784a3a55/attachment-0001.htm>


More information about the debian-med-commit mailing list