Learn R Programming

HiCseg (version 1.1)

HiCseg_linkC_R: Link between C and R

Description

This function makes the link between C language and the R software. It consists in a two-dimensional segmentation approach.

Usage

HiCseg_linkC_R(size_mat, nb_change_max, distrib, mat_data, model)

Arguments

size_mat
Size of the data matrix
nb_change_max
Maximal number of change-points
distrib
Distribution of the data: "B" is for Negative Binomial distribution, "P" is for the Poisson distribution and "G" is for the Gaussian distribution.
mat_data
Matrix of data
model
Type of model: "D" for block-diagonal and "Dplus" for the extended block-diagonal model.

Value

Contains three attributes :
t_hat
Contains the estimated change-points
J
Values of the log-likelihood for different number of change-points up to some constants
t_est_mat
It gives the matrix of the estimated change-points for different number of change-points: in the first line when there is no change-point, in the second line when there is one change-point, in the third line when there are two change-points....

References

The method developped in this package is described in the paper "Two-dimensional segmentation for analyzing HiC data" by C. Levy-Leduc, M. Delattre, T. Mary-Huard and S. Robin, submitted to ECCB 2014.

Examples

Run this code

## The function is currently defined as
HiCseg_linkC_R <-
function(size_mat,nb_change_max,distrib,mat_data,model)
{
  K=nb_change_max^2
  
  tmp=.C("Fonction_HiC_R",as.integer(size_mat),as.integer(nb_change_max),
         as.character(distrib),as.double(as.vector(mat_data)),
         t_hat=as.integer(rep(0,nb_change_max)),J=as.double(rep(0.0,nb_change_max)),
         t_est=as.integer(rep(0,K)),as.character(model))
  
  t_est_mat=matrix(tmp$t_est,ncol=nb_change_max,byrow=T)

  return(list(t_hat=tmp$t_hat,J=tmp$J,t_est_mat=t_est_mat))
}

Run the code above in your browser using DataLab