Last updated: 2020-08-05

Checks: 6 1

Knit directory: gene_level_fine_mapping/

This reproducible R Markdown analysis was created with workflowr (version 1.6.1). 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(20200622) 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.

Using absolute paths to the files within your workflowr project makes it difficult for you and others to run your code on a different machine. Change the absolute path(s) below to the suggested relative path(s) to make your code more reproducible.

absolute relative
/Users/nicholeyang/Desktop/gene_level_fine_mapping/data/hic_eqtl.RData data/hic_eqtl.RData

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 e6a63b8. 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:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  analysis/add_hic_feature.Rmd
    Untracked:  analysis/train_add_hic.RData
    Untracked:  data/hic_eqtl.RData
    Untracked:  data/train_add_hic.RData

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/hic_raw.Rmd) and HTML (docs/hic_raw.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 e6a63b8 yunqiyang0215 2020-08-05 wflow_publish(“analysis/hic_raw.Rmd”)

Description:

This file is to merge the HiC cutoff5.txt file with the eqtl file.

HiC = read.delim2('/Users/nicholeyang/Desktop/Rotation2/data/phic/PCHiC_peak_matrix_cutoff5.txt', 
                  header = TRUE, sep="\t", quote = '')
head(HiC)
  baitChr baitStart baitEnd baitID                 baitName oeChr oeStart
1       1    831895  848168    218 RP11-54O7.16;RP11-54O7.1     1  850619
2       1    831895  848168    218 RP11-54O7.16;RP11-54O7.1     1  874082
3       1    831895  848168    218 RP11-54O7.16;RP11-54O7.1     1  889424
4       1    831895  848168    218 RP11-54O7.16;RP11-54O7.1     1  903641
5       1    831895  848168    218 RP11-54O7.16;RP11-54O7.1     1 1206874
6       1    831895  848168    218 RP11-54O7.16;RP11-54O7.1     1 1239426
    oeEnd oeID                                       oeName   dist
1  874081  220                AL645608.1;RP11-54O7.3;SAMD11  22319
2  876091  221                                            .  35055
3  903640  223                         KLHL17;NOC2L;PLEKHN1  56501
4  927394  224                             C1orf170;PLEKHN1  75486
5 1212438  254                          RP5-902P8.10;UBE2J2 369625
6 1278099  257 ACAP3;CPSF3L;GLTPD1;PUSL1;RP5-890O3.9;TAS1R3 418731
                 Mon             Mac0              Mac1              Mac2
1   25.5465679105014 23.1552423883082  37.5487280828996  34.2516228390872
2   1.93228468639624 2.56439166855171  3.35832960953219  5.71781390625809
3   4.92356508877905 4.10863780276095  7.95191424258896  6.67100364028254
4   5.05024811682171 4.46056127181517  7.55274568483025  5.76434097597794
5   3.95344923709904 3.05342972692307   5.9266242722129    4.150801828427
6 0.0609499671511617 2.05386132479862 0.618138347628004 0.913792765770951
                Neu                 MK               EP              Ery
1  28.2293866333124   25.4329063090307 36.9483228692508 30.4394201689412
2 0.610967942588545   1.58881606916046  3.4487280264009  1.8719919279133
3  1.17403563535694   4.10809950944708  5.5704135517231 3.20890617277731
4  1.38086678794133   3.26110508356071 5.31446634983579  4.7459001438327
5 0.705195645656159   1.92373630753447 4.26918359263104 1.51009840710612
6  1.62371231175963 0.0954144429114292 5.31410964122625 2.40994217190278
               FoeT              nCD4             tCD4              aCD4
1  13.4832147246969  11.8032695872144 26.7897908943447  11.2517812208312
2 0.887231881369446 0.459330395938111 1.95896718272313 0.459132392236852
3   1.9950819605042  2.80478364273435 5.39252321200808  2.57999302089654
4  2.12365103441838  3.18449816361427 4.80853619861617  3.61682722105978
5 0.728922297712605  2.30806186405942 2.47644450627396  3.53054817303909
6 0.972473318644208  2.07557541736959 1.63463813746841  2.64461892923435
              naCD4              nCD8             tCD8                 nB
1  13.0243895499638  20.7260360866038 20.4969874759968   14.1596546965918
2 0.808471646512836 0.985252844172257 1.44004824617697  0.399504574732776
3   4.1352263052192  3.69829715449806 3.03941508666268   1.30051276658696
4  2.56785725673803  8.14891311290246 5.26392207249727   2.85027486343664
5  4.26835821053397  3.59765758511374 1.96913723097127   2.16256176269305
6  1.31022047951012  0.26139793916709 1.07865712506174 0.0908178611310335
                 tB clusterID clusterPostProb
1  14.8452299904824        19           0.995
2 0.892454696469067        33           0.979
3  2.79496716119577        32           0.973
4  4.66582085120164        21           0.505
5  3.60529888022249        32           0.828
6  1.93304679521667        34           0.312
dim(HiC)[1]
[1] 728838

load the converted file

snps = read.csv("/Users/nicholeyang/Desktop/Rotation2/data/hglft_genome_38to19.bed", header = FALSE)
snp38 = read.csv('/Users/nicholeyang/Desktop/Rotation2/data/snps.txt', header = FALSE)

x = strsplit(as.character(snps$V1), '-')
x2 = unlist(lapply(x, function(y) y[1]))

snp_info = strsplit(x2, ':')

chr = unlist(lapply(snp_info, function(x) x[1]))
start = unlist(lapply(snp_info, function(x) x[2]))

dat_snp = data.frame(cbind(chr, start, as.character(snp38$V1)))
colnames(dat_snp) = c('chr', 'start', 'loc_38map')
head(dat_snp)
   chr     start                loc_38map
1 chr1 100643730 chr1:100178174-100178174
2 chr1 101361178 chr1:100895622-100895622
3 chr1  10271688   chr1:10211630-10211630
4 chr1 104097685 chr1:103555063-103555063
5 chr1 108588372 chr1:108045750-108045750
6 chr1 108742123 chr1:108199501-108199501
dat_snp$chr = gsub('\\D','', dat_snp$chr)
dat_snp$start = as.numeric(as.character(dat_snp$start))




index_list = c()
index = which((HiC$oeChr == dat_snp$chr[1]) & (HiC$oeStart < dat_snp$start[1]) & (HiC$oeEnd > dat_snp$start[1]))

df_snps = apply(dat_snp[1, ], 2, function(co) rep(co, each = length(index)))
index_list = c(index_list, index)



for(i in 2:dim(dat_snp)[1]){
  
  index = which((HiC$oeChr == dat_snp$chr[i]) & (HiC$oeStart < dat_snp$start[i]) & (HiC$oeEnd > dat_snp$start[i]))
  index_list = c(index_list, index)
  snps = apply(dat_snp[i, ], 2, function(co) rep(co, each = length(index)))
  df_snps = rbind(df_snps, snps)
}
hic_eqtl = cbind(df_snps, HiC[index_list, ])

row.names(hic_eqtl) = seq(1:dim(hic_eqtl)[1])

save(hic_eqtl, file = '/Users/nicholeyang/Desktop/gene_level_fine_mapping/data/hic_eqtl.RData')

sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.5

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/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     

other attached packages:
[1] workflowr_1.6.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4      rprojroot_1.3-2 digest_0.6.25   later_1.0.0    
 [5] R6_2.4.1        backports_1.1.5 git2r_0.26.1    magrittr_1.5   
 [9] evaluate_0.14   highr_0.8       stringi_1.4.6   rlang_0.4.5    
[13] fs_1.3.2        promises_1.1.0  whisker_0.4     rmarkdown_2.1  
[17] tools_3.6.3     stringr_1.4.0   glue_1.3.2      httpuv_1.5.2   
[21] xfun_0.12       yaml_2.2.1      compiler_3.6.3  htmltools_0.4.0
[25] knitr_1.28