R/getCol.r

Defines functions getCol

####################################################################
## Author: Gro Nilsen, Knut Liestřl and Ole Christian Lingjćrde.
## Maintainer: Gro Nilsen <gronilse@ifi.uio.no>
## License: Artistic 2.0
## Part of the copynumber package
## Reference: Nilsen and Liestřl et al. (2012), BMC Genomics
####################################################################

#Function to retrieve color in heatplot to be used for each segment:


##Input:
### seg.mean: the segment mean value
### colors: the range of color nuances to be applied
### intervals: the intervals of values corresponding to each color nuance

##Output:
### col: the color to be plotted for this segment

##Required by:
### plotHeatmap 

##Requires:
### none

#Get segments colors:
getCol <- function(seg.mean,colors,intervals){
	#Find the interval in which seg.mean is located:
	inInt <- which(intervals[,1]<seg.mean & intervals[,2]>=seg.mean)
	#Pick colour:
	col <- colors[inInt]
	return(col)
}

Try the copynumber package in your browser

Any scripts or data that you put into this service are public.

copynumber documentation built on Nov. 8, 2020, 6:10 p.m.