[Bioc-devel] (crazy) copy-on-modification bug in GenomicFeatures

Kasper Daniel Hansen kasperdanielhansen at gmail.com
Tue Sep 22 03:30:36 CEST 2015


An anonymous student found this.

PREP
library(GenomicFeatures)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)

EXAMPLE
txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
seqlevels(txdb, force=TRUE) <- c("chr22")
gr <- GRanges(seqnames = "chr22", ranges = IRanges(start = 1, end =
52330658))
gr.trans.chr22 <- subsetByOverlaps(transcripts(txdb), gr, ignore.strand =
TRUE)
length(gr.trans.chr22)
END_EXAMPLE

if you run the EXAMPLE to END_EXAMPLE code twice after each other in an R
session, you first get the answer 1868 and second time the answer 2576.

In fact, you get behavior like this in a fresh setting

library(GenomicFeatures)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)

txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
seqlevels(txdb, force=TRUE) <- c("chr22")
library(TxDb.Hsapiens.UCSC.hg19.knownGene)
seqlevels(TxDb.Hsapiens.UCSC.hg19.knownGene)
[1] "chr22"

so here the modification of txdb gets carried through to the original
object.

Best,
Kasper

	[[alternative HTML version deleted]]



More information about the Bioc-devel mailing list