-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: adds a snakefile to get/extract resources from zenodo
still have to think about best way to package/unpackage these.. the workflow does it, but ideally should be streamlined either into the main workflow, or the pip install
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#simple workflow for pushing resources to zenodo | ||
|
||
|
||
from snakemake.remote.zenodo import RemoteProvider | ||
import os | ||
|
||
# let Snakemake assert the presence of the required environment variable | ||
envvars: | ||
"MYZENODO_PAT" | ||
|
||
|
||
|
||
access_token = os.environ["MYZENODO_PAT"] | ||
zenodo = RemoteProvider(deposition='8381163',access_token=access_token) | ||
#zenodo = RemoteProvider(access_token=access_token) | ||
|
||
folders_to_download = ['CITI168', | ||
'tpl-dHCP', | ||
# 'tpl-upenn', | ||
'unfold_template_hipp', | ||
'unfold_template_dentate'] | ||
|
||
wildcard_constraints: | ||
folder='[a-zA-Z0-9_-]+' | ||
|
||
rule all_download: | ||
input: | ||
expand('{folder}',folder=folders_to_download) | ||
|
||
rule all_upload: | ||
input: | ||
expand('{folder}.tar',folder=folders_to_download) | ||
|
||
|
||
rule download: | ||
input: | ||
zenodo.remote("{folder}.tar") | ||
output: | ||
temp('from_zenodo/{folder}.tar') | ||
shell: | ||
'cp {input} {output}' | ||
|
||
rule create_tar: | ||
input: | ||
'{folder}' | ||
output: | ||
temp('to_zenodo/{folder}.tar') | ||
shell: | ||
'tar -cvf {output} {input}' | ||
|
||
|
||
rule upload: | ||
input: | ||
'to_zenodo/{folder}.tar' | ||
output: | ||
zenodo.remote("{folder}.tar") | ||
shell: | ||
"cp {input} {output}" | ||
|
||
rule extract_tar: | ||
input: | ||
'from_zenodo/{folder}.tar' | ||
output: | ||
directory('{folder}') | ||
shell: | ||
'tar -xvf {input}' | ||
|
||
|