Skip to content

Commit

Permalink
WIP: adds a snakefile to get/extract resources from zenodo
Browse files Browse the repository at this point in the history
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
akhanf committed Oct 1, 2023
1 parent 4b43aa5 commit e45526a
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions hippunfold/resources/Snakefile
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}'


0 comments on commit e45526a

Please sign in to comment.