Skip to content

Commit 71a9d2f

Browse files
author
lala8
committed
updated site scanning
1 parent 08b60e3 commit 71a9d2f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/polygraph/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def ism_score(model, seqs, batch_size, device="cpu", task=None):
288288
if preds.ndim == 2:
289289
preds = preds.mean(1, keepdims=True)
290290
else:
291-
preds = preds[:, [task]]
291+
preds = preds[:, task]
292292

293293
# Mutate sequences
294294
ism = ISM(seqs) # N x L x 4
@@ -308,7 +308,7 @@ def ism_score(model, seqs, batch_size, device="cpu", task=None):
308308
ism_preds = ism_preds.max(-1)
309309

310310
# Compute base-level importance score
311-
preds = np.abs(ism_preds - preds)
311+
preds = np.abs(ism_preds - np.expand_dims(preds, 1))
312312
return preds
313313

314314

src/polygraph/motifs.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,12 @@ def scan(seqs, meme_file, group_col="Group", pthresh=1e-3, rc=True):
5050
for m in match:
5151
out["MotifID"].append(motif.name.decode())
5252
out["SeqID"].append(m.source.accession.decode())
53-
out["start"].append(m.start)
54-
out["end"].append(m.stop)
53+
if m.strand=='+':
54+
out["start"].append(m.start)
55+
out["end"].append(m.stop)
56+
else:
57+
out["end"].append(m.start)
58+
out["start"].append(m.stop)
5559
out["strand"].append(m.strand)
5660

5761
return pd.DataFrame(out).merge(seqs[[group_col]], left_on="SeqID", right_index=True)

0 commit comments

Comments
 (0)