duplicatedGAlignmentPairs: Determines which rows from a 'GAlignmentPairs' object are...

View source: R/preprocess-utils.R

duplicatedGAlignmentPairsR Documentation

Determines which rows from a GAlignmentPairs object are duplicates of a row with a smaller subscript

Description

Given a GAlignmentPairs object, duplicatedGAlignmentPairs returns a logical vector with one element for each row.

Usage

duplicatedGAlignmentPairs(galp)

Arguments

galp

a GAlignmentPairs object

Value

a logical vector corresponding to each row in the GAlignmentPairs object

Examples

library(Rsamtools)
library(svbams)
library(GenomicAlignments)
bam_path <- system.file("extdata", package="svbams", mustWork=TRUE)
bamfile <- file.path(bam_path, "cgov10t.bam")
data(bins, package='svbams')
param1 <- ScanBamParam(flag=scanBamFlag(isDuplicate=FALSE,
                                        isSecondaryAlignment=FALSE),
                       which=bins)
param1b <- ScanBamParam(flag=scanBamFlag(isDuplicate=FALSE,
                                        isSecondaryAlignment=FALSE))
## Not run: 
  galp1 <- readGAlignmentPairs(bamfile, param=param1)
  galp1 <- galp1[do.call(order, as.data.frame(galp1))]
  galp1b <- readGAlignmentPairs(bamfile, param=param1b)
  galp1b <- subsetByOverlaps(galp1b, bins, ignore.strand=TRUE)
  galp1b <- galp1b[do.call(order, as.data.frame(galp1b))]
  identical(galp1, galp1b) ## FALSE because galp1 has duplicates
  galp1 <- galp1[!duplicatedGAlignmentPairs(galp1)]
  identical(galp1, galp1b)

## End(Not run)

cancer-genomics/trellis documentation built on Aug. 20, 2024, 5:48 p.m.