Skip to content

Commit

Permalink
fix bug regarding overwrite in tools, replace MEME tomtom with tanger…
Browse files Browse the repository at this point in the history
…meme
  • Loading branch information
ruochiz committed Nov 26, 2024
1 parent 7edd525 commit f7ae125
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
6 changes: 3 additions & 3 deletions scprinter/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def datasets():
"gencode_vM30_GRCm39.gff3.gz": "sha256:6f433e2676e26569a678ce78b37e94a64ddd50a09479e433ad6f75e37dc82e48",
"gencode_vM30_GRCm39.fa.gz": "sha256:3b923c06a0d291fe646af6bf7beaed7492bf0f6dd5309d4f5904623cab41b0aa",
# Tutorial files
"BMMCTutorial.zip": "md5:d9027cf73b558d03276483384ddad88c",
"scprinter_BMMCTutorial.zip": "md5:d9027cf73b558d03276483384ddad88c",
# Blacklist file
"hg38-blacklist.v2.bed.gz": "md5:83fe6bf8187a64dee8079b80f75ba289",
"mm10-blacklist.v2.bed.gz": "md5:4ae47e40309533c2a71de55494cda9bc",
Expand Down Expand Up @@ -128,7 +128,7 @@ def datasets():
# Blacklist file
"hg38-blacklist.v2.bed.gz": "https://github.com/Boyle-Lab/Blacklist/raw/master/lists/hg38-blacklist.v2.bed.gz",
"mm10-blacklist.v2.bed.gz": "https://github.com/Boyle-Lab/Blacklist/raw/master/lists/mm10-blacklist.v2.bed.gz",
"BMMCTutorial.zip": "https://drive.google.com/uc?export=download&confirm=s5vl&id=1L-9yPkNKf-IcWgubfp2Yz2oYusEVEico",
"scprinter_BMMCTutorial.zip": "https://zenodo.org/records/14164466/files/scprinter_BMMCTutorial.zip",
},
)
return _datasets
Expand Down Expand Up @@ -238,7 +238,7 @@ def BMMCTutorial():
-------
str: path to the BMMC Tutorial data
"""
files = datasets().fetch("BMMCTutorial.zip", processor=giverightstothegroup)
files = datasets().fetch("scprinter_BMMCTutorial.zip", processor=giverightstothegroup)
dict1 = {}
for f in files:
if "bed" in f:
Expand Down
11 changes: 7 additions & 4 deletions scprinter/seq/Models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from copy import deepcopy

import torch
import wandb
from sklearn.linear_model import LinearRegression
from tqdm.auto import tqdm, trange
Expand Down Expand Up @@ -742,10 +743,12 @@ def fit(
scaler.scale(loss).backward()
moving_avg_loss += loss_footprint.item()
if (iteration + 1) % accumulate_grad == 0:
# scaler.unscale_(
# optimizer
# ) # Unscale gradients for clipping without inf/nan gradients affecting the model
# torch.nn.utils.clip_grad_norm_(self.parameters(), max_norm=5.0) # Adjust max_norm accordingly
scaler.unscale_(
optimizer
) # Unscale gradients for clipping without inf/nan gradients affecting the model
torch.nn.utils.clip_grad_norm_(
self.parameters(), max_norm=1.0
) # Adjust max_norm accordingly

scaler.step(optimizer)
scaler.update()
Expand Down
7 changes: 4 additions & 3 deletions scprinter/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2177,6 +2177,7 @@ def seq_denovo_seq2print(
n_seqlets=1000000,
modisco_window=1000,
leiden_resolution=1,
leiden_solver="modularity",
save_path: str | Path = None,
overwrite=False,
verbose=False,
Expand Down Expand Up @@ -2267,6 +2268,7 @@ def seq_denovo_seq2print(
n=n_seqlets,
w=modisco_window,
resolution=leiden_resolution,
solver=leiden_solver,
launch=launch,
)

Expand Down Expand Up @@ -2347,6 +2349,7 @@ def modisco_helper(
n=1000000,
w=1000,
resolution=1.0,
solver="modularity",
verbose=False,
launch=False,
):
Expand All @@ -2363,9 +2366,7 @@ def modisco_helper(
hypo = hypo_path
else:
hypo = hypo[0]
command = (
f"seq2print_modisco motifs -s {ohe} -a {hypo} -n {n} -o {output} -w {w} -r {resolution}"
)
command = f"seq2print_modisco motifs -s {ohe} -a {hypo} -n {n} -o {output} -w {w} -r {resolution} --solver {solver}"
if verbose:
if launch:
print(launch_template)
Expand Down

0 comments on commit f7ae125

Please sign in to comment.