-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snakefile
145 lines (131 loc) · 4.07 KB
/
Snakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
import os
import sys
import numpy as np
import pandas as pd
import glob
import yaml
import json
import pathlib
include: 'snakefile_utils.smk'
workdir: "./"
configfile: "config_v12.yaml"
#configfile: "config_v11.yaml"
# sync config directory
eprint("Syncing config directory...")
os.system(
f'''rsync -r --links --partial --update --checksum "{config["config_dir"]}/" "{config["output_basedir"]}/"'''
)
eprint("Syncing config directory done!")
SNAKEMAKE_DIR = os.path.dirname(workflow.snakefile)
CONDA_ENV_YAML_DIR = f"{SNAKEMAKE_DIR}/envs"
UKBB_RAW_PHENOTYPES_DIR = config["ukbb_raw_phenotypes_dir"]
UKBB_PROCESSED_PHENOTYPES_DIR = config["ukbb_processed_phenotypes_dir"]
UKBB_DECODED_PHENOTYPES_DIR = config["ukbb_decoded_phenotypes_dir"]
UKBB_SKIP_METADATA_UPDATE = bool(os.environ.get("UKBB_SKIP_METADATA_UPDATE", "false"))
phenotype_dirs, ukbb_codes = glob_wildcards(UKBB_RAW_PHENOTYPES_DIR + "/{phenotype_dir}/{ukbb_code}.tab")
include: 'scripts/__init__.smk'
hdl_cholesterol=expand(
rules.associate__compare_genebass.output,
phenotype_col="HDL_cholesterol",
feature_set=["LOFTEE", "AbExp_all_tissues", "minimum_AbExp", "median_AbExp"],
covariates=["sex_age_genPC", "sex_age_genPC_CLMP", "sex_age_genPC_CLMP_PRS"],
)
hdl_cholesterol_term_pvals=expand(
rules.associate__compare_params.output,
phenotype_col="HDL_cholesterol",
feature_set=["AbExp_all_tissues",],
covariates=["sex_age_genPC", "sex_age_genPC_CLMP", "sex_age_genPC_CLMP_PRS"],
)
all_traits = [
"Alanine_aminotransferase",
"Albumin",
"Alkaline_phosphatase",
"Apolipoprotein_A",
"Apolipoprotein_B",
"Aspartate_aminotransferase",
"Calcium",
"Cholesterol",
"Creatinine",
"Cystatin_C",
"Direct_bilirubin",
"Eosinophill_count",
"Erythrocyte_distribution_width",
"Gamma_glutamyltransferase",
"Glucose",
"HDL_cholesterol",
"Haematocrit_percentage",
"IGF1",
"LDL_direct",
"Leukocyte_count",
"Lipoprotein_A",
"Lymphocyte_percentage",
"Mean_corpuscular_haemoglobin",
"Mean_corpuscular_volume",
"Mean_reticulocyte_volume",
"Mean_sphered_cell_volume",
"Monocyte_count",
"Neutrophill_percentage",
"Phosphate",
"Platelet_count",
"Reticulocyte_count",
"SHBG",
"Testosterone",
"Thrombocyte_volume",
"Total_bilirubin",
"Triglycerides",
"Urate",
"Vitamin_D",
"c_reactive_protein",
"glycated_haemoglobin_hba1c",
]
rule all:
input:
expand(rules.read_phenotypes.output, zip, pheno_dir=phenotype_dirs, ukbb_code=ukbb_codes),
# rules.merge_phenotype_metadata.output,
expand(rules.filter_genebass.output, genebass_version=["300k", "500k"]),
# *hdl_cholesterol,
# *hdl_cholesterol_term_pvals,
expand(rules.compare_associations.output, comparison=[
"paper_figure",
"paper_figure_randomized",
]),
expand(
rules.compare_risk_scores.output,
comparison=[
"paper_figure",
],
model_type=[
"lightgbm",
"normalized_linear",
]
),
expand(
rules.associate__qq_plot.output,
phenotype_col=all_traits,
feature_set=[
"LOFTEE",
"AbExp_all_tissues",
"minimum_AbExp",
"median_AbExp"
],
covariates=["randomized_sex_age_genPC_CLMP_PRS", ],
),
expand(
rules.compare_stringdb_image.output,
phenotype=all_traits,
comparison="AbExp_all_tissues_vs_LOFTEE",
covariates=["sex_age_genPC_CLMP_PRS", ],
),
# expand(
# rules.associate__polygenic_risk_score.output,
# feature_set=[
# "LOFTEE",
# "AbExp_all_tissues",
# "minimum_AbExp",
# "median_AbExp"
# ],
# phenotype_col=all_traits,
# covariates=["sex_age_genPC_CLMP_PRS"]
# ),
rules.compose_paper_figure.output,
localrules: all