Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bioinfo-pf-curie/HiTC
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: nservant/HiTC
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 17 commits
  • 5 files changed
  • 5 contributors

Commits on Apr 3, 2018

  1. Change from cBind and rBind to 'cbind' and 'rbind'.

    - Whitespace cleanup
    - version bump
    - Reference to NEWS file from Matrix package indicating
    deprecated 'cBind' and 'rBind'
    
    https://cran.r-project.org/web/packages/Matrix/news.html
    nturaga committed Apr 3, 2018
    Copy the full SHA
    0ebcd32 View commit details

Commits on Apr 30, 2018

  1. Copy the full SHA
    a04eace View commit details
  2. Copy the full SHA
    ef62f50 View commit details

Commits on Oct 30, 2018

  1. Copy the full SHA
    be108ad View commit details
  2. Copy the full SHA
    10efabc View commit details

Commits on May 2, 2019

  1. Copy the full SHA
    67cc522 View commit details
  2. Copy the full SHA
    6a2d8fd View commit details

Commits on Oct 29, 2019

  1. Copy the full SHA
    a7e9d85 View commit details
  2. Copy the full SHA
    0a0112b View commit details

Commits on Dec 18, 2019

  1. Copy the full SHA
    c0f304e View commit details

Commits on Apr 27, 2020

  1. Copy the full SHA
    763e1c7 View commit details
  2. Copy the full SHA
    c63f705 View commit details

Commits on Oct 27, 2020

  1. Copy the full SHA
    b68a85e View commit details
  2. Copy the full SHA
    1daefd6 View commit details

Commits on May 19, 2021

  1. Copy the full SHA
    012dec8 View commit details
  2. Copy the full SHA
    b84b50a View commit details

Commits on Aug 31, 2021

  1. replace mclapply by lapply

    nservant committed Aug 31, 2021
    Copy the full SHA
    528373d View commit details
Showing with 22 additions and 24 deletions.
  1. +0 −1 .BBSoptions
  2. +1 −1 DESCRIPTION
  3. +1 −1 NAMESPACE
  4. +18 −19 R/HTClist-class.R
  5. +2 −2 vignettes/HiC_analysis.Rnw
1 change: 0 additions & 1 deletion .BBSoptions

This file was deleted.

2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ Package: HiTC
Type: Package
Title: High Throughput Chromosome Conformation Capture analysis
Description: The HiTC package was developed to explore high-throughput 'C' data such as 5C or Hi-C. Dedicated R classes as well as standard methods for quality controls, normalization, visualization, and further analysis are also provided.
Version: 1.23.0
Version: 1.37.0
Date: 2015-12-15
Depends: R (>= 2.15.0), methods, IRanges, GenomicRanges
Imports: Biostrings, graphics, grDevices, rtracklayer, RColorBrewer,
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ import("IRanges")

##Package used in HiTC
importFrom("RColorBrewer", "brewer.pal")
importFrom("Matrix", "cBind", "rBind", "Matrix", "sparseMatrix", "t")
importFrom("Matrix", "Matrix", "sparseMatrix", "t")
importFrom("GenomeInfoDb", "seqlevels", "sortSeqlevels", "seqlengths")
importFrom("parallel", "mclapply")
importFrom("grDevices", "col2rgb", "colorRampPalette", "dev.off", "pdf", "pdf.options", "png")
37 changes: 18 additions & 19 deletions R/HTClist-class.R
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ setClass("HTClist",

setValidity("HTClist",
function(object){
fails <- character(0)
fails <- character(0)
## Check Chromosome Pairs Data
chrom <- sapply(object, function(x){
paste(seqlevels(x_intervals(x)), seqlevels(y_intervals(x)), sep="")
@@ -23,7 +23,7 @@ setValidity("HTClist",
##if (length(unique(unlist(ranges(object)))) > length(seqlevels(object))){
## fails <- c(fails, "Same chromosome found with different ranges")
##}

if (length(fails) > 0) return(fails)
return(TRUE)
})
@@ -33,7 +33,7 @@ HTClist <- function(...)
{
listData <- list(...)
stopifnot(length(listData) > 0L)

if (length(listData) == 1L && is.list(listData[[1L]]))
listData <- listData[[1L]]
if (!all(sapply(listData, is, "HTCexp")))
@@ -43,7 +43,7 @@ HTClist <- function(...)
names(listData) <- sapply(listData, function(x){
paste(seqlevels(y_intervals(x)), seqlevels(x_intervals(x)), sep="")
})

new("HTClist", listData)
}

@@ -59,16 +59,16 @@ setMethod("[", "HTClist",
{
if (is.character(i)){
i <- match( i, names(x))
}
}
HTClist(unlist(x)[i])
})
})


setMethod("as.list", "HTClist",
function(x)
{
as.list(unlist(x))
})
})


