# Construct a small example with three chimeric reads
# (=6 local alignments) in bam format as given by
# aligners such as BWA-SW.
# The first two reads originate from the same case but
# from different strands. The third read originate from
# the reciprocal breakpoint.
library("BSgenome.Scerevisiae.UCSC.sacCer2")
bamReads = list()
bamReads[[1]] = list(
qname=c("seq1", "seq1", "seq2", "seq2", "seq3", "seq3"),
flag = as.integer(c(0, 0, 16, 16, 0, 0)),
rname = factor(c("II", "III", "III", "II", "III", "II")),
strand = factor(c("+", "+", "-", "-", "+", "+")),
pos = as.integer(c(99951, 200000, 200000, 99951, 199950, 100001)),
qwidth = as.integer(c(100, 100, 100, 100, 100, 100)),
cigar = c("50M50S","50S50M","50S50M","50M50S","50M50S", "50S50M"),
seq = DNAStringSet(c(
paste(substr(Scerevisiae$chrII, start=99951, stop=100000),
substr(Scerevisiae$chrIII, start=200000, stop=200049),
sep=""),
paste(substr(Scerevisiae$chrII, start=99951, stop=100000),
substr(Scerevisiae$chrIII, start=200000, stop=200049),
sep=""),
paste(substr(Scerevisiae$chrIII, start=200000, stop=200049),
substr(Scerevisiae$chrII, start=99951, stop=100000),
sep=""),
paste(substr(Scerevisiae$chrIII, start=200000, stop=200049),
substr(Scerevisiae$chrII, start=99951, stop=100000),
sep=""),
paste(substr(Scerevisiae$chrIII, start=199950, stop=199999),
substr(Scerevisiae$chrII, start=100001, stop=100050),
sep=""),
paste(substr(Scerevisiae$chrIII, start=199950, stop=199999),
substr(Scerevisiae$chrII, start=100001, stop=100050),
sep="")))
)
bps = detectBreakpoints(bamReads, minClusterSize=1, bsGenome=Scerevisiae)
summary(bps)
table(bps)
mergeBreakpoints(bps)
Run the code above in your browser using DataLab