Skip to content

Commit 879650f

Browse files
authored
Merge pull request #878 from deeptools/maintenance_update
Maintenance update
2 parents 20be921 + 0b8a79d commit 879650f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+265
-210
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ assignees: ''
77

88
---
99

10-
**Welcome to the HiCExplorer GitHub repository! Before opening the issue please check
10+
**Welcome to the HiCExplorer GitHub repository!**
11+
12+
If your issue concern `HiCPlotTADs`, please post your issue to the [pyGenomeTracks github repo](https://github.com/deeptools/pyGenomeTracks/issues/new/choose).
13+
14+
**Before opening the issue please check
1115
that the following requirements are met :**
1216

1317
- [ ] Search whether this issue (or a similar issue) has been solved before using the search tab above. Link the previous issue if appropriate below.

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ The `scHiCExplorer <https://github.com/joachimwolff/schicexplorer>`_.
3737
Citation:
3838
^^^^^^^^^
3939

40+
Joachim Wolff, Rolf Backofen, Björn Grüning.
41+
**Loop detection using Hi-C data with HiCExplorer**, GigaScience, Volume 11, 2022, giac061, https://doi.org/10.1093/gigascience/giac061
42+
4043
Joachim Wolff, Leily Rabbani, Ralf Gilsbach, Gautier Richard, Thomas Manke, Rolf Backofen, Björn A Grüning.
4144
**Galaxy HiCExplorer 3: a web server for reproducible Hi-C, capture Hi-C and single-cell Hi-C data analysis, quality control and visualization, Nucleic Acids Research**, Nucleic Acids Research, Volume 48, Issue W1, 02 July 2020, Pages W177–W184, https://doi.org/10.1093/nar/gkaa220
4245

azure-pipelines.yml

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,13 @@ jobs:
99
vmImage: 'ubuntu-latest'
1010
strategy:
1111
matrix:
12-
Python36:
13-
python.version: '3.6'
14-
Python37:
15-
python.version: '3.7'
1612
Python38:
1713
python.version: '3.8'
14+
Python39:
15+
python.version: '3.9'
16+
Python310:
17+
python.version: '3.10'
18+
1819

1920
steps:
2021
- bash: |
@@ -23,14 +24,16 @@ jobs:
2324
displayName: Add conda to PATH
2425
- bash: |
2526
conda config --set always_yes yes --set changeps1 no
26-
conda info -a
27-
conda create -n hicexplorer --yes -c conda-forge -c bioconda python=$(python.version) --file requirements.txt
27+
conda install mamba --yes -c conda-forge
28+
hash -r
29+
mamba info -a
30+
mamba create -n hicexplorer --yes -c conda-forge -c bioconda python=$(python.version) --file requirements.txt
2831
source activate hicexplorer
29-
conda install --yes -c conda-forge -c bioconda pytest flake8 pytest-xdist pytest-forked
30-
conda install --yes -c conda-forge -c bioconda nose
31-
conda install --yes pathlib
32-
conda install --yes -c defaults -c conda-forge -c bioconda configparser
33-
python setup.py install
32+
mamba install --yes -c conda-forge -c bioconda pytest flake8 pytest-xdist pytest-forked
33+
mamba install --yes -c conda-forge -c bioconda nose
34+
mamba install --yes pathlib
35+
mamba install --yes -c defaults -c conda-forge -c bioconda configparser
36+
pip install .
3437
displayName: installing dependencies
3538
- script: |
3639
source activate hicexplorer
@@ -44,22 +47,25 @@ jobs:
4447
- script: |
4548
source activate hicexplorer
4649
py.test hicexplorer/test/general/ --doctest-modules --capture=sys -n 4 --ignore=hicexplorer/test/general/test_hicTADClassifier.py --ignore=hicexplorer/test/general/test_hicTrainTADClassifier.py
50+
displayName: pytest
51+
- script: |
52+
source activate hicexplorer
4753
py.test hicexplorer/test/general/test_hicTADClassifier.py
4854
py.test hicexplorer/test/general/test_hicTrainTADClassifier.py
49-
displayName: pytest
55+
displayName: pytest_tad_classifier
5056
5157
- job: 'OSX'
5258
timeoutInMinutes: 0
5359
pool:
54-
vmImage: 'macOS-10.14'
60+
vmImage: 'macOS-latest'
5561
strategy:
5662
matrix:
57-
Python36:
58-
python.version: '3.6'
59-
Python37:
60-
python.version: '3.7'
6163
Python38:
6264
python.version: '3.8'
65+
Python39:
66+
python.version: '3.9'
67+
Python310:
68+
python.version: '3.10'
6369

6470
steps:
6571
- bash: |
@@ -75,7 +81,7 @@ jobs:
7581
conda install --yes -c conda-forge -c bioconda nose
7682
conda install --yes pathlib
7783
conda install --yes -c defaults -c conda-forge -c bioconda configparser
78-
python setup.py install
84+
pip install .
7985
displayName: installing dependencies
8086
- script: |
8187
source activate hicexplorer
@@ -89,6 +95,9 @@ jobs:
8995
- script: |
9096
source activate hicexplorer
9197
py.test hicexplorer/test/general/ --doctest-modules --capture=sys -n 4 --ignore=hicexplorer/test/general/test_hicTADClassifier.py --ignore=hicexplorer/test/general/test_hicTrainTADClassifier.py
98+
displayName: pytest
99+
- script: |
100+
source activate hicexplorer
92101
py.test hicexplorer/test/general/test_hicTADClassifier.py
93102
py.test hicexplorer/test/general/test_hicTrainTADClassifier.py
94-
displayName: pytest
103+
displayName: pytest_tad_classifier

docs/content/News.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ News and Developments
22
=====================
33

44

5+
Release 3.7.3
6+
-------------
7+
**17 November 2023**
8+
9+
- Maintenance update for HiCExplorer to keep up to date with APIs of dependencies
10+
- Add additional of the polarization ratio to the output of hicCompartmentalization. Thanks @contessoto.
11+
12+
513
Release 3.7.2
614
-------------
715
**1 October 2021**

hicexplorer/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# This file is originally generated from Git information by running 'setup.py
33
# version'. Distribution tarballs contain a pre-generated copy of this file.
44

5-
__version__ = '3.7.2'
5+
__version__ = '3.7.3'

hicexplorer/chicExportData.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ def exportData(pFileList, pArgs, pViewpointObject, pDecimalPlace, pChromosomeSiz
148148

149149
file_content_string = header_information
150150
for key in key_list:
151-
file_content_string += '\t'.join('{:.{decimal_places}f}'.format(x, decimal_places=pDecimalPlace) if isinstance(x, np.float) else str(x) for x in data[1][key]) + '\n'
151+
file_content_string += '\t'.join('{:.{decimal_places}f}'.format(x, decimal_places=pDecimalPlace) if isinstance(x, float) else str(x) for x in data[1][key]) + '\n'
152+
# breakpoint()
152153
else:
153154
for key in key_list:
154155
chromosome_name.append(str(data[1][key][0]))
@@ -224,7 +225,9 @@ def exportData(pFileList, pArgs, pViewpointObject, pDecimalPlace, pChromosomeSiz
224225
line_content, data = pViewpointObject.readAggregatedFileHDF(pArgs.file, sample)
225226
file_content_string = header_information
226227
for line in line_content:
227-
file_content_string += '\t'.join('{:.{decimal_places}f}'.format(x, decimal_places=pDecimalPlace) if isinstance(x, np.float) else str(x) for x in line) + '\n'
228+
file_content_string += '\t'.join('{:.{decimal_places}f}'.format(x, decimal_places=pDecimalPlace) if isinstance(x, float) else str(x) for x in line) + '\n'
229+
# breakpoint()
230+
228231
file_content_list.append(file_content_string)
229232

230233
file_name = '_'.join(sample) + '_' + pFileType + '.txt'
@@ -241,7 +244,9 @@ def exportData(pFileList, pArgs, pViewpointObject, pDecimalPlace, pChromosomeSiz
241244
file_content_string = header_information
242245

243246
for line in item:
244-
file_content_string += '\t'.join('{:.{decimal_places}f}'.format(x, decimal_places=pDecimalPlace) if isinstance(x, np.float) else str(x) for x in line) + '\n'
247+
file_content_string += '\t'.join('{:.{decimal_places}f}'.format(x, decimal_places=pDecimalPlace) if isinstance(x, float) else str(x) for x in line) + '\n'
248+
# breakpoint()
249+
245250
file_content_list.append(file_content_string)
246251
file_name = '_'.join(file) + '_' + item_classification[i] + '_' + pFileType + '.txt'
247252
file_list.append(file_name)

hicexplorer/hicAdjustMatrix.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import argparse
55
from hicmatrix import HiCMatrix as hm
66
from hicexplorer._version import __version__
7-
from hicmatrix.HiCMatrix import check_cooler
7+
from hicexplorer.utilities import check_cooler
88
import numpy as np
99
import cooler
1010
import logging
@@ -132,6 +132,7 @@ def adjustMatrix(pArgs):
132132
if len(genomic_regions) == 0:
133133
log.error('No valid chromosome given. Available: {}'.format(chromosomes_list))
134134
exit(1)
135+
135136
matrix_indices_regions = []
136137
for region in genomic_regions:
137138
log.debug('region {}'.format(region))

hicexplorer/hicAggregateContacts.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
matplotlib.use('Agg')
99
import matplotlib.pyplot as plt
1010
import matplotlib.gridspec as gridspec
11-
import matplotlib.cm as cm
11+
from matplotlib import colormaps as cm
1212
from mpl_toolkits.mplot3d import Axes3D
1313

1414
# from scipy.cluster.vq import vq, kmeans
@@ -515,7 +515,7 @@ def compute_clusters(updated_info, k, method="kmeans", how='full', max_deviation
515515
# shape = (num_submatrices, submatrix.shape[0] * submatrix.shape[1]
516516
# In other words, each submatrix is converted into a row of the matrix
517517
submat_vectors.append(submatrix.reshape((1, shape[0] * shape[1])))
518-
matrix = np.vstack(submat_vectors)
518+
matrix = np.asarray(np.vstack(submat_vectors))
519519
if how == 'diagonal':
520520
assert matrix.shape == (len(updated_info["submatrices"]), shape[0])
521521
elif how == 'center':
@@ -600,7 +600,7 @@ def cluster_matrices(agg_info, k, method='kmeans', how='full', perChr=False, max
600600
updated_info[chrom1] = {"coords": full_coords, "centers": agg_info["agg_center_values"][chrom1][chrom2],
601601
"submatrices": agg_info["agg_matrix"][chrom1][chrom2],
602602
"clustered_dict": [], "diagonal": agg_info["agg_diagonals"][chrom1][chrom2]}
603-
assert(chrom1 == chrom2)
603+
assert (chrom1 == chrom2)
604604
log.info("Length of entry on chr {}: {}".format(chrom1, len(agg_info["agg_matrix"][chrom1][chrom2])))
605605
if len(agg_info["agg_matrix"][chrom1][chrom2]) < k:
606606
log.info("number of the submatrices on chromosome {} is less than {}. Clustering is skipped.".format(chrom1, k))
@@ -660,7 +660,7 @@ def plot_aggregated_contacts(clustered_info, num_clusters, M_half, args):
660660
log.debug("vmax: {}, vmin: {}".format(vmax, vmin))
661661
chrom_avg = OrderedDict()
662662
for idx, (chrom1, v1) in enumerate(clustered_info.items()):
663-
assert(v1 != {})
663+
assert (v1 != {})
664664
if chrom1 not in chrom_avg.keys():
665665
chrom_avg[chrom1] = []
666666

@@ -925,7 +925,7 @@ def main(args=None):
925925
exit("No susbmatrix found to be aggregated.")
926926

927927
if args.kmeans is not None:
928-
assert(args.kmeans > 1)
928+
assert (args.kmeans > 1)
929929
if args.perChr == True:
930930
clustered_info = cluster_matrices(agg_info,
931931
k=args.kmeans, method='kmeans', how=args.howToCluster,
@@ -938,7 +938,7 @@ def main(args=None):
938938
keep_outlier=args.keep_outlier)
939939
num_clusters = args.kmeans
940940
elif args.hclust is not None:
941-
assert(args.hclust > 1)
941+
assert (args.hclust > 1)
942942
log.info("Performing hierarchical clustering."
943943
"Please note that it might be very slow for large datasets.\n")
944944
if args.perChr == True:

hicexplorer/hicAverageRegions.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import logging
88
log = logging.getLogger(__name__)
99
import numpy as np
10-
from scipy.sparse import csr_matrix, save_npz, lil_matrix
10+
from scipy.sparse import csr_matrix, save_npz, lil_matrix, coo_matrix
1111

1212

1313
def parse_arguments(args=None):
@@ -196,11 +196,13 @@ def main(args=None):
196196
if orientation is None or orientation == '+':
197197
summed_matrix[_start:_end, _start:_end] += hic_ma.matrix[start:end, start:end]
198198
elif orientation == '-':
199-
200199
summed_matrix[_start:_end, _start:_end] += hic_ma.matrix[start:end, start:end].T
201200
summed_matrix /= count_matrix
202-
summed_matrix = np.array(summed_matrix)
203-
data = summed_matrix[np.nonzero(summed_matrix)]
201+
202+
summed_matrix = coo_matrix(summed_matrix)
203+
204+
data = summed_matrix.data
205+
204206
row = np.nonzero(summed_matrix)[0]
205207
col = np.nonzero(summed_matrix)[1]
206208
summed_matrix = csr_matrix((data, (row, col)), shape=(dimensions_new_matrix, dimensions_new_matrix))

hicexplorer/hicCompartmentalization.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def count_interactions(obs_exp, pc1, quantiles_number, offset):
9999
number_of_bins = np.zeros((quantiles_number, quantiles_number))
100100
if offset:
101101
for dist in offset:
102-
assert(dist >= 0)
102+
assert (dist >= 0)
103103
indices = np.arange(0, obs_exp.matrix.shape[0] - dist)
104104
obs_exp.matrix[indices, indices + dist] = np.nan
105105
obs_exp.matrix[indices + dist, indices] = np.nan
@@ -220,3 +220,4 @@ def main(args=None):
220220
np.savez(args.outputMatrix, [matrix for matrix in output_matrices])
221221
plot_polarization_ratio(
222222
polarization_ratio, args.outputFileName, labels, args.quantile)
223+
np.savetxt(args.outputFileName + '_' + 'dat', polarization_ratio)

hicexplorer/hicCorrectMatrix.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def __init__(self, points):
368368
diff = np.sum((points - self.median), axis=-1)
369369

370370
self.med_abs_deviation = np.median(np.abs(diff))
371-
self.modified_z_score = self.mad_b_value * diff / self.med_abs_deviation
371+
self.modified_z_score = np.multiply(self.mad_b_value, np.divide(diff, self.med_abs_deviation))
372372

373373
def get_motified_zscores(self):
374374

@@ -665,7 +665,7 @@ def main(args=None):
665665
if args.sequencedCountCutoff and 0 < args.sequencedCountCutoff < 1:
666666
chrom, _, _, coverage = zip(*ma.cut_intervals)
667667

668-
assert type(coverage[0]) == np.float64
668+
assert type(coverage[0]) is np.float64
669669

670670
failed_bins = np.flatnonzero(
671671
np.array(coverage) < args.sequencedCountCutoff)
@@ -703,7 +703,7 @@ def main(args=None):
703703
correction_factors.append(_corr_factors)
704704
else:
705705
# Set the kr matrix along with its correction factors vector
706-
assert(args.correctionMethod == 'KR')
706+
assert (args.correctionMethod == 'KR')
707707
log.debug("Loading a float sparse matrix for KR balancing")
708708
kr = kr_balancing(chr_submatrix.shape[0],
709709
chr_submatrix.shape[1],
@@ -729,7 +729,7 @@ def main(args=None):
729729
ma.matrix, args)
730730
ma.setMatrixValues(corrected_matrix)
731731
else:
732-
assert(args.correctionMethod == 'KR')
732+
assert (args.correctionMethod == 'KR')
733733
log.debug("Loading a float sparse matrix for KR balancing")
734734
kr = kr_balancing(ma.matrix.shape[0], ma.matrix.shape[1],
735735
ma.matrix.count_nonzero(), ma.matrix.indptr.astype(np.int64, copy=False),

hicexplorer/hicCorrelate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# for plotting
1717
from matplotlib import use as mplt_use
1818
import matplotlib as mpl
19+
from matplotlib import colormaps as cm
1920

2021
mplt_use('Agg')
2122

@@ -165,7 +166,7 @@ def plot_correlation(corr_matrix, labels, plot_filename, vmax=None,
165166
link_color_func=lambda k: 'black')
166167
axdendro.set_xticks([])
167168
axdendro.set_yticks([])
168-
cmap = plt.get_cmap(colormap)
169+
cmap = cm.get_cmap(colormap)
169170

170171
# this line simply makes a new cmap, based on the original
171172
# colormap that goes from 0.0 to 0.9

0 commit comments

Comments
 (0)