getBamFileList {easyRNASeq}R Documentation

Get a BamFileList from a list of filenames

Description

A utility function to create a linkS4class{BamFileList-class}BamFileList object from a set of filenames. The filenames need to contain the file path if they are not in the working directory.

Usage

## S4 method for signature 'character'
getBamFileList(filenames = character(0))

Arguments

filenames

a character vector containing fully defined filenames

Value

a linkS4class{BamFileList-class}BamFileList

See Also

linkS4class{BamFileList-class}BamFileList dir

Examples

library(curl)
 # get the example data files - we retrieve a set of example bam files
 # from GitHub using curl, as well as their index.
 invisible(sapply(c("ACACTG","ACTAGC"),function(bam){
     curl_download(paste0("https://github.com/UPSCb/UPSCb/raw/",
                          "master/tutorial/easyRNASeq/",bam,".bam"),paste0(bam,".bam"))
     curl_download(paste0("https://github.com/UPSCb/UPSCb/raw/",
                          "master/tutorial/easyRNASeq/",bam,".bam.bai"),paste0(bam,".bam.bai"))
 }))

	# creating a BamFileList using a directory and pattern
	bfl <- getBamFileList(dir(".",pattern="[A,C,T,G]{6}\\.bam$",
    	full.names=TRUE))

  # using filenames
  filenames <- dir(".",pattern="[A,C,T,G]{6}\\.bam$",full.names=TRUE)
  bfl <- getBamFileList(filenames)

  # get them recursively
  filenames <- dir(path=".",pattern="[A,C,T,G]{6}\\.bam$",
  				     full.names=TRUE,recursive=TRUE)
  bfl <- getBamFileList(filenames)


[Package easyRNASeq version 2.16.0 Index]