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 2b0f109. 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 | 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 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
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 = list("H3K27ac" = H3K27ac_peaks, "DHS" = DHS_peaks),
HiC_loops = list("PC-HiC" = pcHiC.gr),
highlight_snps = "topSNP")
Making trackplots ...
6857 snps included.
Adding Cardiomyocyte track...
Adding Endothelial track...
Adding Fibroblast track...
Adding H3K27ac track...
Adding DHS track...
Adding PC-HiC 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] readxl_1.4.0 backports_1.4.1 Hmisc_4.7-1
[4] BiocFileCache_2.4.0 igraph_1.3.4 lazyeval_0.2.2
[7] splines_4.2.0 BiocParallel_1.30.3 digest_0.6.29
[10] foreach_1.5.2 ensembldb_2.20.2 htmltools_0.5.2
[13] fansi_1.0.3 checkmate_2.1.0 magrittr_2.0.3
[16] memoise_2.0.1 BSgenome_1.64.0 doParallel_1.0.17
[19] cluster_2.1.3 bigassertr_0.1.5 tzdb_0.3.0
[22] Biostrings_2.64.0 modelr_0.1.8 prettyunits_1.1.1
[25] jpeg_0.1-9 colorspace_2.0-3 blob_1.2.3
[28] rvest_1.0.2 rappdirs_0.3.3 haven_2.5.0
[31] xfun_0.30 callr_3.7.0 crayon_1.5.1
[34] RCurl_1.98-1.7 jsonlite_1.8.0 flock_0.7
[37] iterators_1.0.14 VariantAnnotation_1.42.1 survival_3.3-1
[40] glue_1.6.2 gtable_0.3.0 zlibbioc_1.42.0
[43] XVector_0.36.0 DelayedArray_0.22.0 scales_1.2.0
[46] rngtools_1.5.2 bigparallelr_0.3.2 DBI_1.1.3
[49] Rcpp_1.0.8.3 htmlTable_2.4.0 progress_1.2.2
[52] foreign_0.8-82 bit_4.0.4 Formula_1.2-4
[55] htmlwidgets_1.5.4 httr_1.4.3 RColorBrewer_1.1-3
[58] ellipsis_0.3.2 pkgconfig_2.0.3 XML_3.99-0.9
[61] nnet_7.3-17 sass_0.4.1 dbplyr_2.1.1
[64] deldir_1.0-6 utf8_1.2.2 tidyselect_1.1.2
[67] rlang_1.0.2 later_1.3.0 munsell_0.5.0
[70] cellranger_1.1.0 tools_4.2.0 cachem_1.0.6
[73] cli_3.3.0 generics_0.1.2 RSQLite_2.2.14
[76] broom_0.8.0 evaluate_0.15 fastmap_1.1.0
[79] yaml_2.3.5 processx_3.5.3 knitr_1.39
[82] bit64_4.0.5 fs_1.5.2 AnnotationFilter_1.20.0
[85] KEGGREST_1.36.2 doRNG_1.8.2 whisker_0.4
[88] xml2_1.3.3 biomaRt_2.52.0 compiler_4.2.0
[91] rstudioapi_0.13 filelock_1.0.2 curl_4.3.2
[94] png_0.1-7 reprex_2.0.1 bslib_0.3.1
[97] stringi_1.7.6 highr_0.9 ps_1.7.0
[100] bigsparser_0.6.1 lattice_0.20-45 ProtGenerics_1.28.0
[103] Matrix_1.4-1 vctrs_0.4.1 pillar_1.7.0
[106] lifecycle_1.0.1 jquerylib_0.1.4 cowplot_1.1.1
[109] bitops_1.0-7 httpuv_1.6.5 R6_2.5.1
[112] BiocIO_1.6.0 latticeExtra_0.6-30 promises_1.2.0.1
[115] gridExtra_2.3 codetools_0.2-18 dichromat_2.0-0.1
[118] assertthat_0.2.1 rprojroot_2.0.3 rjson_0.2.21
[121] withr_2.5.0 GenomicAlignments_1.32.0 Rsamtools_2.12.0
[124] GenomeInfoDbData_1.2.8 parallel_4.2.0 hms_1.1.1
[127] rpart_4.1.16 rmarkdown_2.14 git2r_0.30.1
[130] biovizBase_1.44.0 getPass_0.2-2 lubridate_1.8.0
[133] base64enc_0.1-3 interp_1.1-3 restfulr_0.0.14