[BioC] R help with large matrices

Ian Roberts ir210 at cam.ac.uk
Wed Apr 9 12:31:30 CEST 2008


Dear All,

I'm having memory problems producing large matrices and wonder if there is a 
better way to do what I need?  I'm a novice R user, so here's what I've done

I need to permute a scoring matrix up to 19,300 events.
That is, I have a vector of length 19,300 results and need to compare each with 
each other for all possible permutations therein of the type N!/(N-n)!

I've tried writing my own, and the permutations function of package gtools, 
however both run into trouble with vectors in excess of 1000 events.

Essentially, the score matrix provides start and stop clone numbers for an 
ordered gene list.  It works well for BAC arrays, but is failing for Agilent 
244K oligo arrays!!!

Thanks for any advice.
Ian


# FUNCTION: getSegMatrix
# Get matrix of clone comparisons.  Version 1.  Feb 2008.  Ian Roberts. 
ir210 at cam.ac.uk
#
# Generate a scoring matrix of clone start and stop numbers that compares each 
clone with every other clone for that chromosome
# E.g for a chr containing 5 clones, the matrix would be:
# x 1 2 3 4 5
#+1 2 3 4 5 x
#+2 3 4 5 x x
#+3 4 5 x x x
#+4 5 x x x x
#+5 x x x x x
#Arguments are clone start number, clone stop number and nosClones.

getSegMatrix<-function(regStart,regStop,nosClones)
{
	inVec<-c(regStart:regStop)
	nosRows<-length(inVec)
	rowNameVec<-paste("+",1:nosRows,sep="")
	scoreMatrix<-matrix(NA,nrow=nosClones,ncol=nosClones,
		dimnames=list(c(rowNameVec),c(regStart:regStop)))
	
	for (i in 1:(nosClones-1)){
		cloneStart<-inVec
		tempEnd<-cloneStart+i
		cloneEnd<-tempEnd[tempEnd <= regStop]
	scoreMatrix[i,1:length(cloneEnd)]<-cloneEnd
	}
scoreMatrix[1,1:nosClones]<-NA
return(scoreMatrix)
}



More information about the Bioconductor mailing list