diff --git a/scprinter/datasets.py b/scprinter/datasets.py index 0e1f193..e58dc06 100644 --- a/scprinter/datasets.py +++ b/scprinter/datasets.py @@ -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", @@ -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 @@ -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: diff --git a/scprinter/seq/Models.py b/scprinter/seq/Models.py index f7c4b1a..03c7145 100644 --- a/scprinter/seq/Models.py +++ b/scprinter/seq/Models.py @@ -1,5 +1,6 @@ from copy import deepcopy +import torch import wandb from sklearn.linear_model import LinearRegression from tqdm.auto import tqdm, trange @@ -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() diff --git a/scprinter/tools.py b/scprinter/tools.py index 409d33b..3f88f5a 100644 --- a/scprinter/tools.py +++ b/scprinter/tools.py @@ -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, @@ -2267,6 +2268,7 @@ def seq_denovo_seq2print( n=n_seqlets, w=modisco_window, resolution=leiden_resolution, + solver=leiden_solver, launch=launch, ) @@ -2347,6 +2349,7 @@ def modisco_helper( n=1000000, w=1000, resolution=1.0, + solver="modularity", verbose=False, launch=False, ): @@ -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)