R/buildREmap.R

Defines functions buildREmap

Documented in buildREmap

buildREmap <-
function(REpatternFilePath,format="fasta", BSgenomeName, outfile)
{
		if(missing(REpatternFilePath))
		{
			stop("missing required parameter REpatternFilePath!")
		}
		if (!file.exists(REpatternFilePath))
		{
			stop("REpatternFilePath specified as ", REpatternFilePath, " does not exsist!")
		}
		if (format != "fasta" && format != "fastq")
		{
			stop("format needs to be either fasta or fastq!")
		}
		if (missing(BSgenomeName) || class(BSgenomeName) != "BSgenome")
		{
			stop("BSgenomeName is required as BSgenome object!")
		}
		if (file.exists(outfile))
		{
			outfile = paste("REDseq_buildREmap", outfile,sep="_")
			#stop("outfile specified as ", outfile, " already exists! Please rename the outfile!")
		}
		dict = readDNAStringSet(REpatternFilePath, format, use.names=TRUE) 
		searchPattern(dict, BSgenomeName=BSgenomeName,outfile=outfile)
		REmap <- toGRanges(outfile, format="BED", header=TRUE, sep ="\t")
		file.remove(outfile)
		REmap	
}

Try the REDseq package in your browser

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

REDseq documentation built on Nov. 8, 2020, 8:19 p.m.