library(Rsamtools) # for the ex1.bam file
ex1_file <- system.file("extdata", "ex1.bam", package="Rsamtools")
galp <- readGAlignmentPairs(ex1_file, use.names=TRUE, strandMode=1)
galp
length(galp)
head(galp)
head(names(galp))
first(galp)
last(galp)
# or
second(galp)
strandMode(galp)
first(galp, real.strand=TRUE)
last(galp, real.strand=TRUE)
strand(galp)
strandMode(galp) <- 2
first(galp, real.strand=TRUE)
last(galp, real.strand=TRUE)
strand(galp)
seqnames(galp)
head(njunc(galp))
table(isProperPair(galp))
seqlevels(galp)
## Rename the reference sequences:
seqlevels(galp) <- sub("seq", "chr", seqlevels(galp))
seqlevels(galp)
galp[[1]]
unlist(galp)
grglist(galp) # a GRangesList object
strandMode(galp) <- 1
grglist(galp)
stopifnot(identical(unname(elementNROWS(grglist(galp))), njunc(galp) + 2L))
granges(galp) # a GRanges objectRun the code above in your browser using DataLab