Skip to content

Commit 04cc6ac

Browse files
committed
Small bug fix
1 parent 89b2aee commit 04cc6ac

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ not work well for very large datasets with millions of variants and it causes ov
2323
- Fixed bugs and re-wrote how the `block` LD estimator is computed using both the `plink` and `xarray` backends.
2424
- Updated `from_plink_table` method in `LDMatrix` to handle cases where boundaries are different from what
2525
`plink` computes.
26+
- Fixed bug in `symmetrize_ut_csr_matrix` utility functions.
2627

2728
### Added
2829

Diff for: magenpy/GWADataLoader.py

+3
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,9 @@ def compute_ld(self,
660660
the implementations of `WindowedLD`, `ShrinkageLD`, and `BlockLD` for details.
661661
"""
662662

663+
if self.genotype is None:
664+
raise ValueError("Cannot compute LD without genotype data.")
665+
663666
if self.verbose and len(self.genotype) < 2:
664667
print("> Computing LD matrix...")
665668

Diff for: magenpy/stats/ld/c_utils.pyx

+4-4
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ cpdef symmetrize_ut_csr_matrix_with_mask(indptr_type[::1] indptr,
279279
int64_t[::1] new_indptr = new_idx[0]
280280
int32_t[::1] leftmost_col = new_idx[1]
281281
int32_t[::1] cum_skipped_rows = np.cumsum(~mask, dtype=np.int32)
282-
int32_t curr_row, curr_col, curr_row_size, filt_curr_row, filt_curr_col
283-
int32_t curr_data_idx, new_idx_1, new_idx_2, curr_shape=indptr.shape[0]-1
282+
int32_t curr_row, curr_col, curr_row_size, filt_curr_row, filt_curr_col, curr_shape=indptr.shape[0]-1
283+
int64_t curr_data_idx, new_idx_1, new_idx_2
284284
noncomplex_numeric[::1] new_data = np.empty_like(data, shape=(new_idx[0][new_indptr.shape[0] - 1], ))
285285

286286

@@ -343,8 +343,8 @@ cpdef symmetrize_ut_csr_matrix(indptr_type[::1] indptr,
343343
cdef:
344344
int64_t[::1] new_indptr = new_idx[0]
345345
int32_t[::1] leftmost_col = new_idx[1]
346-
int32_t curr_row, curr_col, curr_row_size
347-
int32_t curr_data_idx, new_idx_1, new_idx_2, curr_shape=indptr.shape[0] - 1
346+
int32_t curr_row, curr_col, curr_row_size, curr_shape=indptr.shape[0] - 1
347+
int64_t curr_data_idx, new_idx_1, new_idx_2
348348
noncomplex_numeric[::1] new_data = np.empty_like(data, shape=(new_idx[0][new_indptr.shape[0] - 1], ))
349349

350350
with nogil:

0 commit comments

Comments
 (0)