I am wondering if anyone can provide a clear definition of what is considered to be Fragment size and what is considered to be the Insert size. I am asking because, the plot of the Fragment size distribution in hic_results/pic/experiment/plotHiCFragmentSize seems to be made from this bit of code: with the comment histogram of insert size.
> ## Histogram of insert size
> allvalidpairs <- list.files(path=hicDir, pattern=paste0("^[[:print:]]*\\.validPairs$"), full.names=TRUE)
> stats_per_validpairs<- lapply(allvalidpairs, read.csv, sep="\t",
as.is=TRUE, header=FALSE, row.names=1, nrow=100000)
> lv <- sapply(stats_per_validpairs, "[", 7)
> lv <- lapply(lv, function(x){as.numeric(x[which(x!="None" & !
is.na(x))])})
> allhist <- lapply(lv, hist, breaks=c(
seq.int(from=0, to=1500, by=10), Inf), plot=FALSE)
> allcounts <- Reduce("+", lapply(allhist, "[[", "counts"))
>
> if (max(allcounts)>0){
+ mids <- allhist[[1]]$mids
+ mat<-data.frame(allcounts=allcounts, mids=mids)
+ mat[dim(mat)[1],2]<-1505
+ print(allcounts)
+ p2 <- plotDistanceHist(mat, sampleName, n=100000*length(allvalidpairs))
+ ggsave(filename=file.path(picDir, paste0("plotHiCFragmentSize_",sampleName,".pdf")), p2, width=7, height=5)
+ }