1

I am using the package h5 in R to write a library. So for the same reason I am trying to build a dataset from scratch with the function createDataSet like so,

createDataSet(.Object=HDF.handle,datasetname="chrX2",data=matrix(nrow=10,ncol=10,data=NA),compression=0L,chunksize=4L,type="double")

which results in an error message:

unable to find an inherited method for function ‘createDataSet’ for signature ‘"H5File", "character", "matrix", "character", "missing", "integer", "missing", "integer", "missing"’

I have narrowed it down to the type, dimensions, maxdimensions parameters which I was providing to the function.

Regarding type, the manual says character; Character specifying data type, can be either one of:, therefore a character vector of length 1 specifying "double" should be valid.

I also considered the possibility that the package may infer the data type of the matrix from the provided matrix, because specifying matrix(nrow=10,ncol=10,data=NA) generates a matrix containing NAs of data type logical. This would in turn conflict with the type parameter.

Can someone tell me what is it that I am doing wrong in this case.

Additionally, regarding the dimensions and maxdimensions parameters. It is not very clear to me what these parameters control.

From the manual, dimensions is defined as integer; Dimensions of dataset to be created.

and maxdimensions is defined as integer; Maximum dimensions used for dataset, NA sets maxdimensions to ’unlimited’

I am a bit confused as the shape of a dataset in HDF formats once created cannot be changed without deleting the dataset. In such a case what does maxdim control?

Is this somehow related to the shape of the data which is provided?

So dimensions for a matrix should be c(nrow(matrix),ncol(matrix)) and so maxdim should also be the same.

link to the manual here

UPDATE

I got the dataset created. I found out that the conflict lies between the parameters data and the three parameters mentioned above. Removing data from the parameter list fixes the issue, but it still does not make it very clear to me what maxdimensions really does while creating a dataset.

createDataSet(.Object=GroupHandler,
datasetname="chrX",
type="double",
chunksize=4,
compression=9, 
dimensions=c(length(chrX.ranges),length(chrX.ranges)), 
maxdimensions=c(length(chrX.ranges),length(chrX.ranges)))
FoldedChromatin
  • 217
  • 1
  • 4
  • 12

0 Answers0