Last updated: 2022-09-12
Checks: 7 0
Knit directory: analysis_pipelines/
This reproducible R Markdown analysis was created with workflowr (version 1.7.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
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(20200524)
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 adbc5ca. 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/
Untracked files:
Untracked: analysis/test_sldsc_splicingAnnot.Rmd
Untracked: code/sldsc_annot_generic_baselineLD_separate.sbatch
Untracked: scripts/tmp.R
Unstaged changes:
Modified: analysis/mapgen_torus_susie_AF.Rmd
Modified: analysis/sldsc_example_GTEx_QTLs.Rmd
Modified: code/mapgen_trackplots.R
Modified: scripts/run_finemapping.R
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/make_mapgen_trackplots.Rmd
) and HTML
(docs/make_mapgen_trackplots.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 | adbc5ca | kevinlkx | 2022-09-12 | added ABC data |
html | ff411be | kevinlkx | 2022-09-12 | Build site. |
Rmd | 2b0f109 | kevinlkx | 2022-09-12 | updated trackplot with gtf based txdb |
html | 76c1546 | kevinlkx | 2022-09-12 | Build site. |
Rmd | cdf3452 | kevinlkx | 2022-09-12 | added txdb built from gtf |
html | 45bb194 | kevinlkx | 2022-08-19 | Build site. |
Rmd | 6e9c89d | kevinlkx | 2022-08-19 | added a note about counts data format |
html | ca16d13 | kevinlkx | 2022-08-18 | Build site. |
Rmd | f05e951 | kevinlkx | 2022-08-18 | added a tutorial for making track plots |
Rmd | 5295f53 | kevinlkx | 2022-08-18 | added trackplot tutorials |
Required input data:
To make the trackplots, you will need to have the following packages
installed: AnnotationDbi
, org.Hs.eg.db
,
GenomicInteractions
, Gviz
,
rtracklayer
from Bioconductor.
Load R packages
suppressMessages(library(data.table))
suppressMessages(library(tidyverse))
suppressMessages(library(GenomicRanges))
suppressMessages(library(AnnotationDbi)) # match gene ID to gene symbol
suppressMessages(library(org.Hs.eg.db)) # match gene ID to gene symbol
suppressMessages(library(GenomicInteractions)) # visualize HiC plots
suppressMessages(library(rtracklayer)) # loading bigwigs/bed files
suppressMessages(library(bigsnpr)) # loading genotype data from 1000Genomes for LD calculation
suppressMessages(library(Gviz)) # make track plots
library(mapgen)
source("code/mapgen_trackplots.R")
data.dir <- "/project2/xinhe/kevinluo/gene-level-finemapping/trackplot_tutorial/data"
Load fine-mapping results.
finemapstats <- readRDS(system.file("extdata", "aFib_Finemapped.tble.rds", package = "mapgen"))
finemapstats.gr <- process_finemapping_sumstats(finemapstats,
snp = 'snp', chr = 'chr',
pos = 'pos', pip = 'susie_pip',
pval = 'pval', zscore = 'zscore',
cs = 'CS', locus = 'locus',
pip.thresh = 0)
Processing fine-mapping summary statistics ...
Load genomic annotations and gene information
genomic.annots <- readRDS(system.file("extdata", "genomic.annots.hg19.gr.rds", package = "mapgen"))
gene.annots <- genomic.annots$genes
Load Promoter-capture HiC (PCHi-C) data from iPSC derived cardiomyocytes (CMs).
pcHiC.gr <- readRDS(system.file("extdata", "pcHiC.CM.gr.rds", package = "mapgen"))
Load ABC data
ABC <- fread(file.path(data.dir, "heart_ventricle-ENCODE_ABC.tsv.gz"))
ABC.gr <- process_ABC(ABC, ABC.thresh = 0.015, full.element = TRUE)
ABC.gr <- ABC.gr[ABC.gr$gene_name %in% gene.annots$gene_name, ] # restrict to protein coding genes
ABC.gr$score <- ABC.gr$ABC.Score * 100
Load H3K27ac and DHS bed files
H3K27ac_peaks <- rtracklayer::import(file.path(data.dir, "H3K27ac_heart_concat.bed"))
DHS_peaks <- rtracklayer::import(file.path(data.dir, "FetalHeart_E083-DNase_hg19_cleaned_narrowPeak.bed.gz"))
Load ATAC data files. These data need to be in wig, bigWig/bw, bedGraph, or bam format.
atac_data_files <- c(file.path(data.dir, "Hg19_Cardiomyocyte-TileSize-500-normMethod-ReadsInTSS-ArchR.bw.bedGraph"),
file.path(data.dir, "Hg19_Endothelial-TileSize-500-normMethod-ReadsInTSS-ArchR.bw.bedGraph"),
file.path(data.dir, "Hg19_Fibroblast-TileSize-500-normMethod-ReadsInTSS-ArchR.bw.bedGraph"))
atac_data <- lapply(atac_data_files, function(x){rtracklayer::import(x)})
names(atac_data) <- c("Cardiomyocyte", "Endothelial", "Fibroblast")
Make a track plot to visualize a locus
Load gene mapping result
gene.mapping.res <- readRDS(file.path(data.dir, "aFib_Finemapped_GeneMapped_ActivePromoter_07242021.gr.rds"))
Get the genomic region for gene of interest
gene.of.interest <- "FGF9"
region <- get_gene_region(gene.mapping.res, gene.of.interest, ext = 10000)
# Load the txdb object of the gene annotations
txdb <- AnnotationDbi::loadDb("/project2/xinhe/kevinluo/gene-level-finemapping/annot/gene_annotations/gencode.v19.annotation.gtf.sqlite")
Loading required package: GenomicFeatures
peaks <- list("H3K27ac" = H3K27ac_peaks, "DHS" = DHS_peaks)
HiC_loops <- list("PC-HiC" = pcHiC.gr, "ABC" = ABC.gr)
finemapping_annot_trackplot(finemapstats.gr,
region,
gene.annots,
genome = "hg19",
genetrack_db = "txdb",
txdb = txdb,
filter_protein_coding_genes = TRUE,
countsdata = atac_data,
data_colors = c("red", "green", "purple"),
data_ylim = c(0,0.8),
peaks = peaks,
HiC_loops = HiC_loops,
highlight_snps = "topSNP",
verbose = TRUE)
Making trackplots ...
6857 snps included.
Adding Cardiomyocyte track...
Adding Endothelial track...
Adding Fibroblast track...
Adding H3K27ac track...
Adding DHS track...
Adding PC-HiC track...
Adding ABC track...
Making gene track object using gene annotations in txdb ...
'select()' returned 1:1 mapping between keys and columns
Highlight SNPs: rs9506925
Version | Author | Date |
---|---|---|
76c1546 | kevinlkx | 2022-09-12 |
sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS/LAPACK: /software/openblas-0.3.13-el7-x86_64/lib/libopenblas_haswellp-r0.3.13.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C
[4] LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages:
[1] grid stats4 stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] GenomicFeatures_1.48.3 mapgen_0.3.10.9000
[3] Gviz_1.40.1 bigsnpr_1.10.8
[5] bigstatsr_1.5.6 rtracklayer_1.56.0
[7] GenomicInteractions_1.30.0 InteractionSet_1.24.0
[9] SummarizedExperiment_1.26.1 MatrixGenerics_1.8.0
[11] matrixStats_0.62.0 org.Hs.eg.db_3.15.0
[13] AnnotationDbi_1.58.0 Biobase_2.56.0
[15] GenomicRanges_1.48.0 GenomeInfoDb_1.32.2
[17] IRanges_2.30.0 S4Vectors_0.34.0
[19] BiocGenerics_0.42.0 forcats_0.5.1
[21] stringr_1.4.0 dplyr_1.0.9
[23] purrr_0.3.4 readr_2.1.2
[25] tidyr_1.2.0 tibble_3.1.7
[27] ggplot2_3.3.6 tidyverse_1.3.1
[29] data.table_1.14.2 workflowr_1.7.0
loaded via a namespace (and not attached):
[1] utf8_1.2.2 R.utils_2.11.0 tidyselect_1.1.2
[4] RSQLite_2.2.14 htmlwidgets_1.5.4 BiocParallel_1.30.3
[7] munsell_0.5.0 codetools_0.2-18 interp_1.1-3
[10] withr_2.5.0 colorspace_2.0-3 filelock_1.0.2
[13] highr_0.9 knitr_1.39 rstudioapi_0.13
[16] git2r_0.30.1 GenomeInfoDbData_1.2.8 bit64_4.0.5
[19] rprojroot_2.0.3 vctrs_0.4.1 generics_0.1.2
[22] xfun_0.30 biovizBase_1.44.0 BiocFileCache_2.4.0
[25] R6_2.5.1 bigassertr_0.1.5 doParallel_1.0.17
[28] bigsparser_0.6.1 AnnotationFilter_1.20.0 bitops_1.0-7
[31] cachem_1.0.6 DelayedArray_0.22.0 assertthat_0.2.1
[34] promises_1.2.0.1 BiocIO_1.6.0 scales_1.2.0
[37] nnet_7.3-17 gtable_0.3.0 processx_3.5.3
[40] ensembldb_2.20.2 rlang_1.0.2 flock_0.7
[43] splines_4.2.0 lazyeval_0.2.2 dichromat_2.0-0.1
[46] broom_0.8.0 checkmate_2.1.0 yaml_2.3.5
[49] bigparallelr_0.3.2 modelr_0.1.8 backports_1.4.1
[52] httpuv_1.6.5 Hmisc_4.7-1 tools_4.2.0
[55] ellipsis_0.3.2 jquerylib_0.1.4 RColorBrewer_1.1-3
[58] Rcpp_1.0.8.3 base64enc_0.1-3 progress_1.2.2
[61] zlibbioc_1.42.0 RCurl_1.98-1.7 ps_1.7.0
[64] prettyunits_1.1.1 rpart_4.1.16 deldir_1.0-6
[67] cowplot_1.1.1 haven_2.5.0 cluster_2.1.3
[70] fs_1.5.2 magrittr_2.0.3 reprex_2.0.1
[73] whisker_0.4 ProtGenerics_1.28.0 hms_1.1.1
[76] evaluate_0.15 XML_3.99-0.9 jpeg_0.1-9
[79] readxl_1.4.0 gridExtra_2.3 compiler_4.2.0
[82] biomaRt_2.52.0 crayon_1.5.1 R.oo_1.24.0
[85] htmltools_0.5.2 later_1.3.0 tzdb_0.3.0
[88] Formula_1.2-4 lubridate_1.8.0 DBI_1.1.3
[91] dbplyr_2.1.1 rappdirs_0.3.3 Matrix_1.4-1
[94] cli_3.3.0 R.methodsS3_1.8.1 parallel_4.2.0
[97] igraph_1.3.4 pkgconfig_2.0.3 getPass_0.2-2
[100] GenomicAlignments_1.32.0 foreign_0.8-82 xml2_1.3.3
[103] foreach_1.5.2 bslib_0.3.1 rngtools_1.5.2
[106] XVector_0.36.0 rvest_1.0.2 doRNG_1.8.2
[109] VariantAnnotation_1.42.1 callr_3.7.0 digest_0.6.29
[112] Biostrings_2.64.0 rmarkdown_2.14 cellranger_1.1.0
[115] htmlTable_2.4.0 restfulr_0.0.14 curl_4.3.2
[118] Rsamtools_2.12.0 rjson_0.2.21 lifecycle_1.0.1
[121] jsonlite_1.8.0 BSgenome_1.64.0 fansi_1.0.3
[124] pillar_1.7.0 lattice_0.20-45 KEGGREST_1.36.2
[127] fastmap_1.1.0 httr_1.4.3 survival_3.3-1
[130] glue_1.6.2 png_0.1-7 iterators_1.0.14
[133] bit_4.0.4 stringi_1.7.6 sass_0.4.1
[136] blob_1.2.3 latticeExtra_0.6-30 memoise_2.0.1