Conversation
standage
commented
May 1, 2025
Comment on lines
+55
to
+67
| def run_snakemake(config, workdir, cores=1, dryrun=False): | ||
| outcfg = smk_types.OutputSettings(printshellcmds=True) | ||
| with smk_api(outcfg) as smk: | ||
| workflow = smk.workflow( | ||
| config_settings=smk_types.ConfigSettings(config=config), | ||
| storage_settings=smk_types.StorageSettings(), | ||
| resource_settings=smk_types.ResourceSettings(cores=cores), | ||
| snakefile=files("microhapulator") / "workflows" / "analysis.smk", | ||
| workdir=Path(workdir), | ||
| ) | ||
| dag = workflow.dag(smk_types.DAGSettings(targets=["report"])) | ||
| mode = "dryrun" if dryrun else "local" | ||
| dag.execute_workflow(executor=mode) |
Member
Author
There was a problem hiding this comment.
This is close to the minimal code required to replicate the flags I commonly used with the snakemake.snakemake command in version 7 and below.
Comment on lines
-273
to
+275
| "analysis/{}/03typing/callplots".format(wildcards.sample), | ||
| f"analysis/{wildcards.sample}/03typing/callplots", |
Member
Author
There was a problem hiding this comment.
Reinstating f-strings since they don't break Python 3.12 in Snakemake 9.
Comment on lines
-214
to
+216
| threshfile="" if config["thresh_file"] == "" else f"--config {config['thresh_file']}", | ||
| threshfile=( | ||
| "" if config["thresh_file"] in ("", None) else f"--config {config['thresh_file']}" | ||
| ), |
Member
Author
There was a problem hiding this comment.
I think the newer versions of Snakemake were converting the empty string in the config dictionary into None, so this change just accounts for both.
| outfile = Path(outfile) | ||
| # Snakemake f-strings break with Python 3.12: https://github.com/snakemake/snakemake/issues/2648 | ||
| linkfile = "{}/R{}-fastqc.html".format(params.outdir, end) | ||
| linkfile = f"{params.outdir}/R{end}-fastqc.html" |
Member
Author
There was a problem hiding this comment.
Another reinstated f-string.
Comment on lines
+34
to
+37
| mhrefr=str(Path(args.markerrefr).resolve()), | ||
| mhdefn=str(Path(args.markerdefn).resolve()), | ||
| hg38path=str(Path(args.hg38).resolve()), | ||
| hg38index=str(Path(args.hg38idx).resolve()), |
Member
Author
There was a problem hiding this comment.
Passing paths here also caused an issue with newer versions of Snakemake where they didn't with version 7. 🤷♂️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements support for Snakemake version 8.