Skip to content

Commit

Permalink
Small bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shz9 committed Oct 23, 2024
1 parent 89b2aee commit 04cc6ac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ not work well for very large datasets with millions of variants and it causes ov
- Fixed bugs and re-wrote how the `block` LD estimator is computed using both the `plink` and `xarray` backends.
- Updated `from_plink_table` method in `LDMatrix` to handle cases where boundaries are different from what
`plink` computes.
- Fixed bug in `symmetrize_ut_csr_matrix` utility functions.

### Added

Expand Down
3 changes: 3 additions & 0 deletions magenpy/GWADataLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,9 @@ def compute_ld(self,
the implementations of `WindowedLD`, `ShrinkageLD`, and `BlockLD` for details.
"""

if self.genotype is None:
raise ValueError("Cannot compute LD without genotype data.")

if self.verbose and len(self.genotype) < 2:
print("> Computing LD matrix...")

Expand Down
8 changes: 4 additions & 4 deletions magenpy/stats/ld/c_utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ cpdef symmetrize_ut_csr_matrix_with_mask(indptr_type[::1] indptr,
int64_t[::1] new_indptr = new_idx[0]
int32_t[::1] leftmost_col = new_idx[1]
int32_t[::1] cum_skipped_rows = np.cumsum(~mask, dtype=np.int32)
int32_t curr_row, curr_col, curr_row_size, filt_curr_row, filt_curr_col
int32_t curr_data_idx, new_idx_1, new_idx_2, curr_shape=indptr.shape[0]-1
int32_t curr_row, curr_col, curr_row_size, filt_curr_row, filt_curr_col, curr_shape=indptr.shape[0]-1
int64_t curr_data_idx, new_idx_1, new_idx_2
noncomplex_numeric[::1] new_data = np.empty_like(data, shape=(new_idx[0][new_indptr.shape[0] - 1], ))


Expand Down Expand Up @@ -343,8 +343,8 @@ cpdef symmetrize_ut_csr_matrix(indptr_type[::1] indptr,
cdef:
int64_t[::1] new_indptr = new_idx[0]
int32_t[::1] leftmost_col = new_idx[1]
int32_t curr_row, curr_col, curr_row_size
int32_t curr_data_idx, new_idx_1, new_idx_2, curr_shape=indptr.shape[0] - 1
int32_t curr_row, curr_col, curr_row_size, curr_shape=indptr.shape[0] - 1
int64_t curr_data_idx, new_idx_1, new_idx_2
noncomplex_numeric[::1] new_data = np.empty_like(data, shape=(new_idx[0][new_indptr.shape[0] - 1], ))

with nogil:
Expand Down

0 comments on commit 04cc6ac

Please sign in to comment.