Commit 6716f74d authored by kevin's avatar kevin

commenting and renaming

parent 421e49a2
singularity: "container.sif"
# edit configuration here (see cluster.json for running on slurm scheduler)
configfile: "config.yml"
localrules: impute, clean, generate_samples_file
localrules: impute, clean, download_container, generate_samples_file
# this rule runs the entire pipeline and creates a R data set file (rds)
# containing all imputed expression values
rule impute:
input:
expand("{output_dir}/gene_expression/{region}.expression.txt", region = config['brain_regions'], output_dir = config['output_dir'])
output:
expand("{output_dir}/gene_expressions_combined.rds", output_dir = config['output_dir'])
singularity:
"container.sif"
shell:
"""
Rscript scripts/combine_expression_data.R
"""
# delete output and logs (if run on slurm cluster)
rule clean:
shell:
"""
rm -rf {config[output_dir]}
rm -rf logs
rm -rf nohup.out
"""
# download the required singularity container from zenodo.org
rule download_container:
shell:
"""
echo 'not implemented'
"""
# extract dosages in custom PrediXcan format from vcf file
rule vcf_to_dosages:
input:
config['input_vcf_gz_file']
output:
"{output_dir}/dosages/chr{i}.dosage.txt.gz"
singularity:
"container.sif"
shell:
"""
export prefix={wildcards.output_dir}/dosages
......@@ -36,11 +60,14 @@ rule vcf_to_dosages:
printf "done.\n\r\n\r"
"""
# extract sample file for PrediXcan
rule generate_samples_file:
input:
config['input_vcf_gz_file']
output:
"{output_dir}/dosages/samples.txt"
singularity:
"container.sif"
params:
format = "\'{ printf(\"%s %s\\n\", $1, $1); }\'"
shell:
......@@ -53,12 +80,15 @@ rule generate_samples_file:
rm $prefix/samples_.txt
"""
# run PrediXcan to impute gene expression for individual tissue type
rule impute_gene_expression:
input:
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'])
output:
"{output_dir}/gene_expression/{region}.expression.txt"
singularity:
"container.sif"
shell:
"""
mkdir -p {wildcards.output_dir}/gene_expression
......@@ -72,11 +102,3 @@ rule impute_gene_expression:
mv {wildcards.output_dir}/gene_expression/{wildcards.region}_predicted_expression.txt \
{wildcards.output_dir}/gene_expression/{wildcards.region}.expression.txt
"""
rule clean:
shell:
"""
rm -rf {config[output_dir]}
rm -rf logs
rm -rf nohup.out
"""
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