# [BioC] tilingArray: error message

Wolfgang Huber huber at ebi.ac.uk
Fri Apr 3 00:18:04 CEST 2009

```Dear Hui,

thank you for the feedback.

As the man page of the "segment" function says, "The complexity of the
algorithm is 'length(x)*maxk' in memory and 'length(x)*maxk*maxcp' in
time. More specifically, the algorithm in "segment" uses two matrices of
size length(x) * maxseg, which in your case would be
2109199*140613=296580798987 ~ 300 billion. This would correspond to 3.5
Terabytes. Probably your computer does not have that much RAM memory. If
it does, its CPU might still not be fast enough for the function to
return at any useful point in time. I suggest the following solutions (I
like 2. most):

1. use a smaller value for "maxseg" (do you really expect *average*
segment length 525 bases?)

2. split up x into smaller regions (perhaps based on where gene sparse
regions are) and call "segment" separately for each.

3. Use a "greedy" algorithm (i.e. not "segment") whose complexity is
only linear in length(x).

The error message that you got comes from the fact that the computation
of the matrix size, by integer multiplication of number of columns and
number of rows, led to integer overflow. I have now changed the C code
(tilingArray >= 1.21.10) so that integer overflow at this step leads to
the error message:

"Please do not try to allocate a vector whose length is greater than
R_LEN_T_MAX."

Thanks and best wishes
Wolfgang

----------------------------------------------------
Wolfgang Huber, EMBL-EBI, http://www.ebi.ac.uk/huber

> Hi,
>
> I have a vector x of length = 2109199
> The coordinates are from  50 to 146273025 (approximately every 35bp, but
> there are some gaps)
>
> I set:
> maxk = 30
> maxseg = 140613 = length/15
>
> and run:
> segs <- segment(x, maxk = maxk, maxseg = maxseg)
>
> Here's the error message:
> Error in .Call("findsegments", G, maxseg, verbose, PACKAGE = "tilingArray")
> :
>   negative length vectors are not allowed
>
> Help anyone? Thanks!
>
> -HT
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor

```