jmschrei / bpnet-lite

This repository hosts a minimal version of a Python API for BPNet.
MIT License
32 stars 14 forks source link

updated paddding from int to tuple #5

Closed adamklie closed 5 months ago

adamklie commented 6 months ago

See https://github.com/jmschrei/bpnet-lite/issues/4

Simple change of two lines to change padding of iconv and rconv from int type to tuple type.

Tested using tangermeme predict but that's about it.

jmschrei commented 6 months ago

Good catch. I think I saw this elsewhere too. When you say "tested" you mean you got the same predictions before/after?

adamklie commented 6 months ago

No sorry that was vague. I just meant it runs without error.

jmschrei commented 5 months ago

Would you mind checking that the predictions are the same for your model and posting the results here? I'd be happy to incorporate this change once confirmed.

adamklie commented 5 months ago

Generated 2056 random sequences and predicted counts and profile before and after the change. Predictions are the same and are here: https://drive.google.com/drive/folders/1pWyznsOnPwQU-uduAzts3bxax-KyTYk0?usp=sharing.

import matplotlib.pyplot as plt
import numpy as np

test_dir = "/cellar/users/aklie/data/datasets/mo_EndoC-bH1_ATAC-seq/test"

# Load em up
profile_preds_before = np.squeeze(np.load(f"{test_dir}/profile_preds_before.npz")['arr_0'], axis=1)
counts_preds_before = np.squeeze(np.load(f"{test_dir}/counts_preds_before.npz")['arr_0'])
profile_preds_after = np.squeeze(np.load(f"{test_dir}/profile_preds_after.npz")['arr_0'], axis=1)
counts_preds_after = np.squeeze(np.load(f"{test_dir}/counts_preds_after.npz")['arr_0'])

# Scatterplot of counts before and after
plt.scatter(counts_preds_before, counts_preds_after)
plt.xlabel("Counts before change")
plt.ylabel("Counts after change")
same = np.allclose(counts_preds_before, counts_preds_after, atol=1e-6)
print("Counts are the same:", same)  # this is true
plt.show()

# Plot profile for arbitrary sequence
plt.plot(profile_preds_before[10], color='blue', label='Before', alpha=0.5)
plt.plot(profile_preds_after[10], color='red', label='After', alpha=0.5)
plt.legend()
plt.xlabel("Position")
plt.ylabel("Profile")
same = np.allclose(profile_preds_before, profile_preds_after, atol=1e-6)
print("Profile is the same:", same)  # this is true
plt.show()

image image

jmschrei commented 5 months ago

Only 2056? What if it's different on the 2057th sequence?

adamklie commented 5 months ago

I was gonna do all possible sequences, but I got bored after 2056