R/bamIterPair.R

Defines functions bamIterPair

bamIterPair <- function(bf, scParam) {
	done <- FALSE
	if (!Rsamtools::isOpen( bf))
		open(bf)
	function() {
		if (done)
			return(NULL)

		yld=GenomicAlignments::readGAlignmentPairs(bf, 
			param=scParam)
		if (length(yld) == 0L) {
			close(bf)
			done <<- TRUE
			NULL
		} else yld
	}
}

Try the IntEREst package in your browser

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

IntEREst documentation built on Nov. 8, 2020, 8:05 p.m.