|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
library(HiCDCPlus) |
|
library(BSgenome.Hsapiens.UCSC.hg19) |
|
|
|
|
|
|
|
outdir <- "data/3D/GM12878_HiC/" |
|
hicfile_path <- paste0(outdir, "GSE63525_GM12878_insitu_primary_30.hic") |
|
|
|
|
|
process_chromosome <- function(chr) { |
|
cat("Processing chromosome:", chr, "\n") |
|
|
|
feature_path <- paste0(outdir, "hg19_5kb_GATC_", chr) |
|
|
|
construct_features(output_path=feature_path, |
|
gen="Hsapiens",gen_ver="hg19", |
|
sig="GATC", |
|
binsize=5000, |
|
chrs=c(chr), |
|
) |
|
|
|
|
|
|
|
feature_output <- paste0(feature_path, "_bintolen.txt.gz") |
|
|
|
gi_list<-generate_bintolen_gi_list(bintolen_path=feature_output) |
|
|
|
gi_list<-add_hic_counts(gi_list,hic_path = hicfile_path) |
|
|
|
gi_list<-expand_1D_features(gi_list) |
|
|
|
|
|
set.seed(1010) |
|
gi_list<-HiCDCPlus_parallel(gi_list,ncore=2) |
|
|
|
cat("gi list length:", length(gi_list), "\n") |
|
|
|
|
|
|
|
alpha <- 0.1 |
|
|
|
significant_interactions <- list() |
|
|
|
|
|
gi_list_names <- names(gi_list) |
|
for (i in seq_along(gi_list)) { |
|
name <- gi_list_names[i] |
|
|
|
gi <- gi_list[[i]] |
|
metadata_columns <- mcols(gi) |
|
qvalues <- metadata_columns$qvalue |
|
significant_interaction <- gi[qvalues <= alpha, ] |
|
|
|
significant_interactions[[i]] <- significant_interaction |
|
names(significant_interactions) <- name |
|
} |
|
|
|
|
|
|
|
|
|
save_name = paste0(outdir,'GSE63525_GM12878_HiC30_FDR_1_', chr) |
|
hicdc2hic(significant_interactions, |
|
hicfile=paste0(save_name, '.hic'), |
|
mode='normcounts', |
|
gen_ver='hg19' |
|
) |
|
gi_list_write(significant_interactions,fname=paste0(save_name, '.txt.gz')) |
|
|
|
} |
|
|
|
|
|
chromosomes <- c("chr1", "chr2", "chr3", "chr4", "chr5", "chr6", "chr7", "chr8", "chr9", "chr10", |
|
"chr11", "chr12", "chr13", "chr14", "chr15", "chr16", "chr17", "chr18", "chr19", "chr20", |
|
"chr21", "chr22", "chrX") |
|
|
|
|
|
for (chr in chromosomes) { |
|
process_chromosome(chr) |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|