setMethod("c", "HTClist", function(x, ...){
@@ -109,13 +109,13 @@ setMethod(f="forcePairwise", signature(x="HTClist"),
isin <- rep(0, length(pchr))
names(isin) <- names(pchr)
isin[names(x)] <- 1

ptoadd <- pchr[names(which(isin==0))]
nmaps <- mclapply(ptoadd, function(obj){
symobj <- x[[paste0(obj[2], obj[1])]]
HTCexp(intdata=t(intdata(symobj)), xgi=y_intervals(symobj), ygi=x_intervals(symobj))
})

c(x, nmaps)
}else{
x
@@ -163,7 +163,7 @@ setMethod(f="getCombinedIntervals", signature(x="HTClist"),
x <- x[isIntraChrom(x)]
ygr <- lapply(x, y_intervals)
ygi <- suppressWarnings(do.call(c,unname(ygr)))

if(length(which(!sapply(x, isSymmetric)))>0){
xgr <- lapply(x, x_intervals)
xgi <- suppressWarnings(do.call(c,unname(xgr)))
@@ -192,7 +192,7 @@ setMethod(f="getCombinedIntervals", signature(x="HTClist"),

setMethod(f="getCombinedContacts", signature(x="HTClist"),
function(x){

message("Start combining HTCexp objects ...")
pchr <- t(as.data.frame(pair.chrom(seqlevels(x))))
gr <- getCombinedIntervals(x, merge=TRUE)
@@ -201,8 +201,8 @@ setMethod(f="getCombinedContacts", signature(x="HTClist"),

col.merged <- lapply(seqlevels(x), function(chr){
allpairs <- pchr[which(pchr[,1]==chr),]
##do.call(cBind,lapply(x[allpairs], function(xx){as(intdata(xx), "sparseMatrix")}})
do.call(cBind, apply(allpairs, 1, function(chrs){
##do.call(cbind,lapply(x[allpairs], function(xx){as(intdata(xx), "sparseMatrix")}})
do.call(cbind, apply(allpairs, 1, function(chrs){
mapname <- paste0(chrs, collapse="")
if (is.element(mapname, names(x))){
as(intdata(x[[mapname]]), "sparseMatrix")
@@ -211,8 +211,8 @@ setMethod(f="getCombinedContacts", signature(x="HTClist"),
}
}))
})
bigMat <- do.call(rBind, col.merged)

bigMat <- do.call(rbind, col.merged)
colnames(bigMat) <- rownames(bigMat) <- names(gr)
message("Object size: ",object.size(bigMat))
bigMat
@@ -231,7 +231,7 @@ setMethod(f="isComplete", signature(x="HTClist"),
mat.pairs <- matrix(0, ncol=lchrs, nrow=lchrs, dimnames=list(chrs, chrs))
for (m in x){
mat.pairs[seqlevels(m@ygi), seqlevels(m@xgi)] <- 1
}
}
maps_per_chr <- apply(mat.pairs, 1, sum) + apply(mat.pairs, 2, sum)
if (any(maps_per_chr<(length(seqlevels(x))+1)))
ret <- FALSE
@@ -248,13 +248,13 @@ setMethod(f="isBinned", signature(x="HTClist"),

setMethod(f="isIntraChrom", signature(x="HTClist"),
function(x){
sapply(x, isIntraChrom)
sapply(x, isIntraChrom)
})


setMethod(f="ranges", signature(x="HTClist"),
function(x){
GRangesList(sapply(x, range))
GRangesList(sapply(x, range))
})


@@ -316,4 +316,3 @@ setMethod("summary", signature=c(object="HTClist"),
rownames(sy) <- paste0(sy$seq1, sy$seq2)
sy
})

4 changes: 2 additions & 2 deletions vignettes/HiC_analysis.Rnw
Original file line number Diff line number Diff line change
@@ -134,7 +134,7 @@ By default, objects from the \Rclass{HTClist} class will be represented as an he
<<plot1, fig=TRUE, width=5, height=5>>=
## Go back to a smaller dataset (chr21, 22, X) at lower resolution
sset <- reduce(hic_imr90_40, chr=c("chr5","chr6","chr7"))
imr90_500 <- HTClist(mclapply(sset, binningC,
imr90_500 <- HTClist(lapply(sset, binningC,
binsize=500000, bin.adjust=FALSE, method="sum", step=1))
mapC(imr90_500)
@
@@ -166,7 +166,7 @@ resFrag
As any sequencing application, the Hi-C library preparation contains bias, which can be broadly classified as ligation bias and sequence content bias. These effects were first described by \cite{Yaffe2011} and require appropriate normalization methods.\\
\cite{Hu2012} recently proposed a linear model strategy to normalize the data. Their method (named HiCNorm) requires that the bias was infered from the restriction fragments and then used at the Hi-C resolution.
The \Rfunction{getAnnotatedRestrictionSites} function aims at annotating the restriction fragments according to their mappability (optional), GC content and effective length features. The local genomic features can be then assign to each genomic region, and normalized using the \cite{Hu2012} method.\\
In the following example, we will focus on chromosome 6 only. The same code can be easily applied on a \Rclass{HTClist} object using the \Rfunction{mclapply} function.
In the following example, we will focus on chromosome 6 only. The same code can be easily applied on a \Rclass{HTClist} object using the \Rfunction{lapply} function.
In the same way, we will not use here the mappability information for space issue. In practice, the mappability track can be downloaded from the ENCODE project data, and is important to normalize the Hi-C data.

<<annot>>=