Last updated: 2022-08-23
Checks: 6 1
Knit directory: RatXcan_Training/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown file has unstaged changes. To know which version of
the R Markdown file created these results, you’ll want to first commit
it to the Git repo. If you’re still working on the analysis, you can
ignore this warning. When you’re finished, you can run
wflow_publish
to commit the R Markdown file and build the
HTML.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20220711)
was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version e8ceeb9. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish
or
wflow_git_commit
). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: analysis/.Rhistory
Ignored: output/
Ignored: scripts/.Rhistory
Untracked files:
Untracked: .DS_Store
Untracked: .gitignore
Untracked: analysis/Plot_Predictability_Heritability.Rmd
Untracked: code/helpers.R
Unstaged changes:
Modified: analysis/.DS_Store
Modified: analysis/Analyze_PrediXcan_Results.Rmd
Modified: analysis/EN_Prediction_Model.Rmd
Modified: analysis/Run_PrediXcan.Rmd
Modified: analysis/index.Rmd
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
These are the previous versions of the repository in which changes were
made to the R Markdown (analysis/Run_PrediXcan.Rmd
) and
HTML (docs/Run_PrediXcan.html
) files. If you’ve configured
a remote Git repository (see ?wflow_git_remote
), click on
the hyperlinks in the table below to view the files as they were in that
past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 28edc16 | sabrina-mi | 2022-08-22 | add link and change titles |
html | 28edc16 | sabrina-mi | 2022-08-22 | add link and change titles |
Rmd | 3902557 | sabrina-mi | 2022-08-22 | add analyze predixcan result |
html | 3902557 | sabrina-mi | 2022-08-22 | add analyze predixcan result |
Rmd | 6e9507f | sabrina-mi | 2022-08-22 | wflow_rename("analysis/PrediXcan.Rmd", "analysis/Run_PrediXcan.Rmd") |
html | 6e9507f | sabrina-mi | 2022-08-22 | wflow_rename("analysis/PrediXcan.Rmd", "analysis/Run_PrediXcan.Rmd") |
Predict gene expression using elastic net model trained on Ac tissue data.
conda activate imlabtools
# The path to Box drive is usually ~/Box, but may be different depending on operating system and Box Drive version
DIR=/Users/sabrinami/Library/CloudStorage/Box-Box/imlab-data/data-Github/Rat_Genomics_Paper_Pipeline
METAXCAN=/Users/sabrinami/Github/MetaXcan/software
GENO=$DIR/data/rat_genotypes_LD_pruned_0.95
MODEL=$DIR/Results/sql
OUTPUT=$DIR/Results/PrediXcan/metabolic_traits
python $METAXCAN/Predict.py \
--model_db_path $MODEL/Ac_best_prediXcan_db.db \
--text_genotypes \
$GENO/chr*.round2_impute2_3473.txt \
--on_the_fly_mapping METADATA "{}_{}_{}_{}" \
--text_sample_ids $GENO/samples_Rat_metab_phenos_file \
--prediction_output $OUTPUT/rat_metabolic_Ac_best__predict.txt \
--prediction_summary_output $OUTPUT/rat_metabolic_Ac_best__summary.txt \
--throw
python $METAXCAN/Predict.py \
--model_db_path $MODEL/Il_best_prediXcan_db.db \
--text_genotypes \
$GENO/chr*.round2_impute2_3473.txt \
--on_the_fly_mapping METADATA "{}_{}_{}_{}" \
--text_sample_ids $GENO/samples_Rat_metab_phenos_file \
--prediction_output $OUTPUT/rat_metabolic_Il_best__predict.txt \
--prediction_summary_output $OUTPUT/rat_metabolic_Il_best__summary.txt \
--throw
python $METAXCAN/Predict.py \
--model_db_path $MODEL/Lh_best_prediXcan_db.db \
--text_genotypes \
$GENO/chr*.round2_impute2_3473.txt \
--on_the_fly_mapping METADATA "{}_{}_{}_{}" \
--text_sample_ids $GENO/samples_Rat_metab_phenos_file \
--prediction_output $OUTPUT/rat_metabolic_Lh_best__predict.txt \
--prediction_summary_output $OUTPUT/rat_metabolic_Lh_best__summary.txt \
--throw
python $METAXCAN/Predict.py \
--model_db_path $MODEL/Pl_best_prediXcan_db.db \
--text_genotypes \
$GENO/chr*.round2_impute2_3473.txt \
--on_the_fly_mapping METADATA "{}_{}_{}_{}" \
--text_sample_ids $GENO/samples_Rat_metab_phenos_file \
--prediction_output $OUTPUT/rat_metabolic_Pl_best__predict.txt \
--prediction_summary_output $OUTPUT/rat_metabolic_Pl_best__summary.txt \
--throw
python $METAXCAN/Predict.py \
--model_db_path $MODEL/Vo_best_prediXcan_db.db \
--text_genotypes \
$GENO/chr*.round2_impute2_3473.txt \
--on_the_fly_mapping METADATA "{}_{}_{}_{}" \
--text_sample_ids $GENO/samples_Rat_metab_phenos_file \
--prediction_output $OUTPUT/rat_metabolic_Vo_best__predict.txt \
--prediction_summary_output $OUTPUT/rat_metabolic_Vo_best__summary.txt \
--throw
library(readr)
library(tidyverse)
tissues=c("Ac", "Il", "Lh", "Pl", "Vo")
"%&%" = function(a,b) paste(a,b,sep="")
dir="/Users/sabrinami/Library/CloudStorage/Box-Box/imlab-data/data-Github/Rat_Genomics_Paper_Pipeline/"
Before running association, we filter predicted expression and phenotype files so that individuals are listed in the same order.
res.dir = dir %&% "Results/prediXcan/metabolic_traits/"
meta.dir = "/Users/sabrinami/Github/MetaXcan/software"
pheno.dir = dir %&% "data/expression/"
fn_write_files = function(tis){
pred_expr <- read_tsv(dir %&% "Results/prediXcan/metabolic_traits/rat_metabolic_" %&% tis %&% "_best__predict.txt", col_names = TRUE)
all_rats <- read_tsv(pheno.dir %&% "all_names.txt", col_names = TRUE)
pred_expr <- pred_expr %>% filter(!(FID %in% all_rats$ID))
write_tsv(pred_expr, dir %&% "Results/prediXcan/metabolic_traits/rat_metabolic_" %&% tis %&% "_target_set__predict.txt", col_names = TRUE)
pheno <- read_csv(pheno.dir %&% "processed_obesity_rat_Palmer_phenotypes.csv", col_names = TRUE) %>% filter(!(rat_rfid %in% all_rats$ID))
write_tsv(pheno, pheno.dir %&% "processed_obesity_rat_Palmer_phenotypes_target_set.tsv", col_names = TRUE)
}
for (tis in tissues) {
fn_write_files(tis)
}
Now run an association test for each column of our phenotype file.
for (tis in tissues){
n_pheno=length(colnames(pheno))-1
# use all pheno columns except rat_rfid and idx
for(i in 2:n_pheno){
trait <- colnames(pheno)[i]
runASSOC <- "python3 " %&% meta.dir %&% "/PrediXcanAssociation.py " %&% "--expression_file " %&% res.dir %&% "rat_metabolic_" %&% tis %&% "_target_set__predict.txt --input_phenos_file " %&% pheno.dir %&% "processed_obesity_rat_Palmer_phenotypes_target_set.tsv " %&% "--input_phenos_column " %&% trait %&% " --output " %&% res.dir %&% tis %&% "__association_" %&% trait %&% ".txt --verbosity 9 --throw"
system(runASSOC)
}
}
sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 rstudioapi_0.11 whisker_0.4 knitr_1.39
[5] magrittr_1.5 workflowr_1.6.2 R6_2.4.1 rlang_1.0.2
[9] fastmap_1.1.0 stringr_1.4.0 tools_4.0.3 xfun_0.31
[13] cli_3.3.0 git2r_0.27.1 jquerylib_0.1.4 htmltools_0.5.2
[17] ellipsis_0.3.2 rprojroot_1.3-2 yaml_2.2.1 digest_0.6.27
[21] tibble_3.0.4 lifecycle_0.2.0 crayon_1.3.4 later_1.1.0.1
[25] sass_0.4.1 vctrs_0.4.1 fs_1.5.0 promises_1.1.1
[29] glue_1.6.2 evaluate_0.15 rmarkdown_2.14 stringi_1.5.3
[33] compiler_4.0.3 bslib_0.3.1 pillar_1.4.6 backports_1.1.10
[37] jsonlite_1.7.1 httpuv_1.5.4 pkgconfig_2.0.3