问题
I know three working ways to define a wrapper-based rule in a Snakefile:
rule way1_wrapper_repository:
wrapper:
"0.0.8/bio/samtools_sort"
rule way2_local_relative_directory:
wrapper:
"local_wrappers/dir/samtools_sort"
rule way3_local_absolute_directory:
wrapper:
"file:///absolute/path/to/wrapper/samtools_sort"
The documentation states:
Alternatively, e.g., for development, the wrapper directive can also point to full URLs, including URLs to local files with absolute paths file:// or relative paths file:. Examples for each wrapper can be found in the READMEs located in the wrapper subdirectories at the Snakemake Wrapper Repository.
However I have not yet found a way to use a URL pointing to a wrapper directory on github for example (Note that I want to use wrappers NOT hosted on the default snakemake wrapper repository).
Note that this is kind of an XY problem for me! I actually want to define a local wrapper relative to the Snakefile which is only possible when the workdir is the same directory as the Snakefile: The relative path to the wrapper will always be evaluated relative to the workdir which makes it hard to include the snakemake project or use an independent workdir (the wrapper would need to be copied to the alternative workdir in that case).
回答1:
I now tried to use the "raw" github link and it works. So try something like:
rule way4_remote_github_repository:
wrapper:
"https://raw.gtihubusercontent.com/<githubuser>/<repository>/<branch>/path/to/wrapper/directory/"
来源:https://stackoverflow.com/questions/54769322/use-github-url-for-wrapper-in-snakemake-rule