Commit 58b7208c authored by kevin's avatar kevin

added container download

parent 6716f74d
...@@ -9,6 +9,7 @@ localrules: impute, clean, download_container, generate_samples_file ...@@ -9,6 +9,7 @@ localrules: impute, clean, download_container, generate_samples_file
# containing all imputed expression values # containing all imputed expression values
rule impute: rule impute:
input: input:
"container.sif",
expand("{output_dir}/gene_expression/{region}.expression.txt", region = config['brain_regions'], output_dir = config['output_dir']) expand("{output_dir}/gene_expression/{region}.expression.txt", region = config['brain_regions'], output_dir = config['output_dir'])
output: output:
expand("{output_dir}/gene_expressions_combined.rds", output_dir = config['output_dir']) expand("{output_dir}/gene_expressions_combined.rds", output_dir = config['output_dir'])
...@@ -30,14 +31,36 @@ rule clean: ...@@ -30,14 +31,36 @@ rule clean:
# download the required singularity container from zenodo.org # download the required singularity container from zenodo.org
rule download_container: rule download_container:
output:
"container_unchecked.sif"
shell:
"""
wget https://zenodo.org/record/{config[zenodo_record_id]}/files/container.sif -O container_unchecked.sif
"""
# check md5
rule check_container:
input:
"container_unchecked.sif"
output:
"container.sif"
singularity:
"container_unchecked.sif"
shell: shell:
""" """
echo 'not implemented' set -e
checksum=($(md5sum container_unchecked.sif))
if [ $checksum != {config[container_mdf5]} ]; then
echo md5 mismatch for container, download corrupted!
exit 1
fi
mv container_unchecked.sif container.sif
""" """
# extract dosages in custom PrediXcan format from vcf file # extract dosages in custom PrediXcan format from vcf file
rule vcf_to_dosages: rule vcf_to_dosages:
input: input:
"container.sif",
config['input_vcf_gz_file'] config['input_vcf_gz_file']
output: output:
"{output_dir}/dosages/chr{i}.dosage.txt.gz" "{output_dir}/dosages/chr{i}.dosage.txt.gz"
...@@ -63,6 +86,7 @@ rule vcf_to_dosages: ...@@ -63,6 +86,7 @@ rule vcf_to_dosages:
# extract sample file for PrediXcan # extract sample file for PrediXcan
rule generate_samples_file: rule generate_samples_file:
input: input:
"container.sif",
config['input_vcf_gz_file'] config['input_vcf_gz_file']
output: output:
"{output_dir}/dosages/samples.txt" "{output_dir}/dosages/samples.txt"
...@@ -83,6 +107,7 @@ rule generate_samples_file: ...@@ -83,6 +107,7 @@ rule generate_samples_file:
# run PrediXcan to impute gene expression for individual tissue type # run PrediXcan to impute gene expression for individual tissue type
rule impute_gene_expression: rule impute_gene_expression:
input: input:
"container.sif",
samples_file = expand("{output_dir}/dosages/samples.txt", output_dir = config['output_dir']), samples_file = expand("{output_dir}/dosages/samples.txt", output_dir = config['output_dir']),
dosage_files = expand("{output_dir}/dosages/chr{i}.dosage.txt.gz", i = range(1, 24), output_dir = config['output_dir']) dosage_files = expand("{output_dir}/dosages/chr{i}.dosage.txt.gz", i = range(1, 24), output_dir = config['output_dir'])
output: output:
......
...@@ -23,3 +23,6 @@ brain_regions: ...@@ -23,3 +23,6 @@ brain_regions:
- 'Putamen_basal_ganglia' - 'Putamen_basal_ganglia'
- 'Spinal_cord_cervical_c-1' - 'Spinal_cord_cervical_c-1'
- 'Substantia_nigra' - 'Substantia_nigra'
zenodo_record_id: '3376504'
container_mdf5: '1f5aada82c1aeb8e00b0328421ed009b'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment