Skip to content

Commit

Permalink
Merge pull request #22 from calico/snp-strand
Browse files Browse the repository at this point in the history
SNP scoring optimizations
  • Loading branch information
davek44 authored Apr 9, 2024
2 parents 9625573 + 95e0b09 commit ea5231b
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 304 deletions.
3 changes: 1 addition & 2 deletions src/baskerville/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def make_strand_transform(targets_df, targets_strand_df):
targets_strand_df (pd.DataFrame): Targets DataFrame, with strand pairs collapsed.
Returns:
scipy.sparse.csr_matrix: Sparse matrix to sum strand pairs.
scipy.sparse.dok_matrix: Sparse matrix to sum strand pairs.
"""

# initialize sparse matrix
Expand All @@ -336,7 +336,6 @@ def make_strand_transform(targets_df, targets_strand_df):
if target.identifier[-1] == "-":
sti += 1
ti += 1
strand_transform = strand_transform.tocsr()

return strand_transform

Expand Down
2 changes: 1 addition & 1 deletion src/baskerville/scripts/hound_ism_bed.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def main():
alt_preds = np.array(alt_preds)

ism_scores = snps.compute_scores(
ref_preds, alt_preds, options.snp_stats
ref_preds, alt_preds, options.snp_stats, None
)
for snp_stat in options.snp_stats:
scores_h5[snp_stat][si, mi - mut_start, ni] = ism_scores[
Expand Down
3 changes: 2 additions & 1 deletion src/baskerville/scripts/hound_ism_snp.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def main():
else:
targets_strand_df = targets_df
strand_transform = None

num_targets = targets_strand_df.shape[0]

#################################################################
Expand Down Expand Up @@ -249,7 +250,7 @@ def main():
alt_preds = np.array(alt_preds)

ism_scores = snps.compute_scores(
ref_preds, alt_preds, options.snp_stats
ref_preds, alt_preds, options.snp_stats, None
)
for snp_stat in options.snp_stats:
scores_h5[snp_stat][si, mi - mut_start, ni] = ism_scores[
Expand Down
Loading

0 comments on commit ea5231b

Please sign in to comment.